From 2877590cd894a5bf4d8e36f00a63f7fb81ea3dbc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 19:45:51 +0000 Subject: [PATCH] chore(internal): add constant for default timeout (#480) --- src/index.ts | 1 + src/resources/completions.ts | 2 +- src/resources/messages.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index e2ce21c3..01ba1962 100644 --- a/src/index.ts +++ b/src/index.ts @@ -195,6 +195,7 @@ export class Anthropic extends Core.APIClient { static Anthropic = this; static HUMAN_PROMPT = '\n\nHuman:'; static AI_PROMPT = '\n\nAssistant:'; + static DEFAULT_TIMEOUT = 600000; // 10 minutes static AnthropicError = Errors.AnthropicError; static APIError = Errors.APIError; diff --git a/src/resources/completions.ts b/src/resources/completions.ts index fe9c2c0b..86e9c602 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -33,7 +33,7 @@ export class Completions extends APIResource { ): APIPromise | APIPromise> { return this._client.post('/v1/complete', { body, - timeout: 600000, + timeout: (this._client as any)._options.timeout ?? 600000, ...options, stream: body.stream ?? false, }) as APIPromise | APIPromise>; diff --git a/src/resources/messages.ts b/src/resources/messages.ts index e45f5b78..ebc8a3d1 100644 --- a/src/resources/messages.ts +++ b/src/resources/messages.ts @@ -34,7 +34,7 @@ export class Messages extends APIResource { ): APIPromise | APIPromise> { return this._client.post('/v1/messages', { body, - timeout: 600000, + timeout: (this._client as any)._options.timeout ?? 600000, ...options, stream: body.stream ?? false, }) as APIPromise | APIPromise>;