diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8316a6d..716d004 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.29.0" + ".": "0.30.0" } diff --git a/.stats.yml b/.stats.yml index 58f0446..3effa72 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-f53d9282224f2c3943d83d014d64ba61271f3aedef59197cc4dae0102d2b365d.yml -openapi_spec_hash: a884fe7d04e9f64675e3943a962ebb65 -config_hash: 73457be4d72f0bf4c22de49f2b2d4ec3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-eacfa676c4ac9c051f61d4d25c1074315959b2e3d418bca529e6de2a9f6636e7.yml +openapi_spec_hash: 1d56caf3dd011e888fb911d34bd34aef +config_hash: 3c3a676f96a972da95e0e85618e64c76 diff --git a/CHANGELOG.md b/CHANGELOG.md index 92694e5..5e30a1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 0.30.0 (2025-11-04) + +Full Changelog: [v0.29.0...v0.30.0](https://github.com/togethercomputer/together-typescript/compare/v0.29.0...v0.30.0) + +### ⚠ BREAKING CHANGES + +* **api:** The default max retries for api calls has changed from 5 to 2. This may result in more frequent non-200 responses. + +### Features + +* **api:** Change the default max retries from 5 to 2 ([f89b597](https://github.com/togethercomputer/together-typescript/commit/f89b5970f3b5af1cdaa904de20f0e1c0493671c6)) + + +### Bug Fixes + +* Do not auto-retry on 500 errors. 501+ can retry ([7ce8399](https://github.com/togethercomputer/together-typescript/commit/7ce83993a3550d5e8f75706114543f7d7dad9cfb)) + ## 0.29.0 (2025-10-30) Full Changelog: [v0.28.0...v0.29.0](https://github.com/togethercomputer/together-typescript/compare/v0.28.0...v0.29.0) diff --git a/README.md b/README.md index d1dcad4..b9b48ac 100644 --- a/README.md +++ b/README.md @@ -165,9 +165,9 @@ Error codes are as follows: ### Retries -Certain errors will be automatically retried 5 times by default, with a short exponential backoff. +Certain errors will be automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, -429 Rate Limit, and >=500 Internal errors will all be retried by default. +429 Rate Limit, and >=501 Internal errors will all be retried by default. You can use the `maxRetries` option to configure or disable this: diff --git a/package.json b/package.json index fd2c849..e469fb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "together-ai", - "version": "0.29.0", + "version": "0.30.0", "description": "The official TypeScript library for the Together API", "author": "Together ", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index 8111450..e5a38db 100644 --- a/src/client.ts +++ b/src/client.ts @@ -161,7 +161,7 @@ export interface ClientOptions { * The maximum number of times that the client will retry a request in case of a * temporary failure, like a network error or a 5XX error from the server. * - * @default 5 + * @default 2 */ maxRetries?: number | undefined; @@ -222,7 +222,7 @@ export class Together { * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. - * @param {number} [opts.maxRetries=5] - The maximum number of times the client will retry a request. + * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. */ @@ -254,7 +254,7 @@ export class Together { parseLogLevel(readEnv('TOGETHER_LOG'), "process.env['TOGETHER_LOG']", this) ?? defaultLogLevel; this.fetchOptions = options.fetchOptions; - this.maxRetries = options.maxRetries ?? 5; + this.maxRetries = options.maxRetries ?? 2; this.fetch = options.fetch ?? Shims.getDefaultFetch(); this.#encoder = Opts.FallbackEncoder; diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts index 8f944e9..56765e5 100644 --- a/src/internal/request-options.ts +++ b/src/internal/request-options.ts @@ -41,7 +41,7 @@ export type RequestOptions = { * The maximum number of times that the client will retry a request in case of a * temporary failure, like a network error or a 5XX error from the server. * - * @default 5 + * @default 2 */ maxRetries?: number; diff --git a/src/version.ts b/src/version.ts index bef2b64..91a9bb6 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.29.0'; // x-release-please-version +export const VERSION = '0.30.0'; // x-release-please-version diff --git a/tests/index.test.ts b/tests/index.test.ts index 6213d4e..d244a51 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -339,12 +339,12 @@ describe('instantiate client', () => { }); test('maxRetries option is correctly set', () => { - const client = new Together({ maxRetries: 10, apiKey: 'My API Key' }); - expect(client.maxRetries).toEqual(10); + const client = new Together({ maxRetries: 4, apiKey: 'My API Key' }); + expect(client.maxRetries).toEqual(4); // default const client2 = new Together({ apiKey: 'My API Key' }); - expect(client2.maxRetries).toEqual(5); + expect(client2.maxRetries).toEqual(2); }); describe('withOptions', () => {