diff --git a/README.md b/README.md index 1e670180f..3e66766ab 100644 --- a/README.md +++ b/README.md @@ -178,8 +178,8 @@ See [`@azure/openai`](https://www.npmjs.com/package/@azure/openai) for an Azure- ### Retries 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), 409 Conflict, 429 Rate Limit, -and >=500 Internal errors will all be retried by default. +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. You can use the `maxRetries` option to configure or disable this: diff --git a/src/core.ts b/src/core.ts index 18190d28e..acf3bd33b 100644 --- a/src/core.ts +++ b/src/core.ts @@ -463,6 +463,9 @@ export abstract class APIClient { if (shouldRetryHeader === 'true') return true; if (shouldRetryHeader === 'false') return false; + // Retry on request timeouts. + if (response.status === 408) return true; + // Retry on lock timeouts. if (response.status === 409) return true;