From d91dbb54ef4273ad0aba4f454c3eed970688ad66 Mon Sep 17 00:00:00 2001 From: Logan Kilpatrick Date: Thu, 5 Oct 2023 17:42:51 -0700 Subject: [PATCH 1/2] Sync OpenAPI spec --- openapi.yaml | 1180 ++++++++++++++++++++++++++------------------------ 1 file changed, 605 insertions(+), 575 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 5488aaa1..e7ac1890 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -13,8 +13,29 @@ info: servers: - url: https://api.openai.com/v1 tags: - - name: OpenAI - description: The OpenAI REST API + - name: Audio + description: Learn how to turn audio into text. + - name: Chat + description: Given a list of messages comprising a conversation, the model will return a response. + - name: Completions + description: Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. + - name: Embeddings + description: Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. + - name: Fine-tuning + description: Manage fine-tuning jobs to tailor a model to your specific training data. + - name: Files + description: Files are used to upload documents that can be used with features like fine-tuning. + - name: Images + description: Given a prompt and/or an input image, the model will generate a new image. + - name: Models + description: List and describe the various models available in the API. + - name: Moderations + description: Given a input text, outputs if the model classifies it as violating OpenAI's content policy. + - name: Fine-tunes + description: Manage legacy fine-tuning jobs to tailor a model to your specific training data. + - name: Edits + description: Given a prompt and an instruction, the model will return an edited version of the prompt. + paths: # Note: When adding an endpoint, make sure you also add it in the `groups` section, in the end of this file, # under the appropriate group @@ -22,7 +43,7 @@ paths: post: operationId: createChatCompletion tags: - - OpenAI + - Chat summary: Creates a model response for the given chat conversation. requestBody: required: true @@ -318,7 +339,7 @@ paths: post: operationId: createCompletion tags: - - OpenAI + - Completions summary: Creates a completion for the provided prompt and parameters. requestBody: required: true @@ -459,7 +480,7 @@ paths: operationId: createEdit deprecated: true tags: - - OpenAI + - Edits summary: Creates a new edit for the provided input, instruction, and parameters. requestBody: required: true @@ -536,7 +557,7 @@ paths: post: operationId: createImage tags: - - OpenAI + - Images summary: Creates an image given a prompt. requestBody: required: true @@ -602,7 +623,7 @@ paths: post: operationId: createImageEdit tags: - - OpenAI + - Images summary: Creates an edited or extended image given an original image and a prompt. requestBody: required: true @@ -674,7 +695,7 @@ paths: post: operationId: createImageVariation tags: - - OpenAI + - Images summary: Creates a variation of a given image. requestBody: required: true @@ -740,7 +761,7 @@ paths: post: operationId: createEmbedding tags: - - OpenAI + - Embeddings summary: Creates an embedding vector representing the input text. requestBody: required: true @@ -817,7 +838,7 @@ paths: post: operationId: createTranscription tags: - - OpenAI + - Audio summary: Transcribes audio into the input language. requestBody: required: true @@ -873,7 +894,7 @@ paths: post: operationId: createTranslation tags: - - OpenAI + - Audio summary: Translates audio into English. requestBody: required: true @@ -924,7 +945,7 @@ paths: get: operationId: listFiles tags: - - OpenAI + - Files summary: Returns a list of files that belong to the user's organization. responses: "200": @@ -985,7 +1006,7 @@ paths: post: operationId: createFile tags: - - OpenAI + - Files summary: | Upload a file that can be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please [contact us](https://help.openai.com/) if you need to increase the storage limit. requestBody: @@ -1050,7 +1071,7 @@ paths: delete: operationId: deleteFile tags: - - OpenAI + - Files summary: Delete a file. parameters: - in: path @@ -1101,7 +1122,7 @@ paths: get: operationId: retrieveFile tags: - - OpenAI + - Files summary: Returns information about a specific file. parameters: - in: path @@ -1156,7 +1177,7 @@ paths: get: operationId: downloadFile tags: - - OpenAI + - Files summary: Returns the contents of the specified file. parameters: - in: path @@ -1202,7 +1223,7 @@ paths: post: operationId: createFineTuningJob tags: - - OpenAI + - Fine-tuning summary: | Creates a job that fine-tunes a specified model from a given dataset. @@ -1363,7 +1384,7 @@ paths: get: operationId: listPaginatedFineTuningJobs tags: - - OpenAI + - Fine-tuning summary: | List your organization's fine-tuning jobs parameters: @@ -1435,7 +1456,7 @@ paths: get: operationId: retrieveFineTuningJob tags: - - OpenAI + - Fine-tuning summary: | Get info about a fine-tuning job. @@ -1505,7 +1526,7 @@ paths: get: operationId: listFineTuningEvents tags: - - OpenAI + - Fine-tuning summary: | Get status updates for a fine-tuning job. parameters: @@ -1594,7 +1615,7 @@ paths: post: operationId: cancelFineTuningJob tags: - - OpenAI + - Fine-tuning summary: | Immediately cancel a fine-tune job. parameters: @@ -1659,7 +1680,7 @@ paths: operationId: createFineTune deprecated: true tags: - - OpenAI + - Fine-tunes summary: | Creates a job that fine-tunes a specified model from a given dataset. @@ -1751,7 +1772,7 @@ paths: operationId: listFineTunes deprecated: true tags: - - OpenAI + - Fine-tunes summary: | List your organization's fine-tuning jobs responses: @@ -1816,7 +1837,7 @@ paths: operationId: retrieveFineTune deprecated: true tags: - - OpenAI + - Fine-tunes summary: | Gets info about the fine-tune job. @@ -1938,7 +1959,7 @@ paths: operationId: cancelFineTune deprecated: true tags: - - OpenAI + - Fine-tunes summary: | Immediately cancel a fine-tune job. parameters: @@ -2012,7 +2033,7 @@ paths: operationId: listFineTuneEvents deprecated: true tags: - - OpenAI + - Fine-tunes summary: | Get fine-grained status updates for a fine-tune job. parameters: @@ -2111,7 +2132,7 @@ paths: get: operationId: listModels tags: - - OpenAI + - Models summary: Lists the currently available models, and provides basic information about each one such as the owner and availability. responses: "200": @@ -2176,7 +2197,7 @@ paths: get: operationId: retrieveModel tags: - - OpenAI + - Models summary: Retrieves a model instance, providing basic information about the model such as the owner and permissioning. parameters: - in: path @@ -2229,7 +2250,7 @@ paths: delete: operationId: deleteModel tags: - - OpenAI + - Models summary: Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. parameters: - in: path @@ -2282,7 +2303,7 @@ paths: post: operationId: createModeration tags: - - OpenAI + - Moderations summary: Classifies if text violates OpenAI's Content Policy requestBody: required: true @@ -2375,18 +2396,18 @@ components: Error: type: object properties: - type: + code: type: string - nullable: false + nullable: true message: type: string nullable: false param: type: string nullable: true - code: + type: type: string - nullable: true + nullable: false required: - type - message @@ -2419,10 +2440,10 @@ components: properties: id: type: string - object: - type: string deleted: type: boolean + object: + type: string required: - id - object @@ -2455,8 +2476,8 @@ components: description: &completions_prompt_description | The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. - Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. - default: "<|endoftext|>" + Note that is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. + default: "" nullable: true oneOf: - type: string @@ -2480,12 +2501,57 @@ components: items: type: integer example: "[[1212, 318, 257, 1332, 13]]" - suffix: - description: The suffix that comes after a completion of inserted text. + best_of: + type: integer + default: 1 + minimum: 0 + maximum: 20 + nullable: true + description: &completions_best_of_description | + Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. + + When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. + + **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + echo: + type: boolean + default: false + nullable: true + description: &completions_echo_description > + Echo back the prompt in addition to the completion + frequency_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: &completions_frequency_penalty_description | + Number between -2.0 and 2.0. Positive values penalize new tokens based on their 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) + logit_bias: &completions_logit_bias + type: object + x-oaiTypeLabel: map default: null nullable: true - type: string - example: "test." + additionalProperties: + type: integer + description: &completions_logit_bias_description | + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + + As an example, you can pass `{"50256": -100}` to prevent the token from being generated. + logprobs: &completions_logprobs_configuration + type: integer + minimum: 0 + maximum: 5 + default: null + nullable: true + description: &completions_logprobs_description | + Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. + + The maximum value for `logprobs` is 5. max_tokens: type: integer minimum: 0 @@ -2496,28 +2562,6 @@ components: The maximum number of [tokens](/tokenizer) to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. - temperature: - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - nullable: true - description: &completions_temperature_description | - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - - We generally recommend altering this or `top_p` but not both. - top_p: - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - nullable: true - description: &completions_top_p_description | - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or `temperature` but not both. n: type: integer minimum: 1 @@ -2529,29 +2573,16 @@ components: How many completions to generate for each prompt. **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. - stream: - description: > - Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). - type: boolean - nullable: true - default: false - logprobs: &completions_logprobs_configuration - type: integer - minimum: 0 - maximum: 5 - default: null + presence_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 nullable: true - description: &completions_logprobs_description | - Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. + description: &completions_presence_penalty_description | + Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - The maximum value for `logprobs` is 5. - echo: - type: boolean - default: false - nullable: true - description: &completions_echo_description > - Echo back the prompt in addition to the completion + [See more information about frequency and presence penalties.](/docs/guides/gpt/parameter-details) stop: description: &completions_stop_description > Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. @@ -2559,7 +2590,7 @@ components: nullable: true oneOf: - type: string - default: <|endoftext|> + default: example: "\n" nullable: true - type: array @@ -2568,51 +2599,41 @@ components: items: type: string example: '["\n"]' - presence_penalty: - type: number - default: 0 - minimum: -2 - maximum: 2 + stream: + description: > + Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + type: boolean nullable: true - description: &completions_presence_penalty_description | - Number between -2.0 and 2.0. Positive values penalize new tokens based on 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) - frequency_penalty: + default: false + suffix: + description: The suffix that comes after a completion of inserted text. + default: null + nullable: true + type: string + example: "test." + temperature: type: number - default: 0 - minimum: -2 + minimum: 0 maximum: 2 - nullable: true - description: &completions_frequency_penalty_description | - Number between -2.0 and 2.0. Positive values penalize new tokens based on their 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) - best_of: - type: integer default: 1 - minimum: 0 - maximum: 20 + example: 1 nullable: true - description: &completions_best_of_description | - Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. - - When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. + description: &completions_temperature_description | + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. - logit_bias: &completions_logit_bias - type: object - x-oaiTypeLabel: map - default: null + We generally recommend altering this or `top_p` but not both. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 nullable: true - additionalProperties: - type: integer - description: &completions_logit_bias_description | - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + description: &completions_top_p_description | + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. + We generally recommend altering this or `temperature` but not both. user: &end_user_param_configuration type: string example: user-1234 @@ -2630,59 +2651,59 @@ components: id: type: string description: A unique identifier for the completion. - object: - type: string - description: The object type, which is always "text_completion" - created: - type: integer - description: The Unix timestamp (in seconds) of when the completion was created. - model: - type: string - description: The model used for completion. choices: type: array description: The list of completion choices the model generated for the input prompt. items: type: object required: - - text + - finish_reason - index - logprobs - - finish_reason + - text properties: - text: + finish_reason: type: string + description: &completion_finish_reason_description | + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + or `content_filter` if content was omitted due to a flag from our content filters. + enum: ["stop", "length", "content_filter"] index: type: integer logprobs: type: object nullable: true properties: - tokens: + text_offset: type: array items: - type: string + type: integer token_logprobs: type: array items: type: number + tokens: + type: array + items: + type: string top_logprobs: type: array items: type: object additionalProperties: type: integer - text_offset: - type: array - items: - type: integer - finish_reason: + text: type: string - description: &completion_finish_reason_description | - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - or `content_filter` if content was omitted due to a flag from our content filters. - enum: ["stop", "length", "content_filter"] + created: + type: integer + description: The Unix timestamp (in seconds) of when the completion was created. + model: + type: string + description: The model used for completion. + object: + type: string + description: The object type, which is always "text_completion" usage: $ref: "#/components/schemas/CompletionUsage" required: @@ -2715,36 +2736,37 @@ components: } } + ChatCompletionRequestMessage: type: object properties: - role: - type: string - enum: ["system", "user", "assistant", "function"] - description: The role of the messages author. One of `system`, `user`, `assistant`, or `function`. content: type: string nullable: true description: The contents of the message. `content` is required for all messages, and may be null for assistant messages with function calls. - name: - type: string - description: The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters. function_call: type: object description: The name and arguments of a function that should be called, as generated by the model. properties: - name: - type: string - description: The name of the function to call. arguments: type: string description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + name: + type: string + description: The name of the function to call. required: - - name - arguments + - name + name: + type: string + description: The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters. + role: + type: string + enum: ["system", "user", "assistant", "function"] + description: The role of the messages author. One of `system`, `user`, `assistant`, or `function`. required: - - role - content + - role ChatCompletionFunctionParameters: type: object @@ -2754,12 +2776,12 @@ components: ChatCompletionFunctions: type: object properties: - name: - type: string - description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. description: type: string description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. parameters: $ref: "#/components/schemas/ChatCompletionFunctionParameters" required: @@ -2779,10 +2801,6 @@ components: type: object description: A chat completion message generated by the model. properties: - role: - type: string - enum: ["system", "user", "assistant", "function"] - description: The role of the author of this message. content: type: string description: The contents of the message. @@ -2791,15 +2809,19 @@ components: type: object description: The name and arguments of a function that should be called, as generated by the model. properties: - name: - type: string - description: The name of the function to call. arguments: type: string description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + name: + type: string + description: The name of the function to call. required: - name - arguments + role: + type: string + enum: ["system", "user", "assistant", "function"] + description: The role of the author of this message. required: - role - content @@ -2808,10 +2830,6 @@ components: type: object description: A chat completion delta generated by streamed model responses. properties: - role: - type: string - enum: ["system", "user", "assistant", "function"] - description: The role of the author of this message. content: type: string description: The contents of the chunk message. @@ -2820,16 +2838,26 @@ components: type: object description: The name and arguments of a function that should be called, as generated by the model. properties: - name: - type: string - description: The name of the function to call. arguments: type: string description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + name: + type: string + description: The name of the function to call. + role: + type: string + enum: ["system", "user", "assistant", "function"] + description: The role of the author of this message. CreateChatCompletionRequest: type: object properties: + messages: + description: A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). + type: array + minItems: 1 + items: + $ref: "#/components/schemas/ChatCompletionRequestMessage" model: description: 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. example: "gpt-3.5-turbo" @@ -2851,19 +2879,13 @@ components: "gpt-3.5-turbo-16k-0613", ] x-oaiTypeLabel: string - messages: - description: A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). - type: array - minItems: 1 - items: - $ref: "#/components/schemas/ChatCompletionRequestMessage" - functions: - description: A list of functions the model may generate JSON inputs for. - type: array - minItems: 1 - maxItems: 128 - items: - $ref: "#/components/schemas/ChatCompletionFunctions" + frequency_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: *completions_frequency_penalty_description function_call: description: > Controls how the model calls functions. "none" means the model will not call a function and instead generates a message. "auto" means the model can pick between generating a message or calling a function. Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present. @@ -2871,22 +2893,32 @@ components: - type: string enum: [none, auto] - $ref: "#/components/schemas/ChatCompletionFunctionCallOption" - temperature: - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 + functions: + description: A list of functions the model may generate JSON inputs for. + type: array + minItems: 1 + maxItems: 128 + items: + $ref: "#/components/schemas/ChatCompletionFunctions" + logit_bias: + type: object + x-oaiTypeLabel: map + default: null nullable: true - description: *completions_temperature_description - top_p: - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 + additionalProperties: + type: integer + description: | + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + max_tokens: + description: | + The maximum number of [tokens](/tokenizer) to generate in the chat completion. + + The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + default: inf + type: integer nullable: true - description: *completions_top_p_description n: type: integer minimum: 1 @@ -2895,13 +2927,13 @@ components: example: 1 nullable: true description: How many chat completion choices to generate for each input message. - stream: - description: > - If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). - type: boolean + presence_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 nullable: true - default: false + description: *completions_presence_penalty_description stop: description: | Up to 4 sequences where the API will stop generating further tokens. @@ -2914,39 +2946,29 @@ components: maxItems: 4 items: type: string - max_tokens: - description: | - The maximum number of [tokens](/tokenizer) to generate in the chat completion. - - The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. - default: inf - type: integer + stream: + description: > + If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + type: boolean nullable: true - presence_penalty: + default: false + temperature: type: number - default: 0 - minimum: -2 + minimum: 0 maximum: 2 + default: 1 + example: 1 nullable: true - description: *completions_presence_penalty_description - frequency_penalty: + description: *completions_temperature_description + top_p: type: number - default: 0 - minimum: -2 - maximum: 2 - nullable: true - description: *completions_frequency_penalty_description - logit_bias: - type: object - x-oaiTypeLabel: map - default: null + minimum: 0 + maximum: 1 + default: 1 + example: 1 nullable: true - additionalProperties: - type: integer - description: | - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + description: *completions_top_p_description user: *end_user_param_configuration required: - model @@ -2959,30 +2981,16 @@ components: id: type: string description: A unique identifier for the chat completion. - object: - type: string - description: The object type, which is always `chat.completion`. - created: - type: integer - description: The Unix timestamp (in seconds) of when the chat completion was created. - model: - type: string - description: The model used for the chat completion. choices: type: array description: A list of chat completion choices. Can be more than one if `n` is greater than 1. items: type: object required: + - finish_reason - index - message - - finish_reason properties: - index: - type: integer - description: The index of the choice in the list of choices. - message: - $ref: "#/components/schemas/ChatCompletionResponseMessage" finish_reason: type: string description: &chat_completion_finish_reason_description | @@ -2991,14 +2999,28 @@ components: `content_filter` if content was omitted due to a flag from our content filters, or `function_call` if the model called a function. enum: ["stop", "length", "function_call", "content_filter"] + index: + type: integer + description: The index of the choice in the list of choices. + message: + $ref: "#/components/schemas/ChatCompletionResponseMessage" + created: + type: integer + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + object: + type: string + description: The object type, which is always `chat.completion`. usage: $ref: "#/components/schemas/CompletionUsage" required: - - id - - object + - choices - created + - id - model - - choices + - object x-oaiMeta: name: The chat completion object group: chat @@ -3011,44 +3033,43 @@ components: id: type: string description: A unique identifier for the chat completion. - object: - type: string - description: The object type, which is always `chat.completion`. - created: - type: integer - description: The Unix timestamp (in seconds) of when the chat completion was created. - model: - type: string - description: The model used for the chat completion. choices: type: array description: A list of chat completion choices. Can be more than one if `n` is greater than 1. items: type: object required: + - finish_reason - index - message - - finish_reason properties: + finish_reason: + type: string + description: &chat_completion_function_finish_reason_description | + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, or `function_call` if the model called a function. + enum: ["stop", "length", "function_call", "content_filter"] index: type: integer description: The index of the choice in the list of choices. message: $ref: "#/components/schemas/ChatCompletionResponseMessage" - finish_reason: - type: string - description: &chat_completion_function_finish_reason_description | - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, or `function_call` if the model called a function. - enum: ["stop", "length", "function_call"] + created: + type: integer + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: + type: string + description: The model used for the chat completion. + object: + type: string + description: The object type, which is always `chat.completion`. usage: $ref: "#/components/schemas/CompletionUsage" required: - - id - - object + - choices - created + - id - model - - choices + - object x-oaiMeta: name: The chat completion object group: chat @@ -3057,14 +3078,14 @@ components: ListPaginatedFineTuningJobsResponse: type: object properties: - object: - type: string data: type: array items: $ref: "#/components/schemas/FineTuningJob" has_more: type: boolean + object: + type: string required: - object - data @@ -3077,41 +3098,41 @@ components: id: type: string description: A unique identifier for the chat completion. Each chunk has the same ID. - object: - type: string - description: The object type, which is always `chat.completion.chunk`. - created: - type: integer - description: The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp. - model: - type: string - description: The model to generate the completion. choices: type: array description: A list of chat completion choices. Can be more than one if `n` is greater than 1. items: type: object required: - - index - delta - finish_reason + - index properties: - index: - type: integer - description: The index of the choice in the list of choices. delta: $ref: "#/components/schemas/ChatCompletionStreamResponseDelta" finish_reason: type: string description: *chat_completion_finish_reason_description - enum: ["stop", "length", "function_call"] + enum: ["stop", "length", "function_call", "content_filter"] nullable: true + index: + type: integer + description: The index of the choice in the list of choices. + created: + type: integer + description: The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp. + model: + type: string + description: The model to generate the completion. + object: + type: string + description: The object type, which is always `chat.completion.chunk`. required: - - id - - object + - choices - created + - id - model - - choices + - object x-oaiMeta: name: The chat completion chunk object group: chat @@ -3120,6 +3141,10 @@ components: CreateEditRequest: type: object properties: + instruction: + description: The instruction that tells the model how to edit the prompt. + type: string + example: "Fix the spelling mistakes." model: description: ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. example: "text-davinci-edit-001" @@ -3134,10 +3159,6 @@ components: default: "" nullable: true example: "What day of the wek is it?" - instruction: - description: The instruction that tells the model how to edit the prompt. - type: string - example: "Fix the spelling mistakes." n: type: integer minimum: 1 @@ -3171,12 +3192,6 @@ components: title: Edit deprecated: true properties: - object: - type: string - description: The object type, which is always `edit`. - created: - type: integer - description: The Unix timestamp (in seconds) of when the edit was created. choices: type: array description: A list of edit choices. Can be more than one if `n` is greater than 1. @@ -3187,16 +3202,22 @@ components: - index - finish_reason properties: - text: + finish_reason: type: string - description: The edited result. + description: *completion_finish_reason_description + enum: ["stop", "length"] index: type: integer description: The index of the choice in the list of choices. - finish_reason: + text: type: string - description: *completion_finish_reason_description - enum: ["stop", "length"] + description: The edited result. + object: + type: string + description: The object type, which is always `edit`. + created: + type: integer + description: The Unix timestamp (in seconds) of when the edit was created. usage: $ref: "#/components/schemas/CompletionUsage" required: @@ -3223,13 +3244,6 @@ components: example: 1 nullable: true description: The number of images to generate. Must be between 1 and 10. - size: &images_size - type: string - enum: ["256x256", "512x512", "1024x1024"] - default: "1024x1024" - example: "1024x1024" - nullable: true - description: The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. response_format: &images_response_format type: string enum: ["url", "b64_json"] @@ -3237,6 +3251,13 @@ components: example: "url" nullable: true description: The format in which the generated images are returned. Must be one of `url` or `b64_json`. + size: &images_size + type: string + enum: ["256x256", "512x512", "1024x1024"] + default: "1024x1024" + example: "1024x1024" + nullable: true + description: The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. user: *end_user_param_configuration required: - prompt @@ -3257,12 +3278,12 @@ components: type: object description: Represents the url or the content of an image generated by the OpenAI API. properties: - url: - type: string - description: The URL of the generated image, if `response_format` is `url` (default). b64_json: type: string description: The base64-encoded JSON of the generated image, if `response_format` is `b64_json`. + url: + type: string + description: The URL of the generated image, if `response_format` is `url` (default). x-oaiMeta: name: The image object example: | @@ -3274,17 +3295,17 @@ components: type: object properties: image: - description: The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask. - type: string - format: binary - mask: - description: An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + description: The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask. type: string format: binary prompt: description: A text description of the desired image(s). The maximum length is 1000 characters. type: string example: "A cute baby sea otter wearing a beret" + mask: + description: An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + type: string + format: binary n: *images_n size: *images_size response_format: *images_response_format @@ -3301,8 +3322,8 @@ components: type: string format: binary n: *images_n - size: *images_size response_format: *images_response_format + size: *images_size user: *end_user_param_configuration required: - image @@ -3469,12 +3490,12 @@ components: ListFilesResponse: type: object properties: - object: - type: string data: type: array items: $ref: "#/components/schemas/OpenAIFile" + object: + type: string required: - object - data @@ -3517,6 +3538,16 @@ components: CreateFineTuningJobRequest: type: object properties: + model: + description: | + 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). + example: "gpt-3.5-turbo" + anyOf: + - type: string + - type: string + enum: ["babbage-002", "davinci-002", "gpt-3.5-turbo"] + x-oaiTypeLabel: string training_file: description: | The ID of an uploaded file that contains training data. @@ -3528,31 +3559,6 @@ components: See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. type: string example: "file-abc123" - validation_file: - description: | - The ID of an uploaded file that contains validation data. - - 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. - The same data should not be present in both train and validation files. - - 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. - type: string - nullable: true - example: "file-abc123" - model: - description: | - 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). - example: "gpt-3.5-turbo" - anyOf: - - type: string - - type: string - enum: ["babbage-002", "davinci-002", "gpt-3.5-turbo"] - x-oaiTypeLabel: string hyperparameters: type: object description: The hyperparameters used for the fine-tuning job. @@ -3578,19 +3584,34 @@ components: maxLength: 40 default: null nullable: true + validation_file: + description: | + The ID of an uploaded file that contains validation data. + + 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. + The same data should not be present in both train and validation files. + + 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. + type: string + nullable: true + example: "file-abc123" required: - - training_file - model + - training_file ListFineTuningJobEventsResponse: type: object properties: - object: - type: string data: type: array items: $ref: "#/components/schemas/FineTuningJobEvent" + object: + type: string required: - object - data @@ -3611,44 +3632,6 @@ components: See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. type: string example: "file-abc123" - validation_file: - description: | - The ID of an uploaded file that contains validation data. - - 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). - 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. - type: string - nullable: true - example: "file-abc123" - model: - description: | - 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. - default: "curie" - example: "curie" - nullable: true - anyOf: - - type: string - - type: string - enum: ["ada", "babbage", "curie", "davinci"] - x-oaiTypeLabel: string - n_epochs: - description: | - The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. - default: 4 - type: integer - nullable: true batch_size: description: | The batch size to use for training. The batch size is the number of @@ -3661,32 +3644,38 @@ components: default: null type: integer nullable: true - learning_rate_multiplier: + classification_betas: description: | - The learning rate multiplier to use for training. - The fine-tuning learning rate is the original learning rate used for - pretraining multiplied by this value. + If this is provided, we calculate F-beta scores at the specified + beta values. The F-beta score is a generalization of F-1 score. + This is only used for binary classification. - By default, the learning rate multiplier is the 0.05, 0.1, or 0.2 - depending on final `batch_size` (larger learning rates tend to - perform better with larger batch sizes). We recommend experimenting - with values in the range 0.02 to 0.2 to see what produces the best - results. + With a beta of 1 (i.e. the F-1 score), precision and recall are + given the same weight. A larger beta score puts more weight on + recall and less on precision. A smaller beta score puts more weight + on precision and less on recall. + type: array + items: + type: number + example: [0.6, 1, 1.5, 2] default: null - type: number nullable: true - prompt_loss_weight: + classification_n_classes: description: | - The weight to use for loss on the prompt tokens. This controls how - much the model tries to learn to generate the prompt (as compared - to the completion which always has a weight of 1.0), and can add - a stabilizing effect to training when completions are short. + The number of classes in a classification task. - If prompts are extremely long (relative to completions), it may make - sense to reduce this weight so as to avoid over-prioritizing - learning the prompt. - default: 0.01 - type: number + This parameter is required for multiclass classification. + type: integer + default: null + nullable: true + classification_positive_class: + description: | + The positive class in binary classification. + + This parameter is needed to generate precision, recall, and F1 + metrics when doing binary classification. + type: string + default: null nullable: true compute_classification_metrics: description: | @@ -3701,38 +3690,61 @@ components: type: boolean default: false nullable: true - classification_n_classes: + hyperparameters: + type: object + description: The hyperparameters used for the fine-tuning job. + properties: + n_epochs: + description: | + The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + oneOf: + - type: string + enum: [auto] + - type: integer + minimum: 1 + maximum: 50 + default: auto + learning_rate_multiplier: description: | - The number of classes in a classification task. + The learning rate multiplier to use for training. + The fine-tuning learning rate is the original learning rate used for + pretraining multiplied by this value. - This parameter is required for multiclass classification. - type: integer + By default, the learning rate multiplier is the 0.05, 0.1, or 0.2 + depending on final `batch_size` (larger learning rates tend to + perform better with larger batch sizes). We recommend experimenting + with values in the range 0.02 to 0.2 to see what produces the best + results. default: null + type: number nullable: true - classification_positive_class: + model: description: | - The positive class in binary classification. - - This parameter is needed to generate precision, recall, and F1 - metrics when doing binary classification. - type: string - default: null + 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. + default: "curie" + example: "curie" nullable: true - classification_betas: + anyOf: + - type: string + - type: string + enum: ["ada", "babbage", "curie", "davinci"] + x-oaiTypeLabel: string + prompt_loss_weight: description: | - If this is provided, we calculate F-beta scores at the specified - beta values. The F-beta score is a generalization of F-1 score. - This is only used for binary classification. + The weight to use for loss on the prompt tokens. This controls how + much the model tries to learn to generate the prompt (as compared + to the completion which always has a weight of 1.0), and can add + a stabilizing effect to training when completions are short. - With a beta of 1 (i.e. the F-1 score), precision and recall are - given the same weight. A larger beta score puts more weight on - recall and less on precision. A smaller beta score puts more weight - on precision and less on recall. - type: array - items: - type: number - example: [0.6, 1, 1.5, 2] - default: null + If prompts are extremely long (relative to completions), it may make + sense to reduce this weight so as to avoid over-prioritizing + learning the prompt. + default: 0.01 + type: number nullable: true suffix: description: | @@ -3744,18 +3756,35 @@ components: maxLength: 40 default: null nullable: true + validation_file: + description: | + The ID of an uploaded file that contains validation data. + + 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). + 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. + type: string + nullable: true + example: "file-abc123" required: - training_file ListFineTunesResponse: type: object properties: - object: - type: string data: type: array items: $ref: "#/components/schemas/FineTune" + object: + type: string required: - object - data @@ -3763,37 +3792,30 @@ components: ListFineTuneEventsResponse: type: object properties: - object: - type: string data: type: array items: $ref: "#/components/schemas/FineTuneEvent" + object: + type: string required: - object - data - - CreateEmbeddingRequest: - type: object - additionalProperties: false - properties: - model: - description: *model_description - example: "text-embedding-ada-002" - anyOf: - - type: string - - type: string - enum: ["text-embedding-ada-002"] - x-oaiTypeLabel: string + + CreateEmbeddingRequest: + type: object + additionalProperties: false + properties: input: description: | - Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens for `text-embedding-ada-002`) and cannot be an empty string. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`) and cannot be an empty string. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. example: "The quick brown fox jumped over the lazy dog" oneOf: - type: string default: "" example: "This is a test." - type: array + minItems: 1 items: type: string default: "" @@ -3811,6 +3833,14 @@ components: items: type: integer example: "[[1212, 318, 257, 1332, 13]]" + model: + description: *model_description + example: "text-embedding-ada-002" + anyOf: + - type: string + - type: string + enum: ["text-embedding-ada-002"] + x-oaiTypeLabel: string user: *end_user_param_configuration required: - model @@ -3819,17 +3849,17 @@ components: CreateEmbeddingResponse: type: object properties: - object: - type: string - description: The object type, which is always "embedding". - model: - type: string - description: The name of the model used to generate the embedding. data: type: array description: The list of embeddings generated by the model. items: $ref: "#/components/schemas/Embedding" + model: + type: string + description: The name of the model used to generate the embedding. + object: + type: string + description: The object type, which is always "embedding". usage: type: object description: The usage information for the request. @@ -3868,6 +3898,10 @@ components: - type: string enum: ["whisper-1"] x-oaiTypeLabel: string + language: + description: | + The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. + type: string prompt: description: | 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. @@ -3888,10 +3922,6 @@ components: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. type: number default: 0 - language: - description: | - The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. - type: string required: - file - model @@ -3958,12 +3988,12 @@ components: id: type: string description: The model identifier, which can be referenced in the API endpoints. - object: - type: string - description: The object type, which is always "model". created: type: integer description: The Unix timestamp (in seconds) when the model was created. + object: + type: string + description: The object type, which is always "model". owned_by: type: string description: The organization that owns the model. @@ -3984,9 +4014,6 @@ components: id: type: string description: The file identifier, which can be referenced in the API endpoints. - object: - type: string - description: The object type, which is always "file". bytes: type: integer description: The size of the file in bytes. @@ -3996,6 +4023,9 @@ components: filename: type: string description: The name of the file. + object: + type: string + description: The object type, which is always "file". purpose: type: string description: The intended purpose of the file. Currently, only "fine-tune" is supported. @@ -4036,15 +4066,15 @@ components: index: type: integer description: The index of the embedding in the list of embeddings. - object: - type: string - description: The object type, which is always "embedding". embedding: type: array description: | 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). items: type: number + object: + type: string + description: The object type, which is always "embedding". required: - index - object @@ -4072,29 +4102,36 @@ components: id: type: string description: The object identifier, which can be referenced in the API endpoints. - object: - type: string - description: The object type, which is always "fine_tuning.job". created_at: type: integer description: The Unix timestamp (in seconds) for when the fine-tuning job was created. - finished_at: - type: integer + error: + type: object nullable: true - description: The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running. - model: - type: string - description: The base model that is being fine-tuned. + description: For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure. + properties: + code: + type: string + description: A machine-readable error code. + message: + type: string + description: A human-readable error message. + param: + type: string + description: The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific. + nullable: true + required: + - code + - message + - param fine_tuned_model: type: string nullable: true description: The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running. - organization_id: - type: string - description: The organization that owns the fine-tuning job. - status: - type: string - description: The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. + finished_at: + type: integer + nullable: true + description: The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running. hyperparameters: type: object description: The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. @@ -4113,57 +4150,50 @@ components: "auto" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs. required: - n_epochs - training_file: + model: type: string - description: The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents). - validation_file: + description: The base model that is being fine-tuned. + object: type: string - nullable: true - description: The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents). + description: The object type, which is always "fine_tuning.job". + organization_id: + type: string + description: The organization that owns the fine-tuning job. result_files: type: array description: The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents). items: type: string example: file-abc123 + status: + type: string + description: The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. trained_tokens: type: integer nullable: true description: The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running. - error: - type: object + training_file: + type: string + description: The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents). + validation_file: + type: string nullable: true - description: For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure. - properties: - message: - type: string - description: A human-readable error message. - code: - type: string - description: A machine-readable error code. - param: - type: string - description: The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific. - nullable: true - required: - - message - - code - - param + description: The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents). required: - - id - - object - created_at + - error - finished_at - - model - fine_tuned_model + - hyperparameters + - id + - model + - object - organization_id + - result_files - status - - hyperparameters + - trained_tokens - training_file - validation_file - - result_files - - trained_tokens - - error x-oaiMeta: name: The fine-tuning job object example: *fine_tuning_example @@ -4174,8 +4204,6 @@ components: properties: id: type: string - object: - type: string created_at: type: integer level: @@ -4183,6 +4211,8 @@ components: enum: ["info", "warn", "error"] message: type: string + object: + type: string required: - id - object @@ -4209,100 +4239,100 @@ components: id: type: string description: The object identifier, which can be referenced in the API endpoints. - object: - type: string - description: The object type, which is always "fine-tune". created_at: type: integer description: The Unix timestamp (in seconds) for when the fine-tuning job was created. - updated_at: - type: integer - description: The Unix timestamp (in seconds) for when the fine-tuning job was last updated. - model: - type: string - description: The base model that is being fine-tuned. + events: + type: array + description: The list of events that have been observed in the lifecycle of the FineTune job. + items: + $ref: "#/components/schemas/FineTuneEvent" fine_tuned_model: type: string nullable: true description: The name of the fine-tuned model that is being created. - organization_id: - type: string - description: The organization that owns the fine-tuning job. - status: - type: string - description: The current status of the fine-tuning job, which can be either `created`, `running`, `succeeded`, `failed`, or `cancelled`. hyperparams: type: object description: The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more details. properties: - n_epochs: - type: integer - description: | - The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. batch_size: type: integer description: | The batch size to use for training. The batch size is the number of training examples used to train a single forward and backward pass. - prompt_loss_weight: - type: number + classification_n_classes: + type: integer description: | - The weight to use for loss on the prompt tokens. - learning_rate_multiplier: - type: number + The number of classes to use for computing classification metrics. + classification_positive_class: + type: string description: | - The learning rate multiplier to use for training. + The positive class to use for computing classification metrics. compute_classification_metrics: type: boolean description: | The classification metrics to compute using the validation dataset at the end of every epoch. - classification_positive_class: - type: string + learning_rate_multiplier: + type: number description: | - The positive class to use for computing classification metrics. - classification_n_classes: + The learning rate multiplier to use for training. + n_epochs: type: integer description: | - The number of classes to use for computing classification metrics. + The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + prompt_loss_weight: + type: number + description: | + The weight to use for loss on the prompt tokens. required: - - n_epochs - batch_size - - prompt_loss_weight - learning_rate_multiplier + - n_epochs + - prompt_loss_weight + model: + type: string + description: The base model that is being fine-tuned. + object: + type: string + description: The object type, which is always "fine-tune". + organization_id: + type: string + description: The organization that owns the fine-tuning job. + result_files: + type: array + description: The compiled results files for the fine-tuning job. + items: + $ref: "#/components/schemas/OpenAIFile" + status: + type: string + description: The current status of the fine-tuning job, which can be either `created`, `running`, `succeeded`, `failed`, or `cancelled`. training_files: type: array description: The list of files used for training. items: $ref: "#/components/schemas/OpenAIFile" + updated_at: + type: integer + description: The Unix timestamp (in seconds) for when the fine-tuning job was last updated. validation_files: type: array description: The list of files used for validation. items: $ref: "#/components/schemas/OpenAIFile" - result_files: - type: array - description: The compiled results files for the fine-tuning job. - items: - $ref: "#/components/schemas/OpenAIFile" - events: - type: array - description: The list of events that have been observed in the lifecycle of the FineTune job. - items: - $ref: "#/components/schemas/FineTuneEvent" required: - - id - - object - created_at - - updated_at - - model - fine_tuned_model + - hyperparams + - id + - model + - object - organization_id + - result_files - status - - hyperparams - training_files + - updated_at - validation_files - - result_files x-oaiMeta: name: The fine-tune object example: *fine_tune_example @@ -4312,14 +4342,14 @@ components: deprecated: true description: Fine-tune event object properties: - object: - type: string created_at: type: integer level: type: string message: type: string + object: + type: string required: - object - created_at @@ -4339,12 +4369,12 @@ components: type: object description: Usage statistics for the completion request. properties: - prompt_tokens: - type: integer - description: Number of tokens in the prompt. completion_tokens: type: integer description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + description: Number of tokens in the prompt. total_tokens: type: integer description: Total number of tokens used in the request (prompt + completion). @@ -4459,7 +4489,7 @@ x-oaiMeta: path: cancel - type: object key: FineTuningJobEvent - path: object + path: event-object - type: endpoint key: listFineTuningEvents path: list-events @@ -4560,7 +4590,7 @@ x-oaiMeta: path: cancel - type: object key: FineTuneEvent - path: object + path: event-object - type: endpoint key: listFineTuneEvents path: list-events From f72446bd9f887e8cabe7ba4ecbebda01da453b55 Mon Sep 17 00:00:00 2001 From: Logan Kilpatrick Date: Sun, 8 Oct 2023 13:49:04 -0700 Subject: [PATCH 2/2] Re-add end of text --- openapi.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index e7ac1890..83add4d3 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2476,8 +2476,8 @@ components: description: &completions_prompt_description | The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. - Note that is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. - default: "" + Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. + default: "<|endoftext|>" nullable: true oneOf: - type: string @@ -2541,7 +2541,7 @@ components: Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - As an example, you can pass `{"50256": -100}` to prevent the token from being generated. + As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. logprobs: &completions_logprobs_configuration type: integer minimum: 0 @@ -2590,7 +2590,7 @@ components: nullable: true oneOf: - type: string - default: + default: <|endoftext|> example: "\n" nullable: true - type: array