Skip to content

Commit

Permalink
chore(internal): add constant for default timeout (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jul 29, 2024
1 parent e31a467 commit 2877590
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/resources/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>>;
Expand Down
2 changes: 1 addition & 1 deletion src/resources/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,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>>;
Expand Down

0 comments on commit 2877590

Please sign in to comment.