From f5ecb42b07b810dd8afaa412775f4e6298aaea6d 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 e7001d60..f45aaefa 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<Completion> | APIPromise<Stream<Completion>> {
     return this._client.post('/v1/complete', {
       body,
-      timeout: 600000,
+      timeout: (this._client as any)._options.timeout ?? 600000,
       ...options,
       stream: body.stream ?? false,
     }) as APIPromise<Completion> | APIPromise<Stream<Completion>>;
diff --git a/src/resources/messages.ts b/src/resources/messages.ts
index b621df75..6ec11047 100644
--- a/src/resources/messages.ts
+++ b/src/resources/messages.ts
@@ -31,7 +31,7 @@ export class Messages extends APIResource {
   ): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
     return this._client.post('/v1/messages', {
       body,
-      timeout: 600000,
+      timeout: (this._client as any)._options.timeout ?? 600000,
       ...options,
       stream: body.stream ?? false,
     }) as APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>>;