-
Notifications
You must be signed in to change notification settings - Fork 8
release: 0.38.0 #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release: 0.38.0 #212
Changes from all commits
4677c82
26ebf87
f4049d5
1376258
f5a8b94
7fdfcca
6df3f30
70ad44b
7365202
e7a8aaf
af4c47f
d73f69f
a0c187e
03d5f94
b6f30b6
bb39360
ac14bf7
be7e0e7
eab2b6e
703f103
54dc83f
1d3a34e
7be3686
cb4bdcb
71e55a9
52c3b77
d59291f
11669ff
4f232bf
eb83352
2749638
603c86c
e481cda
940974d
e442dfd
4dac51b
021d571
5bd7444
e8d66c5
91a8c77
9ddb570
206ba6d
eb817bf
9fe1286
2463a75
66bdf7e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| { | ||
| ".": "0.37.0" | ||
| ".": "0.38.0" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| configured_endpoints: 75 | ||
| openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-dc45695614158674dec4da8ae843a7564905f24d2ce577e8e6e5246b4a7b0f61.yml | ||
| openapi_spec_hash: 46a91a84c8c270792676ee863b33ab99 | ||
| config_hash: 67b76d1064bef2e591cadf50de08ad19 | ||
| openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-31893d157d3c85caa1d8615b73a5fa431ea2cc126bd2410e0f84f3defd5c7dec.yml | ||
| openapi_spec_hash: b652a4d504b4a3dbf585ab803b0f59fc | ||
| config_hash: 52d213100a0ca1a4b2cdcd2718936b51 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import type { APIResponseProps } from './internal/parse'; | |
| import { getPlatformHeaders } from './internal/detect-platform'; | ||
| import * as Shims from './internal/shims'; | ||
| import * as Opts from './internal/request-options'; | ||
| import { stringifyQuery } from './internal/utils/query'; | ||
| import { VERSION } from './version'; | ||
| import * as Errors from './core/error'; | ||
| import * as Uploads from './core/uploads'; | ||
|
|
@@ -56,15 +57,7 @@ import { | |
| Evals, | ||
| EvaluationJob, | ||
| } from './resources/evals'; | ||
| import { | ||
| FileDeleteResponse, | ||
| FileList, | ||
| FileObject, | ||
| FilePurpose, | ||
| FileResponse, | ||
| FileType, | ||
| Files, | ||
| } from './resources/files'; | ||
| import { FileDeleteResponse, FileList, FilePurpose, FileResponse, FileType, Files } from './resources/files'; | ||
| import { | ||
| FineTuning, | ||
| FineTuningCancelResponse, | ||
|
|
@@ -297,21 +290,8 @@ export class Together { | |
| /** | ||
| * Basic re-implementation of `qs.stringify` for primitive types. | ||
| */ | ||
| protected stringifyQuery(query: Record<string, unknown>): string { | ||
| return Object.entries(query) | ||
| .filter(([_, value]) => typeof value !== 'undefined') | ||
| .map(([key, value]) => { | ||
| if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
| return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`; | ||
| } | ||
| if (value === null) { | ||
| return `${encodeURIComponent(key)}=`; | ||
| } | ||
| throw new Errors.TogetherError( | ||
| `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`, | ||
| ); | ||
| }) | ||
| .join('&'); | ||
| protected stringifyQuery(query: object | Record<string, unknown>): string { | ||
| return stringifyQuery(query); | ||
| } | ||
|
|
||
| private getUserAgent(): string { | ||
|
|
@@ -343,12 +323,13 @@ export class Together { | |
| : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path)); | ||
|
|
||
| const defaultQuery = this.defaultQuery(); | ||
| if (!isEmptyObj(defaultQuery)) { | ||
| query = { ...defaultQuery, ...query }; | ||
| const pathQuery = Object.fromEntries(url.searchParams); | ||
| if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) { | ||
| query = { ...pathQuery, ...defaultQuery, ...query }; | ||
| } | ||
|
|
||
| if (typeof query === 'object' && query && !Array.isArray(query)) { | ||
| url.search = this.stringifyQuery(query as Record<string, unknown>); | ||
| url.search = this.stringifyQuery(query); | ||
| } | ||
|
|
||
| return url.toString(); | ||
|
|
@@ -532,7 +513,7 @@ export class Together { | |
| loggerFor(this).info(`${responseInfo} - ${retryMessage}`); | ||
|
|
||
| const errText = await response.text().catch((err: any) => castToError(err).message); | ||
| const errJSON = safeJSON(errText); | ||
| const errJSON = safeJSON(errText) as any; | ||
| const errMessage = errJSON ? undefined : errText; | ||
|
|
||
| loggerFor(this).debug( | ||
|
|
@@ -599,7 +580,6 @@ export class Together { | |
| return await this.fetch.call(undefined, url, fetchOptions); | ||
| } finally { | ||
| clearTimeout(timeout); | ||
| if (signal) signal.removeEventListener('abort', abort); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -655,9 +635,9 @@ export class Together { | |
| } | ||
| } | ||
|
|
||
| // If the API asks us to wait a certain amount of time (and it's a reasonable amount), | ||
| // just do what it says, but otherwise calculate a default | ||
| if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) { | ||
| // If the API asks us to wait a certain amount of time, just do what it | ||
| // says, but otherwise calculate a default | ||
| if (timeoutMillis === undefined) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Retry delay accepts NaN and negative timeout valuesMedium Severity The retry timeout guard was changed from |
||
| const maxRetries = options.maxRetries ?? this.maxRetries; | ||
| timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); | ||
| } | ||
|
|
@@ -783,6 +763,14 @@ export class Together { | |
| (Symbol.iterator in body && 'next' in body && typeof body.next === 'function')) | ||
| ) { | ||
| return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) }; | ||
| } else if ( | ||
| typeof body === 'object' && | ||
| headers.values.get('content-type') === 'application/x-www-form-urlencoded' | ||
| ) { | ||
| return { | ||
| bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' }, | ||
| body: this.stringifyQuery(body), | ||
| }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Form encoding depends on exact content-typeLow Severity
|
||
| } else { | ||
| return this.#encoder({ body, headers }); | ||
| } | ||
|
|
@@ -868,7 +856,6 @@ export declare namespace Together { | |
| export { | ||
| Files as Files, | ||
| type FileList as FileList, | ||
| type FileObject as FileObject, | ||
| type FilePurpose as FilePurpose, | ||
| type FileResponse as FileResponse, | ||
| type FileType as FileType, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
|
||
| import { TogetherError } from '../../core/error'; | ||
|
|
||
| /** | ||
| * Basic re-implementation of `qs.stringify` for primitive types. | ||
| */ | ||
| export function stringifyQuery(query: object | Record<string, unknown>) { | ||
| return Object.entries(query) | ||
| .filter(([_, value]) => typeof value !== 'undefined') | ||
| .map(([key, value]) => { | ||
| if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
| return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`; | ||
| } | ||
| if (value === null) { | ||
| return `${encodeURIComponent(key)}=`; | ||
| } | ||
| throw new TogetherError( | ||
| `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`, | ||
| ); | ||
| }) | ||
| .join('&'); | ||
| } |


Uh oh!
There was an error while loading. Please reload this page.