Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(next => master): release 4.7.0 #307

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.6.0"
".": "4.7.0"
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 4.7.0 (2023-09-14)

Full Changelog: [v4.6.0...v4.7.0](https://github.com/openai/openai-node/compare/v4.6.0...v4.7.0)

### Features

* **client:** retry on 408 Request Timeout ([#310](https://github.com/openai/openai-node/issues/310)) ([1f98eac](https://github.com/openai/openai-node/commit/1f98eac5be956e56d75ef5456115165b45a4763c))
* make docs urls in comments absolute ([#306](https://github.com/openai/openai-node/issues/306)) ([9db3819](https://github.com/openai/openai-node/commit/9db381961e38d2280b0602447e7d91691b327bde))

## 4.6.0 (2023-09-08)

Full Changelog: [v4.5.0...v4.6.0](https://github.com/openai/openai-node/compare/v4.5.0...v4.6.0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openai",
"version": "4.6.0",
"version": "4.7.0",
"description": "Client library for the OpenAI API",
"author": "OpenAI <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions src/resources/audio/transcriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export interface TranscriptionCreateParams {

/**
* An optional text to guide the model's style or continue a previous audio
* segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the
* audio language.
* segment. The
* [prompt](https://platform.openai.com/docs/guides/speech-to-text/prompting)
* should match the audio language.
*/
prompt?: string;

Expand Down
5 changes: 3 additions & 2 deletions src/resources/audio/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export interface TranslationCreateParams {

/**
* An optional text to guide the model's style or continue a previous audio
* segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in
* English.
* segment. The
* [prompt](https://platform.openai.com/docs/guides/speech-to-text/prompting)
* should be in English.
*/
prompt?: string;

Expand Down
14 changes: 8 additions & 6 deletions src/resources/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ export interface ChatCompletionCreateParamsBase {

/**
* ID of the model to use. See the
* [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table
* for details on which models work with the Chat API.
* [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility)
* table for details on which models work with the Chat API.
*/
model:
| (string & {})
Expand All @@ -326,7 +326,7 @@ export interface ChatCompletionCreateParamsBase {
* existing frequency in the text so far, decreasing the model's likelihood to
* repeat the same line verbatim.
*
* [See more information about frequency and presence penalties.](/docs/guides/gpt/parameter-details)
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
*/
frequency_penalty?: number | null;

Expand Down Expand Up @@ -377,7 +377,7 @@ export interface ChatCompletionCreateParamsBase {
* whether they appear in the text so far, increasing the model's likelihood to
* talk about new topics.
*
* [See more information about frequency and presence penalties.](/docs/guides/gpt/parameter-details)
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
*/
presence_penalty?: number | null;

Expand Down Expand Up @@ -416,7 +416,8 @@ export interface ChatCompletionCreateParamsBase {

/**
* A unique identifier representing your end-user, which can help OpenAI to monitor
* and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
* and detect abuse.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).
*/
user?: string;
}
Expand All @@ -438,7 +439,8 @@ export namespace ChatCompletionCreateParams {

/**
* The parameters the functions accepts, described as a JSON Schema object. See the
* [guide](/docs/guides/gpt/function-calling) for examples, and the
* [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for
* examples, and the
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
* documentation about the format.
*
Expand Down
14 changes: 8 additions & 6 deletions src/resources/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ export type CompletionCreateParams = CompletionCreateParamsNonStreaming | Comple
export interface CompletionCreateParamsBase {
/**
* ID of the model to use. You can use the
* [List models](/docs/api-reference/models/list) API to see all of your available
* models, or see our [Model overview](/docs/models/overview) for descriptions of
* them.
* [List models](https://platform.openai.com/docs/api-reference/models/list) API to
* see all of your available models, or see our
* [Model overview](https://platform.openai.com/docs/models/overview) for
* descriptions of them.
*/
model:
| (string & {})
Expand Down Expand Up @@ -166,7 +167,7 @@ export interface CompletionCreateParamsBase {
* existing frequency in the text so far, decreasing the model's likelihood to
* repeat the same line verbatim.
*
* [See more information about frequency and presence penalties.](/docs/guides/gpt/parameter-details)
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
*/
frequency_penalty?: number | null;

Expand Down Expand Up @@ -221,7 +222,7 @@ export interface CompletionCreateParamsBase {
* whether they appear in the text so far, increasing the model's likelihood to
* talk about new topics.
*
* [See more information about frequency and presence penalties.](/docs/guides/gpt/parameter-details)
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
*/
presence_penalty?: number | null;

Expand Down Expand Up @@ -266,7 +267,8 @@ export interface CompletionCreateParamsBase {

/**
* A unique identifier representing your end-user, which can help OpenAI to monitor
* and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
* and detect abuse.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).
*/
user?: string;
}
Expand Down
13 changes: 8 additions & 5 deletions src/resources/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export namespace CreateEmbeddingResponse {
export interface Embedding {
/**
* The embedding vector, which is a list of floats. The length of vector depends on
* the model as listed in the [embedding guide](/docs/guides/embeddings).
* the model as listed in the
* [embedding guide](https://platform.openai.com/docs/guides/embeddings).
*/
embedding: Array<number>;

Expand Down Expand Up @@ -89,15 +90,17 @@ export interface EmbeddingCreateParams {

/**
* ID of the model to use. You can use the
* [List models](/docs/api-reference/models/list) API to see all of your available
* models, or see our [Model overview](/docs/models/overview) for descriptions of
* them.
* [List models](https://platform.openai.com/docs/api-reference/models/list) API to
* see all of your available models, or see our
* [Model overview](https://platform.openai.com/docs/models/overview) for
* descriptions of them.
*/
model: (string & {}) | 'text-embedding-ada-002';

/**
* A unique identifier representing your end-user, which can help OpenAI to monitor
* and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
* and detect abuse.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).
*/
user?: string;
}
Expand Down
5 changes: 3 additions & 2 deletions src/resources/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ export interface FileCreateParams {
/**
* The intended purpose of the uploaded documents.
*
* Use "fine-tune" for [fine-tuning](/docs/api-reference/fine-tuning). This allows
* us to validate the format of the uploaded file.
* Use "fine-tune" for
* [fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning). This
* allows us to validate the format of the uploaded file.
*/
purpose: string;
}
Expand Down
31 changes: 16 additions & 15 deletions src/resources/fine-tunes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class FineTunes extends APIResource {
* Response includes details of the enqueued job including job status and the name
* of the fine-tuned models once complete.
*
* [Learn more about fine-tuning](/docs/guides/legacy-fine-tuning)
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/legacy-fine-tuning)
*/
create(body: FineTuneCreateParams, options?: Core.RequestOptions): Core.APIPromise<FineTune> {
return this.post('/fine-tunes', { body, ...options });
Expand All @@ -24,7 +24,7 @@ export class FineTunes extends APIResource {
/**
* Gets info about the fine-tune job.
*
* [Learn more about fine-tuning](/docs/guides/legacy-fine-tuning)
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/legacy-fine-tuning)
*/
retrieve(fineTuneId: string, options?: Core.RequestOptions): Core.APIPromise<FineTune> {
return this.get(`/fine-tunes/${fineTuneId}`, options);
Expand Down Expand Up @@ -105,8 +105,8 @@ export interface FineTune {

/**
* The hyperparameters used for the fine-tuning job. See the
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more
* details.
* [fine-tuning guide](https://platform.openai.com/docs/guides/legacy-fine-tuning/hyperparameters)
* for more details.
*/
hyperparams: FineTune.Hyperparams;

Expand Down Expand Up @@ -160,8 +160,8 @@ export interface FineTune {
export namespace FineTune {
/**
* The hyperparameters used for the fine-tuning job. See the
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more
* details.
* [fine-tuning guide](https://platform.openai.com/docs/guides/legacy-fine-tuning/hyperparameters)
* for more details.
*/
export interface Hyperparams {
/**
Expand Down Expand Up @@ -224,15 +224,16 @@ export interface FineTuneCreateParams {
/**
* The ID of an uploaded file that contains training data.
*
* See [upload file](/docs/api-reference/files/upload) for how to upload a file.
* See [upload file](https://platform.openai.com/docs/api-reference/files/upload)
* for how to upload a file.
*
* Your dataset must be formatted as a JSONL file, where each training example is a
* JSON object with the keys "prompt" and "completion". Additionally, you must
* upload your file with the purpose `fine-tune`.
*
* See the
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for
* more details.
* [fine-tuning guide](https://platform.openai.com/docs/guides/legacy-fine-tuning/creating-training-data)
* for more details.
*/
training_file: string;

Expand Down Expand Up @@ -276,7 +277,7 @@ export interface FineTuneCreateParams {
* If set, we calculate classification-specific metrics such as accuracy and F-1
* score using the validation set at the end of every epoch. These metrics can be
* viewed in the
* [results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model).
* [results file](https://platform.openai.com/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model).
*
* In order to compute classification metrics, you must provide a
* `validation_file`. Additionally, you must specify `classification_n_classes` for
Expand All @@ -299,8 +300,8 @@ export interface FineTuneCreateParams {
/**
* The name of the base model to fine-tune. You can select one of "ada", "babbage",
* "curie", "davinci", or a fine-tuned model created after 2022-04-21 and before
* 2023-08-22. To learn more about these models, see the [Models](/docs/models)
* documentation.
* 2023-08-22. To learn more about these models, see the
* [Models](https://platform.openai.com/docs/models) documentation.
*/
model?: (string & {}) | 'ada' | 'babbage' | 'curie' | 'davinci' | null;

Expand Down Expand Up @@ -335,16 +336,16 @@ export interface FineTuneCreateParams {
*
* If you provide this file, the data is used to generate validation metrics
* periodically during fine-tuning. These metrics can be viewed in the
* [fine-tuning results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model).
* [fine-tuning results file](https://platform.openai.com/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model).
* Your train and validation data should be mutually exclusive.
*
* Your dataset must be formatted as a JSONL file, where each validation example is
* a JSON object with the keys "prompt" and "completion". Additionally, you must
* upload your file with the purpose `fine-tune`.
*
* See the
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for
* more details.
* [fine-tuning guide](https://platform.openai.com/docs/guides/legacy-fine-tuning/creating-training-data)
* for more details.
*/
validation_file?: string | null;
}
Expand Down
21 changes: 13 additions & 8 deletions src/resources/fine-tuning/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Jobs extends APIResource {
* Response includes details of the enqueued job including job status and the name
* of the fine-tuned models once complete.
*
* [Learn more about fine-tuning](/docs/guides/fine-tuning)
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
*/
create(body: JobCreateParams, options?: Core.RequestOptions): Core.APIPromise<FineTuningJob> {
return this.post('/fine_tuning/jobs', { body, ...options });
Expand All @@ -23,7 +23,7 @@ export class Jobs extends APIResource {
/**
* Get info about a fine-tuning job.
*
* [Learn more about fine-tuning](/docs/guides/fine-tuning)
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
*/
retrieve(fineTuningJobId: string, options?: Core.RequestOptions): Core.APIPromise<FineTuningJob> {
return this.get(`/fine_tuning/jobs/${fineTuningJobId}`, options);
Expand Down Expand Up @@ -111,7 +111,8 @@ export interface FineTuningJob {

/**
* The hyperparameters used for the fine-tuning job. See the
* [fine-tuning guide](/docs/guides/fine-tuning) for more details.
* [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for
* more details.
*/
hyperparameters: FineTuningJob.Hyperparameters;

Expand Down Expand Up @@ -165,7 +166,8 @@ export interface FineTuningJob {
export namespace FineTuningJob {
/**
* The hyperparameters used for the fine-tuning job. See the
* [fine-tuning guide](/docs/guides/fine-tuning) for more details.
* [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for
* more details.
*/
export interface Hyperparameters {
/**
Expand Down Expand Up @@ -193,19 +195,21 @@ export interface FineTuningJobEvent {
export interface JobCreateParams {
/**
* The name of the model to fine-tune. You can select one of the
* [supported models](/docs/guides/fine-tuning/what-models-can-be-fine-tuned).
* [supported models](https://platform.openai.com/docs/guides/fine-tuning/what-models-can-be-fine-tuned).
*/
model: (string & {}) | 'babbage-002' | 'davinci-002' | 'gpt-3.5-turbo';

/**
* The ID of an uploaded file that contains training data.
*
* See [upload file](/docs/api-reference/files/upload) for how to upload a file.
* See [upload file](https://platform.openai.com/docs/api-reference/files/upload)
* for how to upload a file.
*
* Your dataset must be formatted as a JSONL file. Additionally, you must upload
* your file with the purpose `fine-tune`.
*
* See the [fine-tuning guide](/docs/guides/fine-tuning) for more details.
* See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
* for more details.
*/
training_file: string;

Expand Down Expand Up @@ -234,7 +238,8 @@ export interface JobCreateParams {
* Your dataset must be formatted as a JSONL file. You must upload your file with
* the purpose `fine-tune`.
*
* See the [fine-tuning guide](/docs/guides/fine-tuning) for more details.
* See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
* for more details.
*/
validation_file?: string | null;
}
Expand Down
Loading