Skip to content

Commit 2877590

Browse files
chore(internal): add constant for default timeout (#480)
1 parent e31a467 commit 2877590

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export class Anthropic extends Core.APIClient {
195195
static Anthropic = this;
196196
static HUMAN_PROMPT = '\n\nHuman:';
197197
static AI_PROMPT = '\n\nAssistant:';
198+
static DEFAULT_TIMEOUT = 600000; // 10 minutes
198199

199200
static AnthropicError = Errors.AnthropicError;
200201
static APIError = Errors.APIError;

src/resources/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class Completions extends APIResource {
3333
): APIPromise<Completion> | APIPromise<Stream<Completion>> {
3434
return this._client.post('/v1/complete', {
3535
body,
36-
timeout: 600000,
36+
timeout: (this._client as any)._options.timeout ?? 600000,
3737
...options,
3838
stream: body.stream ?? false,
3939
}) as APIPromise<Completion> | APIPromise<Stream<Completion>>;

src/resources/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class Messages extends APIResource {
3434
): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
3535
return this._client.post('/v1/messages', {
3636
body,
37-
timeout: 600000,
37+
timeout: (this._client as any)._options.timeout ?? 600000,
3838
...options,
3939
stream: body.stream ?? false,
4040
}) as APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>>;

0 commit comments

Comments
 (0)