specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-09-01-preview/inference.yaml (6,603 lines of code) (raw):
openapi: 3.0.0
info:
title: Azure OpenAI Service API
description: Azure OpenAI APIs for completions and search
version: 2024-09-01-preview
servers:
- url: https://{endpoint}/openai
variables:
endpoint:
default: your-resource-name.openai.azure.com
security:
- bearer:
- api.read
- apiKey: []
paths:
/deployments/{deployment-id}/completions:
post:
summary: Creates a completion for the provided prompt, parameters and chosen model.
operationId: Completions_Create
parameters:
- in: path
name: deployment-id
required: true
schema:
type: string
example: davinci
description: Deployment id of the model which was deployed.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createCompletionRequest"
example:
prompt: |-
Negate the following sentence.The price for bubblegum increased on thursday.
Negated Sentence:
max_tokens: 50
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/createCompletionResponse"
example:
model: davinci
object: text_completion
id: cmpl-4509KAos68kxOqpE2uYGw81j6m7uo
created: 1637097562
choices:
- index: 0
text: The price for bubblegum decreased on thursday.
logprobs: null
finish_reason: stop
headers:
apim-request-id:
description: Request ID for troubleshooting purposes
schema:
type: string
default:
description: Service unavailable
content:
application/json:
schema:
$ref: "#/components/schemas/errorResponse"
headers:
apim-request-id:
description: Request ID for troubleshooting purposes
schema:
type: string
/deployments/{deployment-id}/embeddings:
post:
summary: Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
operationId: embeddings_create
parameters:
- in: path
name: deployment-id
required: true
schema:
type: string
example: ada-search-index-v1
description: The deployment id of the model which was deployed.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: true
properties:
input:
description: |-
Input text to get embeddings for, encoded as a string. To get embeddings for multiple inputs in a single request, pass an array of strings. Each input must not exceed 2048 tokens in length.
Unless you are embedding code, we suggest replacing newlines (\n) in your input with a single space, as we have observed inferior results when newlines are present.
oneOf:
- type: string
default: ""
example: This is a test.
nullable: true
- type: array
minItems: 1
maxItems: 2048
items:
type: string
minLength: 1
example: This is a test.
nullable: false
user:
description: A unique identifier representing your end-user, which can help monitoring and detecting abuse.
type: string
nullable: false
input_type:
description: input type of embedding search to use
type: string
example: query
encoding_format:
description: The format to return the embeddings in. Can be either `float` or `base64`. Defaults to `float`.
type: string
example: base64
nullable: true
dimensions:
description: The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.
type: integer
example: 1
nullable: true
required:
- input
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
object:
type: string
model:
type: string
data:
type: array
items:
type: object
properties:
index:
type: integer
object:
type: string
embedding:
type: array
items:
type: number
required:
- index
- object
- embedding
usage:
type: object
properties:
prompt_tokens:
type: integer
total_tokens:
type: integer
required:
- prompt_tokens
- total_tokens
required:
- object
- model
- data
- usage
x-ms-examples:
Create a embeddings.:
$ref: ./examples/embeddings.yaml
/deployments/{deployment-id}/chat/completions:
post:
summary: Creates a completion for the chat message
operationId: ChatCompletions_Create
parameters:
- in: path
name: deployment-id
required: true
schema:
type: string
description: Deployment id of the model which was deployed.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createChatCompletionRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/createChatCompletionResponse"
- $ref: "#/components/schemas/createChatCompletionStreamResponse"
headers:
apim-request-id:
description: Request ID for troubleshooting purposes
schema:
type: string
default:
description: Service unavailable
content:
application/json:
schema:
$ref: "#/components/schemas/errorResponse"
headers:
apim-request-id:
description: Request ID for troubleshooting purposes
schema:
type: string
x-ms-examples:
Create a chat completion.:
$ref: ./examples/chat_completions.yaml
Creates a completion based on Azure Search data and system-assigned managed identity.:
$ref: ./examples/chat_completions_azure_search_minimum.yaml
Creates a completion based on Azure Search image vector data.:
$ref: ./examples/chat_completions_azure_search_image_vector.yaml
Creates a completion based on Azure Search vector data, previous assistant message and user-assigned managed identity.:
$ref: ./examples/chat_completions_azure_search_advanced.yaml
Creates a completion for the provided Azure Cosmos DB.:
$ref: ./examples/chat_completions_cosmos_db.yaml
Creates a completion for the provided Mongo DB.:
$ref: ./examples/chat_completions_mongo_db.yaml
Creates a completion for the provided Elasticsearch.:
$ref: ./examples/chat_completions_elasticsearch.yaml
Creates a completion for the provided Pinecone resource.:
$ref: ./examples/chat_completions_pinecone.yaml
/deployments/{deployment-id}/audio/transcriptions:
post:
summary: Transcribes audio into the input language.
operationId: Transcriptions_Create
parameters:
- in: path
name: deployment-id
required: true
schema:
type: string
example: whisper
description: Deployment id of the whisper model.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: "#/components/schemas/createTranscriptionRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/audioResponse"
- $ref: "#/components/schemas/audioVerboseResponse"
text/plain:
schema:
type: string
description: Transcribed text in the output format (when response_format was one of text, vtt or srt).
x-ms-examples:
Create an audio transcription with json response format.:
$ref: ./examples/audio_transcription_object.yaml
Create an audio transcription with text response format.:
$ref: ./examples/audio_transcription_text.yaml
/deployments/{deployment-id}/audio/translations:
post:
summary: Transcribes and translates input audio into English text.
operationId: Translations_Create
parameters:
- in: path
name: deployment-id
required: true
schema:
type: string
example: whisper
description: Deployment id of the whisper model which was deployed.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: "#/components/schemas/createTranslationRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/audioResponse"
- $ref: "#/components/schemas/audioVerboseResponse"
text/plain:
schema:
type: string
description: Transcribed text in the output format (when response_format was one of text, vtt or srt).
x-ms-examples:
Create an audio translation with json response format.:
$ref: ./examples/audio_translation_object.yaml
Create an audio translation with text response format.:
$ref: ./examples/audio_translation_text.yaml
/deployments/{deployment-id}/audio/speech:
post:
summary: Generates audio from the input text.
operationId: Speech_Create
parameters:
- in: path
name: deployment-id
required: true
schema:
type: string
example: tts-1
description: Deployment id of the tts model which was deployed.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: "#/components/schemas/createSpeechRequest"
responses:
"200":
description: OK
content:
application/octet-stream:
schema:
type: string
format: binary
x-ms-examples:
Create an audio from text with response format mp3.:
$ref: ./examples/audio_speech.yaml
/deployments/{deployment-id}/images/generations:
post:
summary: Generates a batch of images from a text caption on a given DALLE model deployment
operationId: ImageGenerations_Create
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/imageGenerationsRequest"
parameters:
- in: path
name: deployment-id
required: true
schema:
type: string
example: dalle-deployment
description: Deployment id of the dalle model which was deployed.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: Ok
content:
application/json:
schema:
$ref: "#/components/schemas/generateImagesResponse"
default:
description: An error occurred.
content:
application/json:
schema:
$ref: "#/components/schemas/dalleErrorResponse"
x-ms-examples:
Create an image.:
$ref: ./examples/image_generation.yaml
/assistants:
get:
operationId: List_Assistants
tags:
- Assistants
summary: Returns a list of assistants.
parameters:
- name: limit
in: query
description: &pagination_limit_param_description |
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: &pagination_order_param_description |
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
schema:
type: string
default: desc
enum:
- asc
- desc
x-ms-enum:
name: ListAssistantsOrder
modelAsString: true
values:
- value: asc
description: Order results in ascending order
- value: desc
description: Order results in descending order
- name: after
in: query
description: &pagination_after_param_description |
A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
schema:
type: string
- name: before
in: query
description: &pagination_before_param_description |
A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
schema:
type: string
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/listAssistantsResponse"
x-ms-examples:
Create an image.:
$ref: ./examples/list_assistants.yaml
post:
operationId: Create_Assistant
tags:
- Assistants
summary: Create an assistant with a model and instructions.
parameters:
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createAssistantRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/assistantObject"
x-ms-examples:
Create an assistant.:
$ref: ./examples/create_assistant.yaml
/assistants/{assistant_id}:
get:
operationId: Get_Assistant
tags:
- Assistants
summary: Retrieves an assistant.
parameters:
- in: path
name: assistant_id
required: true
schema:
type: string
description: The ID of the assistant to retrieve.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/assistantObject"
x-ms-examples:
Create an assistant.:
$ref: ./examples/retrieve_assistant.yaml
post:
operationId: Modify_Assistant
tags:
- Assistant
summary: Modifies an assistant.
parameters:
- in: path
name: assistant_id
required: true
schema:
type: string
description: The ID of the assistant to modify.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/modifyAssistantRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/assistantObject"
x-ms-examples:
Create an assistant.:
$ref: ./examples/modify_assistant.yaml
delete:
operationId: Delete_Assistant
tags:
- Assistants
summary: Delete an assistant.
parameters:
- in: path
name: assistant_id
required: true
schema:
type: string
description: The ID of the assistant to delete.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/deleteAssistantResponse"
x-ms-examples:
Create an assistant.:
$ref: ./examples/delete_assistant.yaml
/threads:
post:
operationId: Create_Thread
tags:
- Assistants
summary: Create a thread.
parameters:
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createThreadRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/threadObject"
x-ms-examples:
Create a thread.:
$ref: ./examples/create_thread.yaml
/threads/{thread_id}:
get:
operationId: Get_Thread
tags:
- Assistants
summary: Retrieves a thread.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the thread to retrieve.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/threadObject"
x-ms-examples:
Create a thread.:
$ref: ./examples/retrieve_thread.yaml
post:
operationId: Modify_Thread
tags:
- Assistants
summary: Modifies a thread.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the thread to modify. Only the `metadata` can be modified.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/modifyThreadRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/threadObject"
x-ms-examples:
Modify a thread.:
$ref: ./examples/modify_thread.yaml
delete:
operationId: Delete_Thread
tags:
- Assistants
summary: Delete a thread.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the thread to delete.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/deleteThreadResponse"
x-ms-examples:
Delete a thread.:
$ref: ./examples/delete_thread.yaml
/threads/{thread_id}/messages:
get:
operationId: List_Messages
tags:
- Assistants
summary: Returns a list of messages for a given thread.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the [thread](/docs/api-reference/threads) the messages belong to.
- name: limit
in: query
description: *pagination_limit_param_description
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: |
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
schema:
type: string
default: desc
enum:
- asc
- desc
x-ms-enum:
name: ListMessagesOrder
modelAsString: true
values:
- value: asc
description: Order results in ascending order
- value: desc
description: Order results in descending order
- name: after
in: query
description: |
A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
schema:
type: string
- name: before
in: query
description: |
A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
schema:
type: string
- name: run_id
in: query
description: |
Filter messages by the run ID that generated them.
schema:
type: string
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/listMessagesResponse"
x-ms-examples:
List messages.:
$ref: ./examples/list_messages.yaml
post:
operationId: Create_Message
tags:
- Assistants
summary: Create a message.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the [thread](/docs/api-reference/threads) to create a message for.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createMessageRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/messageObject"
x-ms-examples:
Create a message.:
$ref: ./examples/create_message.yaml
/threads/{thread_id}/messages/{message_id}:
get:
operationId: Get_Message
tags:
- Assistants
summary: Retrieve a message.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the [thread](/docs/api-reference/threads) to which this message belongs.
- in: path
name: message_id
required: true
schema:
type: string
description: The ID of the message to retrieve.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/messageObject"
x-ms-examples:
Retrieve a message.:
$ref: ./examples/get_message.yaml
post:
operationId: Modify_Message
tags:
- Assistants
summary: Modifies a message.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the thread to which this message belongs.
- in: path
name: message_id
required: true
schema:
type: string
description: The ID of the message to modify.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/modifyMessageRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/messageObject"
x-ms-examples:
Modify a message.:
$ref: ./examples/modify_message.yaml
/threads/runs:
post:
operationId: Create_Thread_And_Run
tags:
- Assistants
summary: Create a thread and run it in one request.
parameters:
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createThreadAndRunRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/runObject"
x-ms-examples:
Create a thread and run it.:
$ref: ./examples/create_thread_and_run.yaml
/threads/{thread_id}/runs:
get:
operationId: List_Runs
tags:
- Assistants
summary: Returns a list of runs belonging to a thread.
parameters:
- name: thread_id
in: path
required: true
schema:
type: string
description: The ID of the thread the run belongs to.
- name: limit
in: query
description: *pagination_limit_param_description
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: *pagination_order_param_description
schema:
type: string
default: desc
enum:
- asc
- desc
x-ms-enum:
name: ListRunsOrder
modelAsString: true
values:
- value: asc
description: Order results in ascending order
- value: desc
description: Order results in descending order
- name: after
in: query
description: *pagination_after_param_description
schema:
type: string
- name: before
in: query
description: *pagination_before_param_description
schema:
type: string
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/listRunsResponse"
x-ms-examples:
List runs.:
$ref: ./examples/list_runs.yaml
post:
operationId: Create_Run
tags:
- Assistants
summary: Create a run.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the thread to run.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createRunRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/runObject"
x-ms-examples:
Create a run.:
$ref: ./examples/create_run.yaml
/threads/{thread_id}/runs/{run_id}:
get:
operationId: Get_Run
tags:
- Assistants
summary: Retrieves a run.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the [thread](/docs/api-reference/threads) that was run.
- in: path
name: run_id
required: true
schema:
type: string
description: The ID of the run to retrieve.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/runObject"
x-ms-examples:
Retrieve a run.:
$ref: ./examples/get_run.yaml
post:
operationId: Modify_Run
tags:
- Assistants
summary: Modifies a run.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the [thread](/docs/api-reference/threads) that was run.
- in: path
name: run_id
required: true
schema:
type: string
description: The ID of the run to modify.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/modifyRunRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/runObject"
x-ms-examples:
Modify a run.:
$ref: ./examples/modify_run.yaml
/threads/{thread_id}/runs/{run_id}/submit_tool_outputs:
post:
operationId: Submit_Tool_Outputs_To_Run
tags:
- Assistants
summary: |
When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the [thread](/docs/api-reference/threads) to which this run belongs.
- in: path
name: run_id
required: true
schema:
type: string
description: The ID of the run that requires the tool output submission.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/submitToolOutputsRunRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/runObject"
x-ms-examples:
Submit tool outputs to a run.:
$ref: ./examples/submit_tool_outputs_to_run.yaml
/threads/{thread_id}/runs/{run_id}/cancel:
post:
operationId: Cancel_Run
tags:
- Assistants
summary: Cancels a run that is `in_progress`.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the thread to which this run belongs.
- in: path
name: run_id
required: true
schema:
type: string
description: The ID of the run to cancel.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/runObject"
x-ms-examples:
Cancel a run.:
$ref: ./examples/cancel_run.yaml
/threads/{thread_id}/runs/{run_id}/steps:
get:
operationId: List_Run_Steps
tags:
- Assistants
summary: Returns a list of run steps belonging to a run.
parameters:
- name: thread_id
in: path
required: true
schema:
type: string
description: The ID of the thread the run and run steps belong to.
- name: run_id
in: path
required: true
schema:
type: string
description: The ID of the run the run steps belong to.
- name: limit
in: query
description: *pagination_limit_param_description
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: *pagination_order_param_description
schema:
type: string
default: desc
enum:
- asc
- desc
x-ms-enum:
name: ListRunStepsOrder
modelAsString: true
values:
- value: asc
description: Order results in ascending order
- value: desc
description: Order results in descending order
- name: after
in: query
description: *pagination_after_param_description
schema:
type: string
- name: before
in: query
description: *pagination_before_param_description
schema:
type: string
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/listRunStepsResponse"
x-ms-examples:
List run steps.:
$ref: ./examples/list_run_steps.yaml
/threads/{thread_id}/runs/{run_id}/steps/{step_id}:
get:
operationId: Get_Run_Step
tags:
- Assistants
summary: Retrieves a run step.
parameters:
- in: path
name: thread_id
required: true
schema:
type: string
description: The ID of the thread to which the run and run step belongs.
- in: path
name: run_id
required: true
schema:
type: string
description: The ID of the run to which the run step belongs.
- in: path
name: step_id
required: true
schema:
type: string
description: The ID of the run step to retrieve.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/runStepObject"
x-ms-examples:
Retrieve a run step.:
$ref: ./examples/get_run_step.yaml
/vector_stores:
get:
operationId: List_Vector_Stores
tags:
- Vector Stores
summary: Returns a list of vector stores.
parameters:
- name: limit
in: query
description: *pagination_limit_param_description
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: *pagination_order_param_description
schema:
type: string
default: desc
enum: ["asc", "desc"]
x-ms-enum:
name: ListVectorStoresOrder
modelAsString: true
values:
- value: asc
- value: desc
- name: after
in: query
description: *pagination_after_param_description
schema:
type: string
- name: before
in: query
description: *pagination_before_param_description
schema:
type: string
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/listVectorStoresResponse"
x-ms-examples:
List vector stores.:
$ref: ./examples/list_vector_stores.yaml
post:
operationId: Create_Vector_Store
tags:
- Vector Stores
summary: Create a vector store.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createVectorStoreRequest"
parameters:
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/vectorStoreObject"
x-ms-examples:
Create a vector store.:
$ref: ./examples/create_vector_store.yaml
/vector_stores/{vector_store_id}:
get:
operationId: Get_Vector_Store
tags:
- Vector Stores
summary: Retrieves a vector store.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store to retrieve.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/vectorStoreObject"
x-ms-examples:
Retrieve a vector store.:
$ref: ./examples/retrieve_vector_store.yaml
post:
operationId: Modify_Vector_Store
tags:
- Vector Stores
summary: Modifies a vector store.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store to modify.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/updateVectorStoreRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/vectorStoreObject"
x-ms-examples:
Modify a vector store.:
$ref: ./examples/modify_vector_store.yaml
delete:
operationId: Delete_Vector_Store
tags:
- Vector Stores
summary: Delete a vector store.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store to delete.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/deleteVectorStoreResponse"
x-ms-examples:
Delete a vector store.:
$ref: ./examples/delete_vector_store.yaml
/vector_stores/{vector_store_id}/files:
get:
operationId: List_Vector_Store_Files
tags:
- Vector Stores
summary: Returns a list of vector store files.
parameters:
- name: vector_store_id
in: path
description: The ID of the vector store that the files belong to.
required: true
schema:
type: string
- name: limit
in: query
description: *pagination_limit_param_description
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: *pagination_order_param_description
schema:
type: string
default: desc
enum: ["asc", "desc"]
x-ms-enum:
name: ListVectorStoreFilesOrder
modelAsString: true
values:
- value: asc
- value: desc
- name: after
in: query
description: *pagination_after_param_description
schema:
type: string
- name: before
in: query
description: *pagination_before_param_description
schema:
type: string
- name: filter
in: query
description: "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`."
schema:
type: string
enum: ["in_progress", "completed", "failed", "cancelled"]
x-ms-enum:
name: ListVectorStoreFilesFilter
modelAsString: true
values:
- value: in_progress
- value: completed
- value: failed
- value: cancelled
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/listVectorStoreFilesResponse"
x-ms-examples:
List vector store files.:
$ref: ./examples/list_vector_store_files.yaml
post:
operationId: Create_Vector_Store_File
tags:
- Vector Stores
summary: Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object).
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
example: vs_abc123
description: |
The ID of the vector store for which to create a File.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createVectorStoreFileRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/vectorStoreFileObject"
x-ms-examples:
Create a vector store file.:
$ref: ./examples/create_vector_store_file.yaml
/vector_stores/{vector_store_id}/files/{file_id}:
get:
operationId: Get_Vector_Store_File
tags:
- Vector Stores
summary: Retrieves a vector store file.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
example: vs_abc123
description: The ID of the vector store that the file belongs to.
- in: path
name: file_id
required: true
schema:
type: string
example: file-abc123
description: The ID of the file being retrieved.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/vectorStoreFileObject"
x-ms-examples:
Retrieve a vector store file.:
$ref: ./examples/retrieve_vector_store_file.yaml
delete:
operationId: Delete_Vector_Store_File
tags:
- Vector Stores
summary: Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](/docs/api-reference/files/delete) endpoint.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store that the file belongs to.
- in: path
name: file_id
required: true
schema:
type: string
description: The ID of the file to delete.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/deleteVectorStoreFileResponse"
x-ms-examples:
Delete a vector store file.:
$ref: ./examples/delete_vector_store_file.yaml
/vector_stores/{vector_store_id}/file_batches:
post:
operationId: Create_Vector_Store_File_Batch
tags:
- Vector Stores
summary: Create a vector store file batch.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
example: vs_abc123
description: |
The ID of the vector store for which to create a File Batch.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/createVectorStoreFileBatchRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/vectorStoreFileBatchObject"
x-ms-examples:
Create a vector store file batch.:
$ref: ./examples/create_vector_store_file_batch.yaml
/vector_stores/{vector_store_id}/file_batches/{batch_id}:
get:
operationId: Get_Vector_Store_File_Batch
tags:
- Vector Stores
summary: Retrieves a vector store file batch.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
example: vs_abc123
description: The ID of the vector store that the file batch belongs to.
- in: path
name: batch_id
required: true
schema:
type: string
example: vsfb_abc123
description: The ID of the file batch being retrieved.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/vectorStoreFileBatchObject"
x-ms-examples:
Retrieve a vector store file batch.:
$ref: ./examples/retrieve_vector_store_file_batch.yaml
/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel:
post:
operationId: Cancel_Vector_Store_File_Batch
tags:
- Vector Stores
summary: Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store that the file batch belongs to.
- in: path
name: batch_id
required: true
schema:
type: string
description: The ID of the file batch to cancel.
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/vectorStoreFileBatchObject"
x-ms-examples:
Cancel a vector store file batch.:
$ref: ./examples/cancel_vector_store_file_batch.yaml
/vector_stores/{vector_store_id}/file_batches/{batch_id}/files:
get:
operationId: List_Vector_Store_File_Batch_Files
tags:
- Vector Stores
summary: Returns a list of vector store files in a batch.
parameters:
- name: vector_store_id
in: path
description: The ID of the vector store that the files belong to.
required: true
schema:
type: string
- name: batch_id
in: path
description: The ID of the file batch that the files belong to.
required: true
schema:
type: string
- name: limit
in: query
description: *pagination_limit_param_description
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: *pagination_order_param_description
schema:
type: string
default: desc
enum: ["asc", "desc"]
x-ms-enum:
name: ListVectorStoreFilesOrder
modelAsString: true
values:
- value: asc
- value: desc
- name: after
in: query
description: *pagination_after_param_description
schema:
type: string
- name: before
in: query
description: *pagination_before_param_description
schema:
type: string
- name: filter
in: query
description: "Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`."
schema:
type: string
enum: ["in_progress", "completed", "failed", "cancelled"]
x-ms-enum:
name: ListVectorStoreFilesFilter
modelAsString: true
values:
- value: in_progress
- value: completed
- value: failed
- value: cancelled
- in: query
name: api-version
required: true
schema:
type: string
example: 2024-09-01-preview
description: api version
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/listVectorStoreFilesResponse"
x-ms-examples:
List vector store files in a batch.:
$ref: ./examples/list_vector_store_file_batch.yaml
components:
schemas:
errorResponse:
type: object
properties:
error:
$ref: "#/components/schemas/error"
errorBase:
type: object
properties:
code:
type: string
message:
type: string
error:
type: object
allOf:
- $ref: "#/components/schemas/errorBase"
properties:
param:
type: string
type:
type: string
inner_error:
$ref: "#/components/schemas/innerError"
innerError:
description: Inner error with additional details.
type: object
properties:
code:
$ref: "#/components/schemas/innerErrorCode"
content_filter_results:
$ref: "#/components/schemas/contentFilterPromptResults"
innerErrorCode:
description: Error codes for the inner error object.
enum:
- ResponsibleAIPolicyViolation
type: string
x-ms-enum:
name: InnerErrorCode
modelAsString: true
values:
- value: ResponsibleAIPolicyViolation
description: The prompt violated one of more content filter rules.
dalleErrorResponse:
type: object
properties:
error:
$ref: "#/components/schemas/dalleError"
dalleError:
type: object
allOf:
- $ref: "#/components/schemas/errorBase"
properties:
param:
type: string
type:
type: string
inner_error:
$ref: "#/components/schemas/dalleInnerError"
dalleInnerError:
description: Inner error with additional details.
type: object
properties:
code:
$ref: "#/components/schemas/innerErrorCode"
content_filter_results:
$ref: "#/components/schemas/dalleFilterResults"
revised_prompt:
type: string
description: The prompt that was used to generate the image, if there was any revision to the prompt.
contentFilterResultBase:
type: object
properties:
filtered:
type: boolean
required:
- filtered
contentFilterSeverityResult:
type: object
allOf:
- $ref: "#/components/schemas/contentFilterResultBase"
- properties:
severity:
type: string
enum:
- safe
- low
- medium
- high
x-ms-enum:
name: ContentFilterSeverity
modelAsString: true
values:
- value: safe
description: General content or related content in generic or non-harmful contexts.
- value: low
description: Harmful content at a low intensity and risk level.
- value: medium
description: Harmful content at a medium intensity and risk level.
- value: high
description: Harmful content at a high intensity and risk level.
required:
- severity
- filtered
contentFilterDetectedResult:
type: object
allOf:
- $ref: "#/components/schemas/contentFilterResultBase"
- properties:
detected:
type: boolean
required:
- detected
- filtered
contentFilterDetectedWithCitationResult:
type: object
allOf:
- $ref: "#/components/schemas/contentFilterDetectedResult"
- properties:
citation:
type: object
properties:
URL:
type: string
license:
type: string
required:
- detected
- filtered
contentFilterIdResult:
type: object
allOf:
- $ref: "#/components/schemas/contentFilterResultBase"
- properties:
id:
type: string
required:
- id
- filtered
contentFilterResultsBase:
type: object
description: Information about the content filtering results.
properties:
sexual:
$ref: "#/components/schemas/contentFilterSeverityResult"
violence:
$ref: "#/components/schemas/contentFilterSeverityResult"
hate:
$ref: "#/components/schemas/contentFilterSeverityResult"
self_harm:
$ref: "#/components/schemas/contentFilterSeverityResult"
profanity:
$ref: "#/components/schemas/contentFilterDetectedResult"
custom_blocklists:
$ref: "#/components/schemas/contentFilterDetailedResults"
error:
$ref: "#/components/schemas/errorBase"
contentFilterPromptResults:
type: object
description: Information about the content filtering category (hate, sexual, violence, self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that determines the intensity and risk level of harmful content) and if it has been filtered or not. Information about jailbreak content and profanity, if it has been detected, and if it has been filtered or not. And information about customer block list, if it has been filtered and its id.
allOf:
- $ref: "#/components/schemas/contentFilterResultsBase"
- properties:
jailbreak:
$ref: "#/components/schemas/contentFilterDetectedResult"
indirect_attack:
$ref: "#/components/schemas/contentFilterDetectedResult"
contentFilterChoiceResults:
type: object
description: Information about the content filtering category (hate, sexual, violence, self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that determines the intensity and risk level of harmful content) and if it has been filtered or not. Information about third party text and profanity, if it has been detected, and if it has been filtered or not. And information about customer block list, if it has been filtered and its id.
allOf:
- $ref: "#/components/schemas/contentFilterResultsBase"
- properties:
protected_material_text:
$ref: "#/components/schemas/contentFilterDetectedResult"
- properties:
protected_material_code:
$ref: "#/components/schemas/contentFilterDetectedWithCitationResult"
contentFilterDetailedResults:
type: object
description: Content filtering results with a detail of content filter ids for the filtered segments.
allOf:
- $ref: "#/components/schemas/contentFilterResultBase"
- properties:
details:
items:
$ref: "#/components/schemas/contentFilterIdResult"
type: array
required:
- filtered
promptFilterResult:
type: object
description: Content filtering results for a single prompt in the request.
properties:
prompt_index:
type: integer
content_filter_results:
$ref: "#/components/schemas/contentFilterPromptResults"
promptFilterResults:
type: array
description: Content filtering results for zero or more prompts in the request. In a streaming request, results for different prompts may arrive at different times or in different orders.
items:
$ref: "#/components/schemas/promptFilterResult"
dalleContentFilterResults:
type: object
description: Information about the content filtering results.
properties:
sexual:
$ref: "#/components/schemas/contentFilterSeverityResult"
violence:
$ref: "#/components/schemas/contentFilterSeverityResult"
hate:
$ref: "#/components/schemas/contentFilterSeverityResult"
self_harm:
$ref: "#/components/schemas/contentFilterSeverityResult"
dalleFilterResults:
type: object
description: Information about the content filtering category (hate, sexual, violence, self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that determines the intensity and risk level of harmful content) and if it has been filtered or not. Information about jailbreak content and profanity, if it has been detected, and if it has been filtered or not. And information about customer block list, if it has been filtered and its id.
allOf:
- $ref: "#/components/schemas/dalleContentFilterResults"
- properties:
profanity:
$ref: "#/components/schemas/contentFilterDetectedResult"
jailbreak:
$ref: "#/components/schemas/contentFilterDetectedResult"
custom_blocklists:
$ref: "#/components/schemas/contentFilterDetailedResults"
chatCompletionsRequestCommon:
type: object
properties:
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.
type: number
minimum: 0
maximum: 2
default: 1
example: 1
nullable: true
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.
type: number
minimum: 0
maximum: 1
default: 1
example: 1
nullable: true
stream:
description: "If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a `data: [DONE]` message."
type: boolean
nullable: true
default: false
stop:
description: Up to 4 sequences where the API will stop generating further tokens.
oneOf:
- type: string
nullable: true
- type: array
items:
type: string
nullable: false
minItems: 1
maxItems: 4
description: Array minimum size of 1 and maximum of 4
default: null
max_tokens:
description: |
The maximum number of tokens allowed for the generated answer. By default, the number of tokens the model can return will be (4096 - prompt tokens).
This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with o1 series models.
type: integer
default: 4096
max_completion_tokens:
description: |
An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
type: integer
nullable: true
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.
type: number
default: 0
minimum: -2
maximum: 2
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.
type: number
default: 0
minimum: -2
maximum: 2
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 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.
type: object
nullable: true
user:
description: A unique identifier representing your end-user, which can help Azure OpenAI to monitor and detect abuse.
type: string
example: user-1234
nullable: false
createCompletionRequest:
type: object
properties:
prompt:
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|>"
nullable: true
oneOf:
- type: string
default: ""
example: "This is a test."
- type: array
items:
type: string
default: ""
example: "This is a test."
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.
logit_bias: &completions_logit_bias
type: object
x-oaiTypeLabel: map
default: null
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](https://platform.openai.com/tokenizer?view=bpe) 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 <|endoftext|> 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 output 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
default: 16
example: 16
nullable: true
description: &completions_max_tokens_description |
The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated 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.
n:
type: integer
minimum: 1
maximum: 128
default: 1
example: 1
nullable: true
description: &completions_completions_description |
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`.
presence_penalty:
type: number
default: 0
minimum: -2
maximum: 2
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.
seed: &completions_seed_param
type: integer
minimum: -9223372036854775808
maximum: 9223372036854775807
nullable: true
description: |
If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.
Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
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.
default: null
nullable: true
oneOf:
- type: string
default: <|endoftext|>
example: "\n"
nullable: true
- type: array
minItems: 1
maxItems: 4
items:
type: string
example: '["\n"]'
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
suffix:
description: |
The suffix that comes after a completion of inserted text.
This parameter is only supported for `gpt-3.5-turbo-instruct`.
default: null
nullable: true
type: string
example: "test."
stream_options:
$ref: "#/components/schemas/chatCompletionStreamOptions"
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.
user: &end_user_param_configuration
type: string
example: user-1234
description: |
A unique identifier representing your end-user, which can help to monitor and detect abuse.
required:
- prompt
createCompletionResponse:
type: object
description: |
Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).
properties:
id:
type: string
description: A unique identifier for the completion.
choices:
type: array
description: The list of completion choices the model generated for the input prompt.
items:
type: object
required:
- finish_reason
- index
- logprobs
- text
properties:
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:
text_offset:
type: array
items:
type: integer
token_logprobs:
type: array
items:
type: number
tokens:
type: array
items:
type: string
top_logprobs:
type: array
items:
type: object
additionalProperties:
type: number
text:
type: string
content_filter_results:
$ref: "#/components/schemas/contentFilterChoiceResults"
created:
type: integer
description: The Unix timestamp (in seconds) of when the completion was created.
model:
type: string
description: The model used for completion.
prompt_filter_results:
$ref: "#/components/schemas/promptFilterResults"
system_fingerprint:
type: string
description: |
This fingerprint represents the backend configuration that the model runs with.
Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
object:
type: string
description: The object type, which is always "text_completion"
enum: [text_completion]
usage:
$ref: "#/components/schemas/completionUsage"
required:
- id
- object
- created
- model
- choices
createChatCompletionRequest:
type: object
allOf:
- $ref: "#/components/schemas/chatCompletionsRequestCommon"
- properties:
messages:
description: A list of messages comprising the conversation so far. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb).
type: array
minItems: 1
items:
$ref: "#/components/schemas/chatCompletionRequestMessage"
data_sources:
type: array
description: |2-
The configuration entries for Azure OpenAI chat extensions that use them.
This additional specification is only compatible with Azure OpenAI.
items:
$ref: "#/components/schemas/azureChatExtensionConfiguration"
frequency_penalty:
type: number
default: 0
minimum: -2
maximum: 2
nullable: true
description: *completions_frequency_penalty_description
logit_bias:
type: object
default: null
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.
logprobs:
description: Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`.
type: boolean
default: false
nullable: true
top_logprobs:
description: An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.
type: integer
minimum: 0
maximum: 20
nullable: true
max_tokens:
description: |
The maximum number of [tokens](/tokenizer) that can be generated 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.
type: integer
nullable: true
n:
type: integer
minimum: 1
maximum: 128
default: 1
example: 1
nullable: true
description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.
parallel_tool_calls:
$ref: "#/components/schemas/ParallelToolCalls"
presence_penalty:
type: number
default: 0
minimum: -2
maximum: 2
nullable: true
description: *completions_presence_penalty_description
response_format:
description: |
An object specifying the format that the model must output. Compatible with [GPT-4o](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-models), [GPT-4o mini](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-models), [GPT-4 Turbo](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-models) and all [GPT-3.5](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-35) Turbo models newer than `gpt-3.5-turbo-1106`.
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which guarantees the model will match your supplied JSON schema.
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON.
**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.
oneOf:
- $ref: "#/components/schemas/ResponseFormatText"
- $ref: "#/components/schemas/ResponseFormatJsonObject"
- $ref: "#/components/schemas/ResponseFormatJsonSchema"
x-oaiExpandable: true
seed:
type: integer
minimum: -9223372036854775808
maximum: 9223372036854775807
nullable: true
description: |
This feature is in Beta.
If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.
Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
stop:
description: |
Up to 4 sequences where the API will stop generating further tokens.
default: null
oneOf:
- type: string
nullable: true
- type: array
minItems: 1
maxItems: 4
items:
type: string
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
default: false
stream_options:
$ref: "#/components/schemas/chatCompletionStreamOptions"
temperature:
type: number
minimum: 0
maximum: 2
default: 1
example: 1
nullable: true
description: *completions_temperature_description
top_p:
type: number
minimum: 0
maximum: 1
default: 1
example: 1
nullable: true
description: *completions_top_p_description
tools:
type: array
description: >
A list of tools the model may call. Currently, only functions are supported as a tool.
Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
items:
$ref: "#/components/schemas/chatCompletionTool"
tool_choice:
$ref: "#/components/schemas/chatCompletionToolChoiceOption"
function_call:
deprecated: true
description: |
Deprecated in favor of `tool_choice`.
Controls which (if any) function is called by the model.
`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.
oneOf:
- type: string
description: >
`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.
enum: [none, auto]
- $ref: "#/components/schemas/chatCompletionFunctionCallOption"
x-oaiExpandable: true
functions:
deprecated: true
description: |
Deprecated in favor of `tools`.
A list of functions the model may generate JSON inputs for.
type: array
minItems: 1
maxItems: 128
items:
$ref: "#/components/schemas/chatCompletionFunctions"
user: *end_user_param_configuration
required:
- messages
chatCompletionFunctions:
type: object
deprecated: true
properties:
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/FunctionParameters"
required:
- name
chatCompletionFunctionCallOption:
type: object
description: >
Specifying a particular function via `{"name": "my_function"}` forces the model to call that function.
properties:
name:
type: string
description: The name of the function to call.
required:
- name
chatCompletionFunctionParameters:
type: object
description: The parameters the functions accepts, described as a JSON Schema object. See the [guide/](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
additionalProperties: true
chatCompletionRequestMessage:
oneOf:
- $ref: "#/components/schemas/chatCompletionRequestSystemMessage"
- $ref: "#/components/schemas/chatCompletionRequestUserMessage"
- $ref: "#/components/schemas/chatCompletionRequestAssistantMessage"
- $ref: "#/components/schemas/chatCompletionRequestToolMessage"
- $ref: "#/components/schemas/chatCompletionRequestFunctionMessage"
chatCompletionRequestSystemMessage:
type: object
title: System message
properties:
content:
description: The contents of the system message.
oneOf:
- type: string
description: The contents of the system message.
title: Text content
- type: array
description: An array of content parts with a defined type. For system messages, only type `text` is supported.
title: Array of content parts
items:
$ref: "#/components/schemas/chatCompletionRequestSystemMessageContentPart"
minItems: 1
role:
type: string
enum: ["system"]
description: The role of the messages author, in this case `system`.
name:
type: string
description: An optional name for the participant. Provides the model information to differentiate between participants of the same role.
required:
- content
- role
chatCompletionRequestUserMessage:
type: object
title: User message
properties:
content:
description: |
The contents of the user message.
oneOf:
- type: string
description: The text contents of the message.
title: Text content
- type: array
description: An array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Image input is only supported when using the `gpt-4o` model.
title: Array of content parts
items:
$ref: "#/components/schemas/chatCompletionRequestUserMessageContentPart"
minItems: 1
x-oaiExpandable: true
role:
type: string
enum: ["user"]
description: The role of the messages author, in this case `user`.
name:
type: string
description: An optional name for the participant. Provides the model information to differentiate between participants of the same role.
required:
- content
- role
chatCompletionRequestAssistantMessage:
type: object
title: Assistant message
properties:
content:
nullable: true
oneOf:
- type: string
description: The contents of the assistant message.
title: Text content
- type: array
description: An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`.
title: Array of content parts
items:
$ref: "#/components/schemas/chatCompletionRequestAssistantMessageContentPart"
minItems: 1
description: |
The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.
refusal:
nullable: true
type: string
description: The refusal message by the assistant.
role:
type: string
enum: ["assistant"]
description: The role of the messages author, in this case `assistant`.
name:
type: string
description: An optional name for the participant. Provides the model information to differentiate between participants of the same role.
tool_calls:
$ref: "#/components/schemas/chatCompletionMessageToolCalls"
function_call:
type: object
deprecated: true
description: "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."
nullable: true
properties:
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:
- arguments
- name
required:
- role
chatCompletionRequestToolMessage:
type: object
title: Tool message
properties:
role:
type: string
enum: ["tool"]
description: The role of the messages author, in this case `tool`.
content:
oneOf:
- type: string
description: The contents of the tool message.
title: Text content
- type: array
description: An array of content parts with a defined type. For tool messages, only type `text` is supported.
title: Array of content parts
items:
$ref: "#/components/schemas/chatCompletionRequestToolMessageContentPart"
minItems: 1
description: The contents of the tool message.
tool_call_id:
type: string
description: Tool call that this message is responding to.
required:
- role
- content
- tool_call_id
chatCompletionRequestFunctionMessage:
type: object
title: Function message
deprecated: true
properties:
role:
type: string
enum: ["function"]
description: The role of the messages author, in this case `function`.
content:
nullable: true
type: string
description: The contents of the function message.
name:
type: string
description: The name of the function to call.
required:
- role
- content
- name
chatCompletionRequestSystemMessageContentPart:
oneOf:
- $ref: "#/components/schemas/chatCompletionRequestMessageContentPartText"
chatCompletionRequestUserMessageContentPart:
oneOf:
- $ref: "#/components/schemas/chatCompletionRequestMessageContentPartText"
- $ref: "#/components/schemas/chatCompletionRequestMessageContentPartImage"
chatCompletionRequestAssistantMessageContentPart:
oneOf:
- $ref: "#/components/schemas/chatCompletionRequestMessageContentPartText"
- $ref: "#/components/schemas/chatCompletionRequestMessageContentPartRefusal"
chatCompletionRequestToolMessageContentPart:
oneOf:
- $ref: "#/components/schemas/chatCompletionRequestMessageContentPartText"
chatCompletionRequestMessageContentPartText:
type: object
title: Text content part
properties:
type:
type: string
enum: ["text"]
description: The type of the content part.
text:
type: string
description: The text content.
required:
- type
- text
chatCompletionRequestMessageContentPartImage:
type: object
title: Image content part
properties:
type:
type: string
enum: ["image_url"]
description: The type of the content part.
image_url:
type: object
properties:
url:
type: string
description: Either a URL of the image or the base64 encoded image data.
format: uri
detail:
type: string
description: Specifies the detail level of the image. Learn more in the [Vision guide](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/gpt-with-vision?tabs=rest%2Csystem-assigned%2Cresource#detail-parameter-settings-in-image-processing-low-high-auto).
enum: ["auto", "low", "high"]
default: "auto"
required:
- url
required:
- type
- image_url
chatCompletionRequestMessageContentPartRefusal:
type: object
title: Refusal content part
properties:
type:
type: string
enum: ["refusal"]
description: The type of the content part.
refusal:
type: string
description: The refusal message generated by the model.
required:
- type
- refusal
azureChatExtensionConfiguration:
required:
- type
type: object
properties:
type:
$ref: "#/components/schemas/azureChatExtensionType"
description: |2-
A representation of configuration data for a single Azure OpenAI chat extension. This will be used by a chat
completions request that should use Azure OpenAI chat extensions to augment the response behavior.
The use of this configuration is compatible only with Azure OpenAI.
discriminator:
propertyName: type
mapping:
azure_search: "#/components/schemas/azureSearchChatExtensionConfiguration"
azure_cosmos_db: "#/components/schemas/azureCosmosDBChatExtensionConfiguration"
elasticsearch: "#/components/schemas/elasticsearchChatExtensionConfiguration"
mongo_db: "#/components/schemas/mongoDBChatExtensionConfiguration"
pinecone: "#/components/schemas/pineconeChatExtensionConfiguration"
azureChatExtensionType:
type: string
description: |2-
A representation of configuration data for a single Azure OpenAI chat extension. This will be used by a chat
completions request that should use Azure OpenAI chat extensions to augment the response behavior.
The use of this configuration is compatible only with Azure OpenAI.
enum:
- azure_search
- azure_cosmos_db
- elasticsearch
- mongo_db
- pinecone
x-ms-enum:
name: AzureChatExtensionType
modelAsString: true
values:
- name: azureSearch
value: azure_search
description: Represents the use of Azure Search as an Azure OpenAI chat extension.
- name: azureCosmosDB
value: azure_cosmos_db
description: Represents the use of Azure Cosmos DB as an Azure OpenAI chat extension.
- name: elasticsearch
value: elasticsearch
description: Represents the use of Elasticsearch® index as an Azure OpenAI chat extension.
- name: mongoDB
value: mongo_db
description: Represents the use of Mongo DB as an Azure OpenAI chat extension.
- name: pinecone
value: pinecone
description: Represents the use of Pinecone index as an Azure OpenAI chat extension.
azureSearchChatExtensionConfiguration:
required:
- parameters
description: |-
A specific representation of configurable options for Azure Search when using it as an Azure OpenAI chat
extension.
allOf:
- $ref: "#/components/schemas/azureChatExtensionConfiguration"
- properties:
parameters:
$ref: "#/components/schemas/azureSearchChatExtensionParameters"
x-ms-discriminator-value: azure_search
azureSearchChatExtensionParameters:
required:
- authentication
- endpoint
- index_name
type: object
properties:
authentication:
oneOf:
- $ref: "#/components/schemas/onYourDataApiKeyAuthenticationOptions"
- $ref: "#/components/schemas/onYourDataSystemAssignedManagedIdentityAuthenticationOptions"
- $ref: "#/components/schemas/onYourDataUserAssignedManagedIdentityAuthenticationOptions"
- $ref: "#/components/schemas/onYourDataAccessTokenAuthenticationOptions"
top_n_documents:
type: integer
description: The configured top number of documents to feature for the configured query.
format: int32
max_search_queries:
type: integer
description: The max number of rewritten queries should be send to search provider for one user message. If not specified, the system will decide the number of queries to send.
format: int32
allow_partial_result:
type: boolean
default: false
description: If specified as true, the system will allow partial search results to be used and the request fails if all the queries fail. If not specified, or specified as false, the request will fail if any search query fails.
in_scope:
type: boolean
description: Whether queries should be restricted to use of indexed data.
strictness:
maximum: 5
minimum: 1
type: integer
description: The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but lower recall of the answer.
format: int32
endpoint:
type: string
description: The absolute endpoint path for the Azure Search resource to use.
format: uri
index_name:
type: string
description: The name of the index to use as available in the referenced Azure Search resource.
fields_mapping:
$ref: "#/components/schemas/azureSearchIndexFieldMappingOptions"
query_type:
$ref: "#/components/schemas/azureSearchQueryType"
semantic_configuration:
type: string
description: The additional semantic configuration for the query.
filter:
type: string
description: Search filter.
embedding_dependency:
oneOf:
- $ref: "#/components/schemas/onYourDataEndpointVectorizationSource"
- $ref: "#/components/schemas/onYourDataDeploymentNameVectorizationSource"
- $ref: "#/components/schemas/onYourDataIntegratedVectorizationSource"
include_contexts:
type: array
description: The included properties of the output context. If not specified, the default value is `citations` and `intent`.
items:
$ref: "#/components/schemas/onYourDataContextProperty"
description: Parameters for Azure Search when used as an Azure OpenAI chat extension.
azureSearchIndexFieldMappingOptions:
type: object
properties:
title_field:
type: string
description: The name of the index field to use as a title.
url_field:
type: string
description: The name of the index field to use as a URL.
filepath_field:
type: string
description: The name of the index field to use as a filepath.
content_fields:
type: array
description: The names of index fields that should be treated as content.
items:
type: string
content_fields_separator:
type: string
description: The separator pattern that content fields should use.
vector_fields:
type: array
description: The names of fields that represent vector data.
items:
type: string
image_vector_fields:
type: array
description: The names of fields that represent image vector data.
items:
type: string
description: Optional settings to control how fields are processed when using a configured Azure Search resource.
azureSearchQueryType:
type: string
description: The type of Azure Search retrieval query that should be executed when using it as an Azure OpenAI chat extension.
enum:
- simple
- semantic
- vector
- vector_simple_hybrid
- vector_semantic_hybrid
x-ms-enum:
name: AzureSearchQueryType
modelAsString: true
values:
- name: simple
value: simple
description: Represents the default, simple query parser.
- name: semantic
value: semantic
description: Represents the semantic query parser for advanced semantic modeling.
- name: vector
value: vector
description: Represents vector search over computed data.
- name: vectorSimpleHybrid
value: vector_simple_hybrid
description: Represents a combination of the simple query strategy with vector data.
- name: vectorSemanticHybrid
value: vector_semantic_hybrid
description: Represents a combination of semantic search and vector data querying.
azureCosmosDBChatExtensionConfiguration:
required:
- parameters
description: |-
A specific representation of configurable options for Azure Cosmos DB when using it as an Azure OpenAI chat
extension.
allOf:
- $ref: "#/components/schemas/azureChatExtensionConfiguration"
- properties:
parameters:
$ref: "#/components/schemas/azureCosmosDBChatExtensionParameters"
x-ms-discriminator-value: azure_cosmos_db
azureCosmosDBChatExtensionParameters:
required:
- authentication
- container_name
- database_name
- embedding_dependency
- fields_mapping
- index_name
type: object
properties:
authentication:
$ref: "#/components/schemas/onYourDataConnectionStringAuthenticationOptions"
top_n_documents:
type: integer
description: The configured top number of documents to feature for the configured query.
format: int32
max_search_queries:
type: integer
description: The max number of rewritten queries should be send to search provider for one user message. If not specified, the system will decide the number of queries to send.
format: int32
allow_partial_result:
type: boolean
default: false
description: If specified as true, the system will allow partial search results to be used and the request fails if all the queries fail. If not specified, or specified as false, the request will fail if any search query fails.
in_scope:
type: boolean
description: Whether queries should be restricted to use of indexed data.
strictness:
maximum: 5
minimum: 1
type: integer
description: The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but lower recall of the answer.
format: int32
database_name:
type: string
description: The MongoDB vCore database name to use with Azure Cosmos DB.
container_name:
type: string
description: The name of the Azure Cosmos DB resource container.
index_name:
type: string
description: The MongoDB vCore index name to use with Azure Cosmos DB.
fields_mapping:
$ref: "#/components/schemas/azureCosmosDBFieldMappingOptions"
embedding_dependency:
oneOf:
- $ref: "#/components/schemas/onYourDataEndpointVectorizationSource"
- $ref: "#/components/schemas/onYourDataDeploymentNameVectorizationSource"
include_contexts:
type: array
description: The included properties of the output context. If not specified, the default value is `citations` and `intent`.
items:
$ref: "#/components/schemas/onYourDataContextProperty"
description: |-
Parameters to use when configuring Azure OpenAI On Your Data chat extensions when using Azure Cosmos DB for
MongoDB vCore.
azureCosmosDBFieldMappingOptions:
required:
- content_fields
- vector_fields
type: object
properties:
title_field:
type: string
description: The name of the index field to use as a title.
url_field:
type: string
description: The name of the index field to use as a URL.
filepath_field:
type: string
description: The name of the index field to use as a filepath.
content_fields:
type: array
description: The names of index fields that should be treated as content.
items:
type: string
content_fields_separator:
type: string
description: The separator pattern that content fields should use.
vector_fields:
type: array
description: The names of fields that represent vector data.
items:
type: string
description: Optional settings to control how fields are processed when using a configured Azure Cosmos DB resource.
elasticsearchChatExtensionConfiguration:
required:
- parameters
description: |-
A specific representation of configurable options for Elasticsearch when using it as an Azure OpenAI chat
extension.
allOf:
- $ref: "#/components/schemas/azureChatExtensionConfiguration"
- properties:
parameters:
$ref: "#/components/schemas/elasticsearchChatExtensionParameters"
x-ms-discriminator-value: elasticsearch
elasticsearchChatExtensionParameters:
required:
- authentication
- endpoint
- index_name
type: object
properties:
authentication:
oneOf:
- $ref: "#/components/schemas/onYourDataKeyAndKeyIdAuthenticationOptions"
- $ref: "#/components/schemas/onYourDataEncodedApiKeyAuthenticationOptions"
top_n_documents:
type: integer
description: The configured top number of documents to feature for the configured query.
format: int32
max_search_queries:
type: integer
description: The max number of rewritten queries should be send to search provider for one user message. If not specified, the system will decide the number of queries to send.
format: int32
allow_partial_result:
type: boolean
default: false
description: If specified as true, the system will allow partial search results to be used and the request fails if all the queries fail. If not specified, or specified as false, the request will fail if any search query fails.
in_scope:
type: boolean
description: Whether queries should be restricted to use of indexed data.
strictness:
maximum: 5
minimum: 1
type: integer
description: The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but lower recall of the answer.
format: int32
endpoint:
type: string
description: The endpoint of Elasticsearch®.
format: uri
index_name:
type: string
description: The index name of Elasticsearch®.
fields_mapping:
$ref: "#/components/schemas/elasticsearchIndexFieldMappingOptions"
query_type:
$ref: "#/components/schemas/elasticsearchQueryType"
embedding_dependency:
oneOf:
- $ref: "#/components/schemas/onYourDataEndpointVectorizationSource"
- $ref: "#/components/schemas/onYourDataDeploymentNameVectorizationSource"
- $ref: "#/components/schemas/onYourDataModelIdVectorizationSource"
include_contexts:
type: array
description: The included properties of the output context. If not specified, the default value is `citations` and `intent`.
items:
$ref: "#/components/schemas/onYourDataContextProperty"
description: "Parameters to use when configuring Elasticsearch® as an Azure OpenAI chat extension. "
elasticsearchIndexFieldMappingOptions:
type: object
properties:
title_field:
type: string
description: The name of the index field to use as a title.
url_field:
type: string
description: The name of the index field to use as a URL.
filepath_field:
type: string
description: The name of the index field to use as a filepath.
content_fields:
type: array
description: The names of index fields that should be treated as content.
items:
type: string
content_fields_separator:
type: string
description: The separator pattern that content fields should use.
vector_fields:
type: array
description: The names of fields that represent vector data.
items:
type: string
description: Optional settings to control how fields are processed when using a configured Elasticsearch® resource.
elasticsearchQueryType:
type: string
description: The type of Elasticsearch® retrieval query that should be executed when using it as an Azure OpenAI chat extension.
enum:
- simple
- vector
x-ms-enum:
name: ElasticsearchQueryType
modelAsString: true
values:
- name: simple
value: simple
description: Represents the default, simple query parser.
- name: vector
value: vector
description: Represents vector search over computed data.
mongoDBChatExtensionConfiguration:
required:
- parameters
description: |-
A specific representation of configurable options for Mongo DB when using it as an Azure OpenAI chat
extension.
allOf:
- $ref: "#/components/schemas/azureChatExtensionConfiguration"
- properties:
parameters:
$ref: "#/components/schemas/mongoDBChatExtensionParameters"
x-ms-discriminator-value: mongo_db
mongoDBChatExtensionParameters:
required:
- authentication
- app_name
- collection_name
- database_name
- endpoint
- embedding_dependency
- fields_mapping
- index_name
type: object
properties:
authentication:
$ref: "#/components/schemas/onYourDataUsernameAndPasswordAuthenticationOptions"
top_n_documents:
type: integer
description: The configured top number of documents to feature for the configured query.
format: int32
max_search_queries:
type: integer
description: The max number of rewritten queries should be send to search provider for one user message. If not specified, the system will decide the number of queries to send.
format: int32
allow_partial_result:
type: boolean
default: false
description: If specified as true, the system will allow partial search results to be used and the request fails if all the queries fail. If not specified, or specified as false, the request will fail if any search query fails.
in_scope:
type: boolean
description: Whether queries should be restricted to use of indexed data.
strictness:
maximum: 5
minimum: 1
type: integer
description: The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but lower recall of the answer.
format: int32
endpoint:
type: string
description: The name of the Mongo DB cluster endpoint.
database_name:
type: string
description: The name of the Mongo DB database.
collection_name:
type: string
description: The name of the Mongo DB Collection.
app_name:
type: string
description: The name of the Mongo DB Application.
index_name:
type: string
description: The The name of the Mongo DB index.
fields_mapping:
$ref: "#/components/schemas/mongoDBFieldMappingOptions"
embedding_dependency:
oneOf:
- $ref: "#/components/schemas/onYourDataEndpointVectorizationSource"
- $ref: "#/components/schemas/onYourDataDeploymentNameVectorizationSource"
include_contexts:
type: array
description: The included properties of the output context. If not specified, the default value is `citations` and `intent`.
items:
$ref: "#/components/schemas/onYourDataContextProperty"
description: |-
Parameters to use when configuring Azure OpenAI On Your Data chat extensions when using Mongo DB.
mongoDBFieldMappingOptions:
required:
- content_fields
- vector_fields
type: object
properties:
title_field:
type: string
description: The name of the index field to use as a title.
url_field:
type: string
description: The name of the index field to use as a URL.
filepath_field:
type: string
description: The name of the index field to use as a filepath.
content_fields:
type: array
description: The names of index fields that should be treated as content.
items:
type: string
content_fields_separator:
type: string
description: The separator pattern that content fields should use.
vector_fields:
type: array
description: The names of fields that represent vector data.
items:
type: string
description: Optional settings to control how fields are processed when using a configured Mongo DB resource.
pineconeChatExtensionConfiguration:
required:
- parameters
description: |-
A specific representation of configurable options for Pinecone when using it as an Azure OpenAI chat
extension.
allOf:
- $ref: "#/components/schemas/azureChatExtensionConfiguration"
- properties:
parameters:
$ref: "#/components/schemas/pineconeChatExtensionParameters"
x-ms-discriminator-value: pinecone
pineconeChatExtensionParameters:
required:
- authentication
- embedding_dependency
- environment
- fields_mapping
- index_name
type: object
properties:
authentication:
$ref: "#/components/schemas/onYourDataApiKeyAuthenticationOptions"
top_n_documents:
type: integer
description: The configured top number of documents to feature for the configured query.
format: int32
max_search_queries:
type: integer
description: The max number of rewritten queries should be send to search provider for one user message. If not specified, the system will decide the number of queries to send.
format: int32
allow_partial_result:
type: boolean
default: false
description: If specified as true, the system will allow partial search results to be used and the request fails if all the queries fail. If not specified, or specified as false, the request will fail if any search query fails.
in_scope:
type: boolean
description: Whether queries should be restricted to use of indexed data.
strictness:
maximum: 5
minimum: 1
type: integer
description: The configured strictness of the search relevance filtering. The higher of strictness, the higher of the precision but lower recall of the answer.
format: int32
environment:
type: string
description: The environment name of Pinecone.
index_name:
type: string
description: The name of the Pinecone database index.
fields_mapping:
$ref: "#/components/schemas/pineconeFieldMappingOptions"
embedding_dependency:
$ref: "#/components/schemas/onYourDataDeploymentNameVectorizationSource"
include_contexts:
type: array
description: The included properties of the output context. If not specified, the default value is `citations` and `intent`.
items:
$ref: "#/components/schemas/onYourDataContextProperty"
description: Parameters for configuring Azure OpenAI Pinecone chat extensions.
pineconeFieldMappingOptions:
required:
- content_fields
type: object
properties:
title_field:
type: string
description: The name of the index field to use as a title.
url_field:
type: string
description: The name of the index field to use as a URL.
filepath_field:
type: string
description: The name of the index field to use as a filepath.
content_fields:
type: array
description: The names of index fields that should be treated as content.
items:
type: string
content_fields_separator:
type: string
description: The separator pattern that content fields should use.
description: Optional settings to control how fields are processed when using a configured Pinecone resource.
onYourDataAuthenticationOptions:
required:
- type
type: object
properties:
type:
$ref: "#/components/schemas/onYourDataAuthenticationType"
description: The authentication options for Azure OpenAI On Your Data.
discriminator:
propertyName: type
mapping:
api_key: "#/components/schemas/onYourDataApiKeyAuthenticationOptions"
connection_string: "#/components/schemas/onYourDataConnectionStringAuthenticationOptions"
key_and_key_id: "#/components/schemas/onYourDataKeyAndKeyIdAuthenticationOptions"
encoded_api_key: "#/components/schemas/onYourDataEncodedApiKeyAuthenticationOptions"
access_token: "#/components/schemas/onYourDataAccessTokenAuthenticationOptions"
system_assigned_managed_identity: "#/components/schemas/onYourDataSystemAssignedManagedIdentityAuthenticationOptions"
user_assigned_managed_identity: "#/components/schemas/onYourDataUserAssignedManagedIdentityAuthenticationOptions"
username_and_password: "#/components/schemas/onYourDataUsernameAndPasswordAuthenticationOptions"
onYourDataContextProperty:
type: string
description: The context property.
enum:
- citations
- intent
- all_retrieved_documents
x-ms-enum:
name: OnYourDataContextProperty
modelAsString: true
values:
- name: citations
value: citations
description: The `citations` property.
- name: intent
value: intent
description: The `intent` property.
- name: allRetrievedDocuments
value: all_retrieved_documents
description: The `all_retrieved_documents` property.
onYourDataAuthenticationType:
type: string
description: The authentication types supported with Azure OpenAI On Your Data.
enum:
- api_key
- connection_string
- key_and_key_id
- encoded_api_key
- access_token
- system_assigned_managed_identity
- user_assigned_managed_identity
- username_and_password
x-ms-enum:
name: OnYourDataAuthenticationType
modelAsString: true
values:
- name: apiKey
value: api_key
description: Authentication via API key.
- name: connectionString
value: connection_string
description: Authentication via connection string.
- name: keyAndKeyId
value: key_and_key_id
description: Authentication via key and key ID pair.
- name: encodedApiKey
value: encoded_api_key
description: Authentication via encoded API key.
- name: accessToken
value: access_token
description: Authentication via access token.
- name: systemAssignedManagedIdentity
value: system_assigned_managed_identity
description: Authentication via system-assigned managed identity.
- name: userAssignedManagedIdentity
value: user_assigned_managed_identity
description: Authentication via user-assigned managed identity.
- name: usernameAndPassword
value: username_and_password
description: Authentication via username and password.
onYourDataApiKeyAuthenticationOptions:
required:
- key
description: The authentication options for Azure OpenAI On Your Data when using an API key.
allOf:
- $ref: "#/components/schemas/onYourDataAuthenticationOptions"
- properties:
key:
type: string
description: The API key to use for authentication.
x-ms-discriminator-value: api_key
onYourDataConnectionStringAuthenticationOptions:
required:
- connection_string
description: The authentication options for Azure OpenAI On Your Data when using a connection string.
allOf:
- $ref: "#/components/schemas/onYourDataAuthenticationOptions"
- properties:
connection_string:
type: string
description: The connection string to use for authentication.
x-ms-discriminator-value: connection_string
onYourDataKeyAndKeyIdAuthenticationOptions:
required:
- key
- key_id
description: The authentication options for Azure OpenAI On Your Data when using an Elasticsearch key and key ID pair.
allOf:
- $ref: "#/components/schemas/onYourDataAuthenticationOptions"
- properties:
key:
type: string
description: The Elasticsearch key to use for authentication.
key_id:
type: string
description: The Elasticsearch key ID to use for authentication.
x-ms-discriminator-value: key_and_key_id
onYourDataEncodedApiKeyAuthenticationOptions:
required:
- encoded_api_key
description: The authentication options for Azure OpenAI On Your Data when using an Elasticsearch encoded API key.
allOf:
- $ref: "#/components/schemas/onYourDataAuthenticationOptions"
- properties:
encoded_api_key:
type: string
description: The Elasticsearch encoded API key to use for authentication.
x-ms-discriminator-value: encoded_api_key
onYourDataAccessTokenAuthenticationOptions:
required:
- access_token
description: The authentication options for Azure OpenAI On Your Data when using access token.
allOf:
- $ref: "#/components/schemas/onYourDataAuthenticationOptions"
- properties:
access_token:
type: string
description: The access token to use for authentication.
x-ms-discriminator-value: access_token
onYourDataSystemAssignedManagedIdentityAuthenticationOptions:
description: The authentication options for Azure OpenAI On Your Data when using a system-assigned managed identity.
allOf:
- $ref: "#/components/schemas/onYourDataAuthenticationOptions"
x-ms-discriminator-value: system_assigned_managed_identity
onYourDataUserAssignedManagedIdentityAuthenticationOptions:
required:
- managed_identity_resource_id
description: The authentication options for Azure OpenAI On Your Data when using a user-assigned managed identity.
allOf:
- $ref: "#/components/schemas/onYourDataAuthenticationOptions"
- properties:
managed_identity_resource_id:
type: string
description: The resource ID of the user-assigned managed identity to use for authentication.
x-ms-discriminator-value: user_assigned_managed_identity
onYourDataUsernameAndPasswordAuthenticationOptions:
required:
- username
- password
description: The authentication options for Azure OpenAI On Your Data when using a username and a password.
allOf:
- $ref: "#/components/schemas/onYourDataAuthenticationOptions"
- properties:
username:
type: string
description: The username to use for authentication.
password:
type: string
description: The password. to use for authentication.
x-ms-discriminator-value: username_and_password
onYourDataVectorizationSource:
required:
- type
type: object
properties:
type:
$ref: "#/components/schemas/onYourDataVectorizationSourceType"
description: An abstract representation of a vectorization source for Azure OpenAI On Your Data with vector search.
discriminator:
propertyName: type
mapping:
endpoint: "#/components/schemas/onYourDataEndpointVectorizationSource"
deployment_name: "#/components/schemas/onYourDataDeploymentNameVectorizationSource"
integrated: "#/components/schemas/onYourDataIntegratedVectorizationSource"
model_id: "#/components/schemas/onYourDataModelIdVectorizationSource"
onYourDataVectorizationSourceType:
type: string
description: |-
Represents the available sources Azure OpenAI On Your Data can use to configure vectorization of data for use with
vector search.
enum:
- endpoint
- deployment_name
- integrated
- model_id
x-ms-enum:
name: OnYourDataVectorizationSourceType
modelAsString: true
values:
- name: endpoint
value: endpoint
description: Represents vectorization performed by public service calls to an Azure OpenAI embedding model.
- name: deploymentName
value: deployment_name
description: |-
Represents an Ada model deployment name to use. This model deployment must be in the same Azure OpenAI resource, but
On Your Data will use this model deployment via an internal call rather than a public one, which enables vector
search even in private networks.
- name: integrated
value: integrated
description: Represents the integrated vectorizer defined within the search resource.
- name: modelId
value: model_id
description: |-
Represents a specific embedding model ID as defined in the search service.
Currently only supported by Elasticsearch®.
onYourDataEndpointVectorizationSource:
required:
- authentication
- endpoint
description: |-
The details of a a vectorization source, used by Azure OpenAI On Your Data when applying vector search, that is based
on a public Azure OpenAI endpoint call for embeddings.
allOf:
- $ref: "#/components/schemas/onYourDataVectorizationSource"
- properties:
endpoint:
type: string
description: Specifies the resource endpoint URL from which embeddings should be retrieved. It should be in the format of https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings. The api-version query parameter is not allowed.
format: uri
authentication:
oneOf:
- $ref: "#/components/schemas/onYourDataApiKeyAuthenticationOptions"
- $ref: "#/components/schemas/onYourDataAccessTokenAuthenticationOptions"
dimensions:
type: integer
description: The number of dimensions the embeddings should have. Only supported in `text-embedding-3` and later models.
format: int32
x-ms-discriminator-value: endpoint
onYourDataDeploymentNameVectorizationSource:
required:
- deployment_name
description: |-
The details of a a vectorization source, used by Azure OpenAI On Your Data when applying vector search, that is based
on an internal embeddings model deployment name in the same Azure OpenAI resource.
allOf:
- $ref: "#/components/schemas/onYourDataVectorizationSource"
- properties:
deployment_name:
type: string
description: Specifies the name of the model deployment to use for vectorization. This model deployment must be in the same Azure OpenAI resource, but On Your Data will use this model deployment via an internal call rather than a public one, which enables vector search even in private networks.
dimensions:
type: integer
description: The number of dimensions the embeddings should have. Only supported in `text-embedding-3` and later models.
format: int32
x-ms-discriminator-value: deployment_name
onYourDataIntegratedVectorizationSource:
description: |-
Represents the integrated vectorizer defined within the search resource.
allOf:
- $ref: "#/components/schemas/onYourDataVectorizationSource"
x-ms-discriminator-value: integrated
onYourDataModelIdVectorizationSource:
required:
- model_id
description: |-
The details of a a vectorization source, used by Azure OpenAI On Your Data when applying vector search, that is based
on a search service model ID. Currently only supported by Elasticsearch®.
allOf:
- $ref: "#/components/schemas/onYourDataVectorizationSource"
- properties:
model_id:
type: string
description: Specifies the model ID to use for vectorization. This model ID must be defined in the search service.
x-ms-discriminator-value: model_id
azureChatExtensionsMessageContext:
type: object
properties:
citations:
type: array
description: The data source retrieval result, used to generate the assistant message in the response.
items:
$ref: "#/components/schemas/citation"
x-ms-identifiers: []
intent:
type: string
description: The detected intent from the chat history, used to pass to the next turn to carry over the context.
all_retrieved_documents:
type: array
description: All the retrieved documents.
items:
$ref: "#/components/schemas/retrievedDocument"
description: |2-
A representation of the additional context information available when Azure OpenAI chat extensions are involved
in the generation of a corresponding chat completions response. This context information is only populated when
using an Azure OpenAI request configured to use a matching extension.
citation:
required:
- content
type: object
properties:
content:
type: string
description: The content of the citation.
title:
type: string
description: The title of the citation.
url:
type: string
description: The URL of the citation.
filepath:
type: string
description: The file path of the citation.
chunk_id:
type: string
description: The chunk ID of the citation.
rerank_score:
type: number
description: The rerank score of the retrieved document.
format: double
description: citation information for a chat completions response message.
retrievedDocument:
type: object
description: The retrieved document.
required:
- search_queries
- data_source_index
allOf:
- $ref: "#/components/schemas/citation"
- properties:
search_queries:
type: array
description: The search queries used to retrieve the document.
items:
type: string
data_source_index:
type: integer
description: The index of the data source.
format: int32
original_search_score:
type: number
description: The original search score of the retrieved document.
format: double
filter_reason:
$ref: "#/components/schemas/filterReason"
description: Represents the rationale for filtering the document. If the document does not undergo filtering, this field will remain unset.
filterReason:
type: string
description: The filtering reason of the retrieved document.
enum:
- score
- rerank
x-ms-enum:
name: FilterReason
modelAsString: true
values:
- name: score
value: score
description: The document is filtered by original search score threshold defined by `strictness` configure.
- name: rerank
value: rerank
description: The document is not filtered by original search score threshold, but is filtered by rerank score and `top_n_documents` configure.
chatCompletionMessageToolCall:
type: object
properties:
id:
type: string
description: The ID of the tool call.
type:
$ref: "#/components/schemas/toolCallType"
function:
type: object
description: The function that the model called.
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.
required:
- name
- arguments
required:
- id
- type
- function
toolCallType:
type: string
enum:
- function
description: The type of the tool call, in this case `function`.
x-ms-enum:
name: ToolCallType
modelAsString: true
values:
- value: function
description: The tool call type is function.
chatCompletionRequestMessageTool:
allOf:
- $ref: "#/components/schemas/chatCompletionRequestMessage"
- type: object
nullable: true
properties:
tool_call_id:
type: string
description: Tool call that this message is responding to.
content:
type: string
description: The contents of the message.
nullable: true
required:
- tool_call_id
- content
chatCompletionRequestMessageFunction:
allOf:
- $ref: "#/components/schemas/chatCompletionRequestMessage"
- type: object
description: Deprecated. Message that represents a function.
nullable: true
properties:
role:
type: string
enum:
- function
description: The role of the messages author, in this case `function`.
name:
type: string
description: The contents of the message.
content:
type: string
description: The contents of the message.
nullable: true
required:
- function_call_id
- content
createChatCompletionResponse:
type: object
description: Represents a chat completion response returned by model, based on the provided input.
properties:
id:
type: string
description: A unique identifier for the chat completion.
prompt_filter_results:
$ref: "#/components/schemas/promptFilterResults"
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
- logprobs
properties:
finish_reason:
type: string
description: &chat_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,
`content_filter` if content was omitted due to a flag from our content filters,
`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
enum:
[
"stop",
"length",
"tool_calls",
"content_filter",
"function_call",
]
index:
type: integer
description: The index of the choice in the list of choices.
message:
$ref: "#/components/schemas/chatCompletionResponseMessage"
content_filter_results:
$ref: "#/components/schemas/contentFilterChoiceResults"
logprobs: &chat_completion_response_logprobs
description: Log probability information for the choice.
type: object
nullable: true
properties:
content:
description: A list of message content tokens with log probability information.
type: array
items:
$ref: "#/components/schemas/chatCompletionTokenLogprob"
nullable: true
refusal:
description: A list of message refusal tokens with log probability information.
type: array
items:
$ref: "#/components/schemas/chatCompletionTokenLogprob"
nullable: true
required:
- content
- refusal
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.
system_fingerprint:
type: string
description: |
This fingerprint represents the backend configuration that the model runs with.
Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
object:
type: string
description: The object type, which is always `chat.completion`.
enum: [chat.completion]
usage:
$ref: "#/components/schemas/completionUsage"
required:
- choices
- created
- id
- model
- object
createChatCompletionStreamResponse:
type: object
description: Represents a streamed chunk of a chat completion response returned by model, based on the provided input.
properties:
id:
type: string
description: A unique identifier for the chat completion. Each chunk has the same ID.
choices:
type: array
description: |
A list of chat completion choices. Can contain more than one elements if `n` is greater than 1.
items:
type: object
required:
- delta
- finish_reason
- index
properties:
delta:
$ref: "#/components/schemas/chatCompletionStreamResponseDelta"
logprobs: *chat_completion_response_logprobs
finish_reason:
type: string
description: *chat_completion_finish_reason_description
enum:
[
"stop",
"length",
"tool_calls",
"content_filter",
"function_call",
]
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.
system_fingerprint:
type: string
description: |
This fingerprint represents the backend configuration that the model runs with.
Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
object:
type: string
description: The object type, which is always `chat.completion.chunk`.
enum: [chat.completion.chunk]
required:
- prompt_tokens
- completion_tokens
- total_tokens
required:
- choices
- created
- id
- model
- object
chatCompletionStreamResponseDelta:
type: object
description: A chat completion delta generated by streamed model responses.
properties:
content:
type: string
description: The contents of the chunk message.
nullable: true
function_call:
deprecated: true
type: object
description: "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."
properties:
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.
tool_calls:
type: array
items:
$ref: "#/components/schemas/chatCompletionMessageToolCallChunk"
role:
type: string
enum: ["system", "user", "assistant", "tool"]
description: The role of the author of this message.
refusal:
type: string
description: The refusal message generated by the model.
nullable: true
chatCompletionMessageToolCallChunk:
type: object
properties:
index:
type: integer
id:
type: string
description: The ID of the tool call.
type:
type: string
enum: ["function"]
description: The type of the tool. Currently, only `function` is supported.
function:
type: object
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.
required:
- index
chatCompletionStreamOptions:
description: |
Options for streaming response. Only set this when you set `stream: true`.
type: object
nullable: true
default: null
properties:
include_usage:
type: boolean
description: |
If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.
chatCompletionChoiceLogProbs:
description: Log probability information for the choice.
type: object
nullable: true
properties:
content:
description: A list of message content tokens with log probability information.
type: array
items:
$ref: "#/components/schemas/chatCompletionTokenLogprob"
nullable: true
refusal:
description: A list of message refusal tokens with log probability information.
type: array
items:
$ref: "#/components/schemas/chatCompletionTokenLogprob"
nullable: true
required:
- content
chatCompletionTokenLogprob:
type: object
properties:
token:
description: The token.
type: string
logprob:
description: The log probability of this token.
type: number
bytes:
description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
type: array
items:
type: integer
nullable: true
top_logprobs:
description: List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
type: array
items:
type: object
properties:
token:
description: The token.
type: string
logprob:
description: The log probability of this token.
type: number
bytes:
description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
type: array
items:
type: integer
nullable: true
required:
- token
- logprob
- bytes
required:
- token
- logprob
- bytes
- top_logprobs
chatCompletionResponseMessage:
type: object
description: A chat completion message generated by the model.
properties:
role:
$ref: "#/components/schemas/chatCompletionResponseMessageRole"
refusal:
type: string
description: The refusal message generated by the model.
nullable: true
content:
type: string
description: The contents of the message.
nullable: true
tool_calls:
type: array
description: The tool calls generated by the model, such as function calls.
items:
$ref: "#/components/schemas/chatCompletionMessageToolCall"
function_call:
$ref: "#/components/schemas/chatCompletionFunctionCall"
context:
$ref: "#/components/schemas/azureChatExtensionsMessageContext"
required:
- role
- content
- refusal
chatCompletionResponseMessageRole:
type: string
enum:
- assistant
description: The role of the author of the response message.
chatCompletionToolChoiceOption:
description: |
Controls which (if any) tool is called by the model.
`none` means the model will not call any tool and instead generates a message.
`auto` means the model can pick between generating a message or calling one or more tools.
`required` means the model must call one or more tools.
Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
`none` is the default when no tools are present. `auto` is the default if tools are present.
oneOf:
- type: string
description: >
`none` means the model will not call any tool and instead generates a message.
`auto` means the model can pick between generating a message or calling one or more tools.
`required` means the model must call one or more tools.
enum:
- none
- auto
- required
- $ref: "#/components/schemas/chatCompletionNamedToolChoice"
chatCompletionNamedToolChoice:
type: object
description: Specifies a tool the model should use. Use to force the model to call a specific function.
properties:
type:
type: string
enum:
- "function"
description: The type of the tool. Currently, only `function` is supported.
function:
type: object
properties:
name:
type: string
description: The name of the function to call.
required:
- name
required:
- type
- function
ParallelToolCalls:
description: Whether to enable parallel function calling during tool use.
type: boolean
default: true
chatCompletionMessageToolCalls:
type: array
description: The tool calls generated by the model, such as function calls.
items:
$ref: "#/components/schemas/chatCompletionMessageToolCall"
chatCompletionFunctionCall:
type: object
description: Deprecated and replaced by `tool_calls`. 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.
required:
- name
- arguments
completionUsage:
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.
total_tokens:
type: integer
description: Total number of tokens used in the request (prompt + completion).
completion_tokens_details:
type: object
description: Breakdown of tokens used in a completion.
properties:
reasoning_tokens:
type: integer
description: Tokens generated by the model for reasoning.
required:
- prompt_tokens
- completion_tokens
- total_tokens
chatCompletionTool:
type: object
properties:
type:
type: string
enum: ["function"]
description: The type of the tool. Currently, only `function` is supported.
function:
$ref: "#/components/schemas/FunctionObject"
required:
- type
- function
FunctionParameters:
type: object
description: "The parameters the functions accepts, described as a JSON Schema object. See the guide](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list."
additionalProperties: true
FunctionObject:
type: object
properties:
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/FunctionParameters"
strict:
type: boolean
nullable: true
default: false
description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
required:
- name
ResponseFormatText:
type: object
properties:
type:
type: string
description: "The type of response format being defined: `text`"
enum: ["text"]
required:
- type
ResponseFormatJsonObject:
type: object
properties:
type:
type: string
description: "The type of response format being defined: `json_object`"
enum: ["json_object"]
required:
- type
ResponseFormatJsonSchemaSchema:
type: object
description: "The schema for the response format, described as a JSON Schema object."
additionalProperties: true
ResponseFormatJsonSchema:
type: object
properties:
type:
type: string
description: "The type of response format being defined: `json_schema`"
enum: ["json_schema"]
json_schema:
type: object
properties:
description:
type: string
description: A description of what the response format is for, used by the model to determine how to respond in the format.
name:
type: string
description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
schema:
$ref: "#/components/schemas/ResponseFormatJsonSchemaSchema"
strict:
type: boolean
nullable: true
default: false
description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.
required:
- type
- name
required:
- type
- json_schema
chatCompletionChoiceCommon:
type: object
properties:
index:
type: integer
finish_reason:
type: string
createTranslationRequest:
type: object
description: Translation request.
properties:
file:
type: string
description: The audio file to translate.
format: binary
prompt:
type: string
description: An optional text to guide the model's style or continue a previous audio segment. The prompt should be in English.
response_format:
$ref: "#/components/schemas/audioResponseFormat"
temperature:
type: number
default: 0
description: 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 to automatically increase the temperature until certain thresholds are hit.
required:
- file
audioResponse:
description: Translation or transcription response when response_format was json
type: object
properties:
text:
type: string
description: Translated or transcribed text.
required:
- text
audioVerboseResponse:
description: Translation or transcription response when response_format was verbose_json
type: object
allOf:
- $ref: "#/components/schemas/audioResponse"
- properties:
task:
type: string
description: Type of audio task.
enum:
- transcribe
- translate
x-ms-enum:
modelAsString: true
language:
type: string
description: Language.
duration:
type: number
description: Duration.
segments:
type: array
items:
$ref: "#/components/schemas/audioSegment"
words:
type: array
items:
$ref: "#/components/schemas/audioWord"
required:
- text
audioResponseFormat:
title: AudioResponseFormat
description: Defines the format of the output.
enum:
- json
- text
- srt
- verbose_json
- vtt
type: string
x-ms-enum:
modelAsString: true
createTranscriptionRequest:
type: object
description: Transcription request.
properties:
file:
type: string
description: The audio file object to transcribe.
format: binary
prompt:
type: string
description: An optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language.
response_format:
$ref: "#/components/schemas/audioResponseFormat"
temperature:
type: number
default: 0
description: 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 to automatically increase the temperature until certain thresholds are hit.
language:
type: string
description: The language of the input audio. Supplying the input language in ISO-639-1 format will improve accuracy and latency.
timestamp_granularities[]:
description: |
The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.
type: array
items:
type: string
enum:
- word
- segment
default: [segment]
required:
- file
audioSegment:
type: object
description: Transcription or translation segment.
properties:
id:
type: integer
description: Segment identifier.
seek:
type: number
description: Offset of the segment.
start:
type: number
description: Segment start offset.
end:
type: number
description: Segment end offset.
text:
type: string
description: Segment text.
tokens:
type: array
items:
type: number
nullable: false
description: Tokens of the text.
temperature:
type: number
description: Temperature.
avg_logprob:
type: number
description: Average log probability.
compression_ratio:
type: number
description: Compression ratio.
no_speech_prob:
type: number
description: Probability of 'no speech'.
audioWord:
type: object
description: Transcription or translation word.
properties:
word:
type: string
description: Word
start:
type: number
description: Word start offset.
end:
type: number
description: Word end offset.
createSpeechRequest:
type: object
description: Speech request.
properties:
input:
type: string
description: The text to synthesize audio for. The maximum length is 4096 characters.
maxLength: 4096
voice:
type: string
description: The voice to use for speech synthesis.
enum:
- alloy
- echo
- fable
- onyx
- nova
- shimmer
response_format:
type: string
description: The format to synthesize the audio in.
enum:
- mp3
- opus
- aac
- flac
- wav
- pcm
speed:
description: The speed of the synthesize audio. Select a value from `0.25` to `4.0`. `1.0` is the default.
type: number
default: 1
minimum: 0.25
maximum: 4
required:
- input
- voice
imageQuality:
description: The quality of the image that will be generated.
type: string
enum:
- standard
- hd
default: standard
x-ms-enum:
name: Quality
modelAsString: true
values:
- value: standard
description: Standard quality creates images with standard quality.
name: Standard
- value: hd
description: HD quality creates images with finer details and greater consistency across the image.
name: HD
imagesResponseFormat:
description: The format in which the generated images are returned.
type: string
enum:
- url
- b64_json
default: url
x-ms-enum:
name: ImagesResponseFormat
modelAsString: true
values:
- value: url
description: The URL that provides temporary access to download the generated images.
name: Url
- value: b64_json
description: The generated images are returned as base64 encoded string.
name: Base64Json
imageSize:
description: The size of the generated images.
type: string
enum:
- 256x256
- 512x512
- 1792x1024
- 1024x1792
- 1024x1024
default: 1024x1024
x-ms-enum:
name: Size
modelAsString: true
values:
- value: 256x256
description: The desired size of the generated image is 256x256 pixels. Only supported for dall-e-2.
name: Size256x256
- value: 512x512
description: The desired size of the generated image is 512x512 pixels. Only supported for dall-e-2.
name: Size512x512
- value: 1792x1024
description: The desired size of the generated image is 1792x1024 pixels. Only supported for dall-e-3.
name: Size1792x1024
- value: 1024x1792
description: The desired size of the generated image is 1024x1792 pixels. Only supported for dall-e-3.
name: Size1024x1792
- value: 1024x1024
description: The desired size of the generated image is 1024x1024 pixels.
name: Size1024x1024
imageStyle:
description: The style of the generated images.
type: string
enum:
- vivid
- natural
default: vivid
x-ms-enum:
name: Style
modelAsString: true
values:
- value: vivid
description: Vivid creates images that are hyper-realistic and dramatic.
name: Vivid
- value: natural
description: Natural creates images that are more natural and less hyper-realistic.
name: Natural
imageGenerationsRequest:
type: object
properties:
prompt:
description: A text description of the desired image(s). The maximum length is 4000 characters.
type: string
format: string
example: a corgi in a field
minLength: 1
"n":
description: The number of images to generate.
type: integer
minimum: 1
maximum: 1
default: 1
size:
$ref: "#/components/schemas/imageSize"
response_format:
$ref: "#/components/schemas/imagesResponseFormat"
user:
description: A unique identifier representing your end-user, which can help to monitor and detect abuse.
type: string
format: string
example: user123456
quality:
$ref: "#/components/schemas/imageQuality"
style:
$ref: "#/components/schemas/imageStyle"
required:
- prompt
generateImagesResponse:
type: object
properties:
created:
type: integer
format: unixtime
description: The unix timestamp when the operation was created.
example: "1676540381"
data:
type: array
description: The result data of the operation, if successful
items:
$ref: "#/components/schemas/imageResult"
required:
- created
- data
imageResult:
type: object
description: The image url or encoded image if successful, and an error otherwise.
properties:
url:
type: string
description: The image url.
example: https://www.contoso.com
b64_json:
type: string
description: The base64 encoded image
content_filter_results:
$ref: "#/components/schemas/dalleContentFilterResults"
revised_prompt:
type: string
description: The prompt that was used to generate the image, if there was any revision to the prompt.
prompt_filter_results:
$ref: "#/components/schemas/dalleFilterResults"
line:
type: object
description: A content line object consisting of an adjacent sequence of content elements, such as words and selection marks.
properties:
text:
type: string
spans:
type: array
description: An array of spans that represent detected objects and its bounding box information.
items:
$ref: "#/components/schemas/span"
required:
- text
- spans
span:
type: object
description: A span object that represents a detected object and its bounding box information.
properties:
text:
type: string
description: The text content of the span that represents the detected object.
offset:
type: integer
description: The character offset within the text where the span begins. This offset is defined as the position of the first character of the span, counting from the start of the text as Unicode codepoints.
length:
type: integer
description: The length of the span in characters, measured in Unicode codepoints.
polygon:
type: array
description: An array of objects representing points in the polygon that encloses the detected object.
items:
type: object
properties:
x:
type: number
description: The x-coordinate of the point.
"y":
type: number
description: The y-coordinate of the point.
required:
- text
- offset
- length
- polygon
runCompletionUsage:
type: object
description: Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).
properties:
completion_tokens:
type: integer
description: Number of completion tokens used over the course of the run.
prompt_tokens:
type: integer
description: Number of prompt tokens used over the course of the run.
total_tokens:
type: integer
description: Total number of tokens used (prompt + completion).
required:
- prompt_tokens
- completion_tokens
- total_tokens
nullable: true
runStepCompletionUsage:
type: object
description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.
properties:
completion_tokens:
type: integer
description: Number of completion tokens used over the course of the run step.
prompt_tokens:
type: integer
description: Number of prompt tokens used over the course of the run step.
total_tokens:
type: integer
description: Total number of tokens used (prompt + completion).
required:
- prompt_tokens
- completion_tokens
- total_tokens
nullable: true
assistantsApiResponseFormatOption:
description: |
Specifies the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON.
**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.
oneOf:
- type: string
description: >
`auto` is the default value
enum: [none, auto]
x-ms-enum:
name: AssistantsApiResponseFormatOption
modelAsString: true
values:
- value: none
- value: auto
- $ref: "#/components/schemas/assistantsApiResponseFormat"
assistantsApiResponseFormat:
type: object
description: |
An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. If `text` the model can return text or any value needed.
properties:
type:
type: string
enum: ["text", "json_object"]
x-ms-enum:
name: AssistantsApiResponseFormat
modelAsString: true
values:
- value: text
- value: json_object
example: "json_object"
default: "text"
description: Must be one of `text` or `json_object`.
assistantObject:
type: object
title: Assistant
description: Represents an `assistant` that can call the model and use tools.
properties:
id:
description: The identifier, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `assistant`.
type: string
enum:
- assistant
x-ms-enum:
name: AssistantObjectType
modelAsString: true
values:
- value: assistant
created_at:
type: integer
description: The Unix timestamp (in seconds) for when the assistant was created.
name:
description: &assistant_name_param_description |
The name of the assistant. The maximum length is 256 characters.
type: string
maxLength: 256
nullable: true
description:
description: &assistant_description_param_description |
The description of the assistant. The maximum length is 512 characters.
type: string
maxLength: 512
nullable: true
model:
description: |
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.
type: string
instructions:
description: &assistant_instructions_param_description |
The system instructions that the assistant uses. The maximum length is 256,000 characters.
type: string
maxLength: 256000
nullable: true
tools:
description: &assistant_tools_param_description |
A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
default: []
type: array
maxItems: 128
items:
oneOf:
- $ref: "#/components/schemas/assistantToolsCode"
- $ref: "#/components/schemas/assistantToolsFileSearch"
- $ref: "#/components/schemas/assistantToolsFunction"
tool_resources:
type: object
description: |
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
properties:
code_interpreter:
type: object
properties:
file_ids:
type: array
description: |
A list of file IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.
default: []
maxItems: 20
items:
type: string
file_search:
type: object
properties:
vector_store_ids:
type: array
description: |
The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
maxItems: 1
items:
type: string
metadata:
description: &metadata_description |
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
type: object
nullable: true
temperature:
description: &run_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.
type: number
minimum: 0
maximum: 2
default: 1
example: 1
nullable: true
top_p:
type: number
minimum: 0
maximum: 1
default: 1
example: 1
nullable: true
description: &run_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.
response_format:
$ref: "#/components/schemas/assistantsApiResponseFormatOption"
nullable: true
required:
- id
- object
- created_at
- name
- description
- model
- instructions
- tools
- metadata
createAssistantRequest:
type: object
additionalProperties: false
properties:
model:
description: |
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.
anyOf:
- type: string
name:
description: *assistant_name_param_description
type: string
nullable: true
maxLength: 256
description:
description: *assistant_description_param_description
type: string
nullable: true
maxLength: 512
instructions:
description: *assistant_instructions_param_description
type: string
nullable: true
maxLength: 256000
tools:
description: *assistant_tools_param_description
default: []
type: array
maxItems: 128
items:
oneOf:
- $ref: "#/components/schemas/assistantToolsCode"
- $ref: "#/components/schemas/assistantToolsFileSearch"
- $ref: "#/components/schemas/assistantToolsFunction"
tool_resources:
type: object
description: |
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
properties:
code_interpreter:
type: object
properties:
file_ids:
type: array
description: |
A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
default: []
maxItems: 20
items:
type: string
file_search:
type: object
properties:
vector_store_ids:
type: array
description: |
The vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
maxItems: 1
items:
type: string
vector_stores:
type: array
description: |
A helper to create a vector store with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.
maxItems: 1
items:
type: object
properties:
file_ids:
type: array
description: |
A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
maxItems: 10000
items:
type: string
chunking_strategy:
# Ideally we'd reuse the chunking strategy schema here, but it doesn't expand properly
type: object
description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
oneOf:
- type: object
title: Auto Chunking Strategy
description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
additionalProperties: false
properties:
type:
type: string
description: Always `auto`.
enum: ["auto"]
x-ms-enum:
name: AutoChunkingStrategyType
modelAsString: true
values:
- value: auto
required:
- type
- type: object
title: Static Chunking Strategy
additionalProperties: false
properties:
type:
type: string
description: Always `static`.
enum: ["static"]
x-ms-enum:
name: StaticChunkingStrategyType
modelAsString: true
values:
- value: static
static:
type: object
additionalProperties: false
properties:
max_chunk_size_tokens:
type: integer
minimum: 100
maximum: 4096
description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
chunk_overlap_tokens:
type: integer
description: |
The number of tokens that overlap between chunks. The default value is `400`.
Note that the overlap must not exceed half of `max_chunk_size_tokens`.
required:
- max_chunk_size_tokens
- chunk_overlap_tokens
required:
- type
- static
metadata:
type: object
description: |
Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
oneOf:
- required: [vector_store_ids]
- required: [vector_stores]
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
temperature:
description: *run_temperature_description
type: number
minimum: 0
maximum: 2
default: 1
example: 1
nullable: true
top_p:
type: number
minimum: 0
maximum: 1
default: 1
example: 1
nullable: true
description: *run_top_p_description
response_format:
$ref: "#/components/schemas/assistantsApiResponseFormatOption"
nullable: true
required:
- model
modifyAssistantRequest:
type: object
additionalProperties: false
properties:
model:
description: |
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.
anyOf:
- type: string
name:
description: |
The name of the assistant. The maximum length is 256 characters.
type: string
nullable: true
maxLength: 256
description:
description: |
The description of the assistant. The maximum length is 512 characters.
type: string
nullable: true
maxLength: 512
instructions:
description: |
The system instructions that the assistant uses. The maximum length is 32768 characters.
type: string
nullable: true
maxLength: 32768
tools:
description: |
A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
default: []
type: array
maxItems: 128
items:
oneOf:
- $ref: "#/components/schemas/assistantToolsCode"
- $ref: "#/components/schemas/assistantToolsFileSearch"
- $ref: "#/components/schemas/assistantToolsFunction"
tool_resources:
type: object
description: |
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
properties:
code_interpreter:
type: object
properties:
file_ids:
type: array
description: |
Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
default: []
maxItems: 20
items:
type: string
file_search:
type: object
properties:
vector_store_ids:
type: array
description: |
Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
maxItems: 1
items:
type: string
metadata:
description: *metadata_description
type: object
nullable: true
temperature:
description: *run_temperature_description
type: number
minimum: 0
maximum: 2
default: 1
example: 1
nullable: true
top_p:
type: number
minimum: 0
maximum: 1
default: 1
example: 1
nullable: true
description: *run_top_p_description
response_format:
$ref: "#/components/schemas/assistantsApiResponseFormatOption"
nullable: true
deleteAssistantResponse:
type: object
properties:
id:
type: string
deleted:
type: boolean
object:
type: string
enum:
- assistant.deleted
x-ms-enum:
name: DeleteAssistantResponseState
modelAsString: true
values:
- value: assistant.deleted
required:
- id
- object
- deleted
listAssistantsResponse:
type: object
properties:
object:
type: string
example: list
data:
type: array
items:
$ref: "#/components/schemas/assistantObject"
first_id:
type: string
example: asst_hLBK7PXBv5Lr2NQT7KLY0ag1
last_id:
type: string
example: asst_QLoItBbqwyAJEzlTy4y9kOMM
has_more:
type: boolean
example: false
required:
- object
- data
- first_id
- last_id
- has_more
assistantToolsCode:
type: object
title: Code interpreter tool
properties:
type:
type: string
description: "The type of tool being defined: `code_interpreter`"
enum:
- code_interpreter
x-ms-enum:
name: assistantToolsCodeType
modelAsString: true
values:
- value: code_interpreter
required:
- type
assistantToolsFileSearch:
type: object
title: FileSearch tool
properties:
type:
type: string
description: "The type of tool being defined: `file_search`"
enum:
- file_search
x-ms-enum:
name: assistantToolsFileSearchType
modelAsString: true
values:
- value: file_search
file_search:
type: object
description: Overrides for the file search tool.
properties:
max_num_results:
type: integer
minimum: 1
maximum: 50
description: |
The maximum number of results the file search tool should output. The
default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number
should be between 1 and 50 inclusive.
Note that the file search tool may output fewer than `max_num_results`
results. See the [file search tool
documentation](/docs/assistants/tools/file-search/number-of-chunks-returned)
for more information.
required:
- type
assistantToolsFileSearchTypeOnly:
type: object
title: FileSearch tool
properties:
type:
type: string
description: "The type of tool being defined: `file_search`"
enum:
- file_search
x-ms-enum:
name: assistantToolsFileSearchType
modelAsString: true
values:
- value: file_search
required:
- type
assistantToolsFunction:
type: object
title: Function tool
properties:
type:
type: string
description: "The type of tool being defined: `function`"
enum:
- function
x-ms-enum:
name: assistantToolsFunction
modelAsString: true
values:
- value: function
function:
type: object
description: The function definition.
properties:
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:
- name
- parameters
- description
required:
- type
- function
truncationObject:
type: object
title: Thread Truncation Controls
description: Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
properties:
type:
type: string
description: The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
enum: ["auto", "last_messages"]
x-ms-enum:
name: TruncationType
modelAsString: true
values:
- value: auto
- value: last_messages
last_messages:
type: integer
description: The number of most recent messages from the thread when constructing the context for the run.
minimum: 1
nullable: true
required:
- type
assistantsApiToolChoiceOption:
description: |
Controls which (if any) tool is called by the model.
`none` means the model will not call any tools and instead generates a message.
`auto` is the default value and means the model can pick between generating a message or calling a tool.
Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
oneOf:
- type: string
description: >
`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.
enum: [none, auto]
x-ms-enum:
name: AssistantsApiToolChoiceOption
modelAsString: true
values:
- value: none
- value: auto
- $ref: "#/components/schemas/assistantsNamedToolChoice"
assistantsNamedToolChoice:
type: object
description: Specifies a tool the model should use. Use to force the model to call a specific tool.
properties:
type:
type: string
enum: ["function", "code_interpreter", "file_search"]
description: The type of the tool. If type is `function`, the function name must be set
x-ms-enum:
name: AssistantsNamedToolChoiceType
modelAsString: true
values:
- value: function
- value: code_interpreter
- value: file_search
function:
type: object
properties:
name:
type: string
description: The name of the function to call.
required:
- name
required:
- type
runObject:
type: object
title: A run on a thread
description: Represents an execution run on a [thread](/docs/api-reference/threads).
properties:
id:
description: The identifier, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `thread.run`.
type: string
enum:
- thread.run
x-ms-enum:
name: runObjectType
modelAsString: true
values:
- value: thread.run
description: The run object type which is always thread.run
created_at:
description: The Unix timestamp (in seconds) for when the run was created.
type: integer
thread_id:
description: The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run.
type: string
assistant_id:
description: The ID of the assistant used for execution of this run.
type: string
status:
description: The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or `expired`.
type: string
enum:
- queued
- in_progress
- requires_action
- cancelling
- cancelled
- failed
- completed
- expired
x-ms-enum:
name: RunObjectStatus
modelAsString: true
values:
- value: queued
description: The queued state
- value: in_progress
description: The in_progress state
- value: requires_action
description: The required_action state
- value: cancelling
description: The cancelling state
- value: cancelled
description: The cancelled state
- value: failed
description: The failed state
- value: completed
description: The completed state
- value: expired
description: The expired state
required_action:
type: object
description: Details on the action required to continue the run. Will be `null` if no action is required.
nullable: true
properties:
type:
description: For now, this is always `submit_tool_outputs`.
type: string
enum:
- submit_tool_outputs
submit_tool_outputs:
type: object
description: Details on the tool outputs needed for this run to continue.
properties:
tool_calls:
type: array
description: A list of the relevant tool calls.
items:
$ref: "#/components/schemas/runToolCallObject"
required:
- tool_calls
required:
- type
- submit_tool_outputs
last_error:
type: object
description: The last error associated with this run. Will be `null` if there are no errors.
nullable: true
properties:
code:
type: string
description: One of `server_error` or `rate_limit_exceeded`.
enum:
- server_error
- rate_limit_exceeded
x-ms-enum:
name: LastErrorCode
modelAsString: true
values:
- value: server_error
description: The server failed to respond to request due to server error
- value: rate_limit_exceeded
description: The server failed to respond to request due to rate limit exceeded
message:
type: string
description: A human-readable description of the error.
required:
- code
- message
expires_at:
description: The Unix timestamp (in seconds) for when the run will expire.
type: integer
started_at:
description: The Unix timestamp (in seconds) for when the run was started.
type: integer
nullable: true
cancelled_at:
description: The Unix timestamp (in seconds) for when the run was cancelled.
type: integer
nullable: true
failed_at:
description: The Unix timestamp (in seconds) for when the run failed.
type: integer
nullable: true
completed_at:
description: The Unix timestamp (in seconds) for when the run was completed.
type: integer
nullable: true
incomplete_details:
description: Details on why the run is incomplete. Will be `null` if the run is not incomplete.
type: object
nullable: true
properties:
reason:
description: The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.
type: string
enum: ["max_completion_tokens", "max_prompt_tokens"]
x-ms-enum:
name: IncompleteDetailsReason
modelAsString: true
values:
- value: max_completion_tokens
- value: max_prompt_tokens
model:
description: The model that the assistant used for this run.
type: string
instructions:
description: The instructions that the assistant used for this run.
type: string
tools:
description: The list of tools that the assistant used for this run.
default: []
type: array
maxItems: 20
items:
oneOf:
- $ref: "#/components/schemas/assistantToolsCode"
- $ref: "#/components/schemas/assistantToolsFileSearch"
- $ref: "#/components/schemas/assistantToolsFunction"
metadata:
description: *metadata_description
type: object
nullable: true
usage:
$ref: "#/components/schemas/runCompletionUsage"
temperature:
description: The sampling temperature used for this run. If not set, defaults to 1.
type: number
nullable: true
top_p:
description: The nucleus sampling value used for this run. If not set, defaults to 1.
type: number
nullable: true
max_prompt_tokens:
type: integer
nullable: true
description: |
The maximum number of prompt tokens specified to have been used over the course of the run.
minimum: 256
max_completion_tokens:
type: integer
nullable: true
description: |
The maximum number of completion tokens specified to have been used over the course of the run.
minimum: 256
truncation_strategy:
$ref: "#/components/schemas/truncationObject"
nullable: true
tool_choice:
$ref: "#/components/schemas/assistantsApiToolChoiceOption"
nullable: true
parallel_tool_calls:
$ref: "#/components/schemas/ParallelToolCalls"
response_format:
$ref: "#/components/schemas/assistantsApiResponseFormatOption"
nullable: true
required:
- id
- object
- created_at
- thread_id
- assistant_id
- status
- required_action
- last_error
- expires_at
- started_at
- cancelled_at
- failed_at
- completed_at
- model
- instructions
- tools
- metadata
- usage
- incomplete_details
- max_prompt_tokens
- max_completion_tokens
- truncation_strategy
- tool_choice
- response_format
createRunRequest:
type: object
additionalProperties: false
properties:
assistant_id:
description: The ID of the assistant to use to execute this run.
type: string
model:
description: The ID of the Model to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
type: string
nullable: true
instructions:
description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
type: string
nullable: true
additional_instructions:
description: Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.
type: string
nullable: true
additional_messages:
description: Adds additional messages to the thread before creating the run.
type: array
items:
$ref: "#/components/schemas/createMessageRequest"
nullable: true
tools:
description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
nullable: true
type: array
maxItems: 20
items:
oneOf:
- $ref: "#/components/schemas/assistantToolsCode"
- $ref: "#/components/schemas/assistantToolsFileSearch"
- $ref: "#/components/schemas/assistantToolsFunction"
metadata:
description: *metadata_description
type: object
nullable: true
temperature:
type: number
minimum: 0
maximum: 2
default: 1
example: 1
nullable: true
description: *run_temperature_description
top_p:
type: number
minimum: 0
maximum: 1
default: 1
example: 1
nullable: true
description: *run_top_p_description
stream:
type: boolean
nullable: true
description: |
If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
max_prompt_tokens:
type: integer
nullable: true
description: |
The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
minimum: 256
max_completion_tokens:
type: integer
nullable: true
description: |
The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
minimum: 256
truncation_strategy:
$ref: "#/components/schemas/truncationObject"
nullable: true
tool_choice:
$ref: "#/components/schemas/assistantsApiToolChoiceOption"
nullable: true
parallel_tool_calls:
$ref: "#/components/schemas/ParallelToolCalls"
response_format:
$ref: "#/components/schemas/assistantsApiResponseFormatOption"
nullable: true
required:
- thread_id
- assistant_id
listRunsResponse:
type: object
properties:
object:
type: string
example: list
data:
type: array
items:
$ref: "#/components/schemas/runObject"
first_id:
type: string
example: run_hLBK7PXBv5Lr2NQT7KLY0ag1
last_id:
type: string
example: run_QLoItBbqwyAJEzlTy4y9kOMM
has_more:
type: boolean
example: false
required:
- object
- data
- first_id
- last_id
- has_more
modifyRunRequest:
type: object
additionalProperties: false
properties:
metadata:
description: *metadata_description
type: object
nullable: true
submitToolOutputsRunRequest:
type: object
additionalProperties: false
properties:
tool_outputs:
description: A list of tools for which the outputs are being submitted.
type: array
items:
type: object
properties:
tool_call_id:
type: string
description: The ID of the tool call in the `required_action` object within the run object the output is being submitted for.
output:
type: string
description: The output of the tool call to be submitted to continue the run.
stream:
type: boolean
nullable: true
description: |
If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
required:
- tool_outputs
runToolCallObject:
type: object
description: Tool call objects
properties:
id:
type: string
description: The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint.
type:
type: string
description: The type of tool call the output is required for. For now, this is always `function`.
enum:
- function
x-ms-enum:
name: RunToolCallObjectType
modelAsString: true
values:
- value: function
function:
type: object
description: The function definition.
properties:
name:
type: string
description: The name of the function.
arguments:
type: string
description: The arguments that the model expects you to pass to the function.
required:
- name
- arguments
required:
- id
- type
- function
createThreadAndRunRequest:
type: object
additionalProperties: false
properties:
assistant_id:
description: The ID of the assistant to use to execute this run.
type: string
thread:
$ref: "#/components/schemas/createThreadRequest"
description: If no thread is provided, an empty thread will be created.
model:
description: The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
type: string
nullable: true
instructions:
description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
type: string
nullable: true
tools:
description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
nullable: true
type: array
maxItems: 20
items:
oneOf:
- $ref: "#/components/schemas/assistantToolsCode"
- $ref: "#/components/schemas/assistantToolsFileSearch"
- $ref: "#/components/schemas/assistantToolsFunction"
tool_resources:
type: object
description: |
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
properties:
code_interpreter:
type: object
properties:
file_ids:
type: array
description: |
A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
default: []
maxItems: 20
items:
type: string
file_search:
type: object
properties:
vector_store_ids:
type: array
description: |
The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
maxItems: 1
items:
type: string
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
temperature:
type: number
minimum: 0
maximum: 2
default: 1
example: 1
nullable: true
description: *run_temperature_description
top_p:
type: number
minimum: 0
maximum: 1
default: 1
example: 1
nullable: true
description: *run_top_p_description
stream:
type: boolean
nullable: true
description: |
If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
max_prompt_tokens:
type: integer
nullable: true
description: |
The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
minimum: 256
max_completion_tokens:
type: integer
nullable: true
description: |
The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
minimum: 256
truncation_strategy:
$ref: "#/components/schemas/truncationObject"
nullable: true
tool_choice:
$ref: "#/components/schemas/assistantsApiToolChoiceOption"
nullable: true
parallel_tool_calls:
$ref: "#/components/schemas/ParallelToolCalls"
response_format:
$ref: "#/components/schemas/assistantsApiResponseFormatOption"
nullable: true
required:
- thread_id
- assistant_id
threadObject:
type: object
title: Thread
description: Represents a thread that contains [messages](/docs/api-reference/messages).
properties:
id:
description: The identifier, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `thread`.
type: string
enum:
- thread
x-ms-enum:
name: ThreadObjectType
modelAsString: true
values:
- value: thread
description: The type of thread object which is always `thread`
created_at:
description: The Unix timestamp (in seconds) for when the thread was created.
type: integer
tool_resources:
type: object
description: |
A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
properties:
code_interpreter:
type: object
properties:
file_ids:
type: array
description: |
A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
default: []
maxItems: 20
items:
type: string
file_search:
type: object
properties:
vector_store_ids:
type: array
description: |
The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
maxItems: 1
items:
type: string
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
required:
- id
- object
- created_at
- tool_resources
- metadata
createThreadRequest:
type: object
additionalProperties: false
properties:
messages:
description: A list of messages to start the thread with.
type: array
items:
$ref: "#/components/schemas/createMessageRequest"
tool_resources:
type: object
description: |
A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
properties:
code_interpreter:
type: object
properties:
file_ids:
type: array
description: |
A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
default: []
maxItems: 20
items:
type: string
file_search:
type: object
properties:
vector_store_ids:
type: array
description: |
The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
maxItems: 1
items:
type: string
vector_stores:
type: array
description: |
A helper to create a vector store with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
maxItems: 1
items:
type: object
properties:
file_ids:
type: array
description: |
A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
maxItems: 10000
items:
type: string
chunking_strategy:
# Ideally we'd reuse the chunking strategy schema here, but it doesn't expand properly
type: object
description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
oneOf:
- type: object
title: Auto Chunking Strategy
description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
additionalProperties: false
properties:
type:
type: string
description: Always `auto`.
enum: ["auto"]
x-ms-enum:
name: AutoChunkingStrategyType
modelAsString: true
values:
- value: auto
required:
- type
- type: object
title: Static Chunking Strategy
additionalProperties: false
properties:
type:
type: string
description: Always `static`.
enum: ["static"]
x-ms-enum:
name: StaticChunkingStrategyType
modelAsString: true
values:
- value: static
static:
type: object
additionalProperties: false
properties:
max_chunk_size_tokens:
type: integer
minimum: 100
maximum: 4096
description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
chunk_overlap_tokens:
type: integer
description: |
The number of tokens that overlap between chunks. The default value is `400`.
Note that the overlap must not exceed half of `max_chunk_size_tokens`.
required:
- max_chunk_size_tokens
- chunk_overlap_tokens
required:
- type
- static
metadata:
type: object
description: |
Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
oneOf:
- required: [vector_store_ids]
- required: [vector_stores]
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
modifyThreadRequest:
type: object
additionalProperties: false
properties:
tool_resources:
type: object
description: |
A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
properties:
code_interpreter:
type: object
properties:
file_ids:
type: array
description: |
A list of File IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
default: []
maxItems: 20
items:
type: string
file_search:
type: object
properties:
vector_store_ids:
type: array
description: |
The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
maxItems: 1
items:
type: string
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
deleteThreadResponse:
type: object
properties:
id:
type: string
deleted:
type: boolean
object:
type: string
enum:
- thread.deleted
x-ms-enum:
name: DeleteThreadResponseObjectState
modelAsString: true
values:
- value: thread.deleted
description: The delete thread response object state which is `thread.deleted`
required:
- id
- object
- deleted
listThreadsResponse:
properties:
object:
type: string
example: list
data:
type: array
items:
$ref: "#/components/schemas/threadObject"
first_id:
type: string
example: asst_hLBK7PXBv5Lr2NQT7KLY0ag1
last_id:
type: string
example: asst_QLoItBbqwyAJEzlTy4y9kOMM
has_more:
type: boolean
example: false
required:
- object
- data
- first_id
- last_id
- has_more
messageObject:
type: object
title: The message object
description: Represents a message within a [thread](/docs/api-reference/threads).
properties:
id:
description: The identifier, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `thread.message`.
type: string
enum:
- thread.message
x-ms-enum:
name: MessageObjectType
modelAsString: true
values:
- value: thread.message
description: The message object type which is `thread.message`
created_at:
description: The Unix timestamp (in seconds) for when the message was created.
type: integer
thread_id:
description: The [thread](/docs/api-reference/threads) ID that this message belongs to.
type: string
status:
description: The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.
type: string
enum: ["in_progress", "incomplete", "completed"]
x-ms-enum:
name: MessageObjectStatus
modelAsString: true
values:
- value: in_progress
- value: incomplete
- value: completed
incomplete_details:
description: On an incomplete message, details about why the message is incomplete.
type: object
properties:
reason:
type: string
description: The reason the message is incomplete.
enum:
[
"content_filter",
"max_tokens",
"run_cancelled",
"run_expired",
"run_failed",
]
x-ms-enum:
name: MessageObjectIncompleteReason
modelAsString: true
values:
- value: content_filter
- value: max_tokens
- value: run_cancelled
- value: run_expired
- value: run_failed
nullable: true
required:
- reason
completed_at:
description: The Unix timestamp (in seconds) for when the message was completed.
type: integer
nullable: true
incomplete_at:
description: The Unix timestamp (in seconds) for when the message was marked as incomplete.
type: integer
nullable: true
role:
description: The entity that produced the message. One of `user` or `assistant`.
type: string
enum:
- user
- assistant
x-ms-enum:
name: MessageObjectRole
modelAsString: true
values:
- value: user
- value: assistant
content:
description: The content of the message in array of text and/or images.
type: array
items:
oneOf:
- $ref: "#/components/schemas/messageContentImageFileObject"
- $ref: "#/components/schemas/messageContentTextObject"
assistant_id:
description: If applicable, the ID of the assistant that authored this message.
type: string
nullable: true
run_id:
description: If applicable, the ID of the [run](/docs/api-reference/runs) associated with the authoring of this message.
type: string
nullable: true
attachments:
type: array
items:
type: object
properties:
file_id:
type: string
description: The ID of the file to attach to the message.
tools:
description: The tools to add this file to.
type: array
items:
oneOf:
- $ref: "#/components/schemas/assistantToolsCode"
- $ref: "#/components/schemas/assistantToolsFileSearchTypeOnly"
description: A list of files attached to the message, and the tools they were added to.
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
required:
- id
- object
- created_at
- thread_id
- status
- incomplete_details
- completed_at
- incomplete_at
- role
- content
- assistant_id
- run_id
- attachments
- metadata
messageDeltaObject:
type: object
title: Message delta object
description: |
Represents a message delta i.e. any changed fields on a message during streaming.
properties:
id:
description: The identifier of the message, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `thread.message.delta`.
type: string
enum: ["thread.message.delta"]
x-ms-enum:
name: MessageDeltaObjectType
modelAsString: true
values:
- value: thread.message.delta
delta:
description: The delta containing the fields that have changed on the Message.
type: object
properties:
role:
description: The entity that produced the message. One of `user` or `assistant`.
type: string
enum: ["user", "assistant"]
x-ms-enum:
name: MessageDeltaObjectDeltaRole
modelAsString: true
values:
- value: user
- value: assistant
content:
description: The content of the message in array of text and/or images.
type: array
items:
oneOf:
- $ref: "#/components/schemas/messageDeltaContentImageFileObject"
- $ref: "#/components/schemas/messageDeltaContentTextObject"
required:
- id
- object
- delta
createMessageRequest:
type: object
additionalProperties: false
required:
- role
- content
properties:
role:
type: string
enum:
- user
- assistant
x-ms-enum:
name: CreateMessageRequestRole
modelAsString: true
values:
- value: user
- value: assistant
description: |
The role of the entity that is creating the message. Allowed values include:
- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.
content:
type: string
minLength: 1
maxLength: 256000
description: The content of the message.
attachments:
type: array
items:
type: object
properties:
file_id:
type: string
description: The ID of the file to attach to the message.
tools:
description: The tools to add this file to.
type: array
items:
oneOf:
- $ref: "#/components/schemas/assistantToolsCode"
- $ref: "#/components/schemas/assistantToolsFileSearchTypeOnly"
x-oaiExpandable: true
description: A list of files attached to the message, and the tools they should be added to.
required:
- file_id
- tools
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
modifyMessageRequest:
type: object
additionalProperties: false
properties:
metadata:
description: *metadata_description
type: object
nullable: true
deleteMessageResponse:
type: object
properties:
id:
type: string
deleted:
type: boolean
object:
type: string
enum:
- thread.message.deleted
x-ms-enum:
name: DeleteMessageResponseObject
modelAsString: true
values:
- value: thread.message.deleted
description: The delete message response object state
required:
- id
- object
- deleted
listMessagesResponse:
properties:
object:
type: string
example: list
data:
type: array
items:
$ref: "#/components/schemas/messageObject"
first_id:
type: string
example: msg_hLBK7PXBv5Lr2NQT7KLY0ag1
last_id:
type: string
example: msg_QLoItBbqwyAJEzlTy4y9kOMM
has_more:
type: boolean
example: false
required:
- object
- data
- first_id
- last_id
- has_more
messageContentImageFileObject:
title: Image file
type: object
description: References an image file in the content of a message.
properties:
type:
description: Always `image_file`.
type: string
enum:
- image_file
x-ms-enum:
name: MessageContentImageFileObjectType
modelAsString: true
values:
- value: image_file
description: The message content image file type
image_file:
type: object
properties:
file_id:
description: The file ID of the image in the message content.
type: string
required:
- file_id
required:
- type
- image_file
messageContentTextObject:
title: Text
type: object
description: The text content that is part of a message.
properties:
type:
description: Always `text`.
type: string
enum:
- text
x-ms-enum:
name: messageContentTextObjectType
modelAsString: true
values:
- value: text
description: The message content text Object type
text:
type: object
properties:
value:
description: The data that makes up the text.
type: string
annotations:
type: array
items:
oneOf:
- $ref: "#/components/schemas/messageContentTextAnnotationsFileCitationObject"
- $ref: "#/components/schemas/messageContentTextAnnotationsFilePathObject"
required:
- value
- annotations
required:
- type
- text
messageContentTextAnnotationsFileCitationObject:
title: File citation
type: object
description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "retrieval" tool to search files.
properties:
type:
description: Always `file_citation`.
type: string
enum:
- file_citation
x-ms-enum:
name: FileCitationObjectType
modelAsString: true
values:
- value: file_citation
description: The file citation object type
text:
description: The text in the message content that needs to be replaced.
type: string
file_citation:
type: object
properties:
file_id:
description: The ID of the specific File the citation is from.
type: string
required:
- file_id
start_index:
type: integer
minimum: 0
end_index:
type: integer
minimum: 0
required:
- type
- text
- file_citation
- start_index
- end_index
messageContentTextAnnotationsFilePathObject:
title: File path
type: object
description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.
properties:
type:
description: Always `file_path`.
type: string
enum:
- file_path
x-ms-enum:
name: FilePathObjectType
modelAsString: true
values:
- value: file_path
description: The file path object type
text:
description: The text in the message content that needs to be replaced.
type: string
file_path:
type: object
properties:
file_id:
description: The ID of the file that was generated.
type: string
required:
- file_id
start_index:
type: integer
minimum: 0
end_index:
type: integer
minimum: 0
required:
- type
- text
- file_path
- start_index
- end_index
messageDeltaContentImageFileObject:
title: Image file
type: object
description: References an image File in the content of a message.
properties:
index:
type: integer
description: The index of the content part in the message.
type:
description: Always `image_file`.
type: string
enum: ["image_file"]
x-ms-enum:
name: MessageDeltaContentImageFileObjectType
modelAsString: true
values:
- value: image_file
image_file:
type: object
properties:
file_id:
description: The File ID of the image in the message content.
type: string
required:
- index
- type
messageDeltaContentTextObject:
title: Text
type: object
description: The text content that is part of a message.
properties:
index:
type: integer
description: The index of the content part in the message.
type:
description: Always `text`.
type: string
enum: ["text"]
x-ms-enum:
name: MessageDeltaContentTextObjectType
modelAsString: true
values:
- value: text
text:
type: object
properties:
value:
description: The data that makes up the text.
type: string
annotations:
type: array
items:
oneOf:
- $ref: "#/components/schemas/messageDeltaContentTextAnnotationsFileCitationObject"
- $ref: "#/components/schemas/messageDeltaContentTextAnnotationsFilePathObject"
required:
- index
- type
messageDeltaContentTextAnnotationsFileCitationObject:
title: File citation
type: object
description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.
properties:
index:
type: integer
description: The index of the annotation in the text content part.
type:
description: Always `file_citation`.
type: string
enum: ["file_citation"]
x-ms-enum:
name: MessageDeltaContentTextAnnotationsFileCitationObjectType
modelAsString: true
values:
- value: file_citation
text:
description: The text in the message content that needs to be replaced.
type: string
file_citation:
type: object
properties:
file_id:
description: The ID of the specific File the citation is from.
type: string
quote:
description: The specific quote in the file.
type: string
start_index:
type: integer
minimum: 0
end_index:
type: integer
minimum: 0
required:
- index
- type
messageDeltaContentTextAnnotationsFilePathObject:
title: File path
type: object
description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.
properties:
index:
type: integer
description: The index of the annotation in the text content part.
type:
description: Always `file_path`.
type: string
enum: ["file_path"]
x-ms-enum:
name: MessageDeltaContentTextAnnotationsFilePathObjectType
modelAsString: true
values:
- value: file_path
text:
description: The text in the message content that needs to be replaced.
type: string
file_path:
type: object
properties:
file_id:
description: The ID of the file that was generated.
type: string
start_index:
type: integer
minimum: 0
end_index:
type: integer
minimum: 0
required:
- index
- type
runStepObject:
type: object
title: Run steps
description: |
Represents a step in execution of a run.
properties:
id:
description: The identifier of the run step, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `assistant.run.step``.
type: string
enum:
- assistant.run.step
x-ms-enum:
name: RunStepObjectType
modelAsString: true
values:
- value: assistant.run.step
description: The object type, which is always `assistant.run.step`
created_at:
description: The Unix timestamp (in seconds) for when the run step was created.
type: integer
assistant_id:
description: The ID of the assistant associated with the run step.
type: string
thread_id:
description: The ID of the [thread](/docs/api-reference/threads) that was run.
type: string
run_id:
description: The ID of the [run](/docs/api-reference/runs) that this run step is a part of.
type: string
type:
description: The type of run step, which can be either `message_creation` or `tool_calls`.
type: string
enum:
- message_creation
- tool_calls
x-ms-enum:
name: RunStepObjectType
modelAsString: true
values:
- value: message_creation
description: The message_creation run step
- value: tool_calls
description: The tool_calls run step
status:
description: The status of the run, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.
type: string
enum:
- in_progress
- cancelled
- failed
- completed
- expired
x-ms-enum:
name: RunStepObjectStatus
modelAsString: true
values:
- value: in_progress
description: The in_progress run status
- value: cancelled
description: The cancelled run status
- value: failed
description: The cancelled run status
- value: completed
description: The cancelled run status
- value: expired
description: The cancelled run status
step_details:
type: object
description: The details of the run step.
oneOf:
- $ref: "#/components/schemas/runStepDetailsMessageCreationObject"
- $ref: "#/components/schemas/runStepDetailsToolCallsObject"
last_error:
type: object
description: The last error associated with this run step. Will be `null` if there are no errors.
nullable: true
properties:
code:
type: string
description: One of `server_error` or `rate_limit_exceeded`.
enum:
- server_error
- rate_limit_exceeded
x-ms-enum:
name: LastErrorCode
modelAsString: true
values:
- value: server_error
description: The server_error
- value: rate_limit_exceeded
description: The rate_limit_exceeded status
message:
type: string
description: A human-readable description of the error.
required:
- code
- message
expired_at:
description: The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.
type: integer
nullable: true
cancelled_at:
description: The Unix timestamp (in seconds) for when the run step was cancelled.
type: integer
nullable: true
failed_at:
description: The Unix timestamp (in seconds) for when the run step failed.
type: integer
nullable: true
completed_at:
description: The Unix timestamp (in seconds) for when the run step completed.
type: integer
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
required:
- id
- object
- created_at
- assistant_id
- thread_id
- run_id
- type
- status
- step_details
- last_error
- expired_at
- cancelled_at
- failed_at
- completed_at
- metadata
runStepDeltaObject:
type: object
title: Run step delta object
description: |
Represents a run step delta i.e. any changed fields on a run step during streaming.
properties:
id:
description: The identifier of the run step, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `thread.run.step.delta`.
type: string
enum: ["thread.run.step.delta"]
x-ms-enum:
name: RunStepDeltaObjectType
modelAsString: true
values:
- value: thread.run.step.delta
delta:
description: The delta containing the fields that have changed on the run step.
type: object
properties:
step_details:
type: object
description: The details of the run step.
oneOf:
- $ref: "#/components/schemas/runStepDeltaStepDetailsMessageCreationObject"
- $ref: "#/components/schemas/runStepDeltaStepDetailsToolCallsObject"
required:
- id
- object
- delta
listRunStepsResponse:
properties:
object:
type: string
example: list
data:
type: array
items:
$ref: "#/components/schemas/runStepObject"
first_id:
type: string
example: step_hLBK7PXBv5Lr2NQT7KLY0ag1
last_id:
type: string
example: step_QLoItBbqwyAJEzlTy4y9kOMM
has_more:
type: boolean
example: false
required:
- object
- data
- first_id
- last_id
- has_more
runStepDetailsMessageCreationObject:
title: Message creation
type: object
description: Details of the message creation by the run step.
properties:
type:
description: Always `message_creation``.
type: string
enum:
- message_creation
x-ms-enum:
name: RunStepDetailsMessageCreationObjectType
modelAsString: true
values:
- value: message_creation
message_creation:
type: object
properties:
message_id:
type: string
description: The ID of the message that was created by this run step.
required:
- message_id
required:
- type
- message_creation
runStepDeltaStepDetailsMessageCreationObject:
title: Message creation
type: object
description: Details of the message creation by the run step.
properties:
type:
description: Always `message_creation`.
type: string
enum: ["message_creation"]
x-ms-enum:
name: RunStepDeltaStepDetailsMessageCreationObjectType
modelAsString: true
values:
- value: message_creation
message_creation:
type: object
properties:
message_id:
type: string
description: The ID of the message that was created by this run step.
required:
- type
runStepDetailsToolCallsObject:
title: Tool calls
type: object
description: Details of the tool call.
properties:
type:
description: Always `tool_calls`.
type: string
enum:
- tool_calls
x-ms-enum:
name: RunStepDetailsToolCallsObjectType
modelAsString: true
values:
- value: tool_calls
tool_calls:
type: array
description: |
An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval` or `function`.
items:
type: object
oneOf:
- $ref: "#/components/schemas/runStepDetailsToolCallsCodeObject"
- $ref: "#/components/schemas/runStepDetailsToolCallsFileSearchObject"
- $ref: "#/components/schemas/runStepDetailsToolCallsFunctionObject"
required:
- type
- tool_calls
runStepDeltaStepDetailsToolCallsObject:
title: Tool calls
type: object
description: Details of the tool call.
properties:
type:
description: Always `tool_calls`.
type: string
enum: ["tool_calls"]
x-ms-enum:
name: RunStepDeltaStepDetailsToolCallsObjectType
modelAsString: true
values:
- value: tool_calls
tool_calls:
type: array
description: |
An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search` or `function`.
items:
oneOf:
- $ref: "#/components/schemas/runStepDeltaStepDetailsToolCallsCodeObject"
- $ref: "#/components/schemas/runStepDeltaStepDetailsToolCallsFileSearchObject"
- $ref: "#/components/schemas/runStepDeltaStepDetailsToolCallsFunctionObject"
required:
- type
runStepDetailsToolCallsCodeObject:
title: Code interpreter tool call
type: object
description: Details of the Code Interpreter tool call the run step was involved in.
properties:
id:
type: string
description: The ID of the tool call.
type:
type: string
description: The type of tool call. This is always going to be `code_interpreter` for this type of tool call.
enum:
- code_interpreter
x-ms-enum:
name: RunStepDetailsToolCallsCodeObjectType
modelAsString: true
values:
- value: code_interpreter
code_interpreter:
type: object
description: The Code Interpreter tool call definition.
required:
- input
- outputs
properties:
input:
type: string
description: The input to the Code Interpreter tool call.
outputs:
type: array
description: The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.
items:
type: object
oneOf:
- $ref: "#/components/schemas/runStepDetailsToolCallsCodeOutputLogsObject"
- $ref: "#/components/schemas/runStepDetailsToolCallsCodeOutputImageObject"
required:
- id
- type
- code_interpreter
runStepDeltaStepDetailsToolCallsCodeObject:
title: Code interpreter tool call
type: object
description: Details of the Code Interpreter tool call the run step was involved in.
properties:
index:
type: integer
description: The index of the tool call in the tool calls array.
id:
type: string
description: The ID of the tool call.
type:
type: string
description: The type of tool call. This is always going to be `code_interpreter` for this type of tool call.
enum: ["code_interpreter"]
x-ms-enum:
name: RunStepDeltaStepDetailsToolCallsCodeObjectType
modelAsString: true
values:
- value: code_interpreter
code_interpreter:
type: object
description: The Code Interpreter tool call definition.
properties:
input:
type: string
description: The input to the Code Interpreter tool call.
outputs:
type: array
description: The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.
items:
type: object
oneOf:
- $ref: "#/components/schemas/runStepDeltaStepDetailsToolCallsCodeOutputLogsObject"
- $ref: "#/components/schemas/runStepDeltaStepDetailsToolCallsCodeOutputImageObject"
required:
- index
- type
runStepDetailsToolCallsCodeOutputLogsObject:
title: Code interpreter log output
type: object
description: Text output from the Code Interpreter tool call as part of a run step.
properties:
type:
description: Always `logs`.
type: string
enum:
- logs
x-ms-enum:
name: RunStepDetailsToolCallsCodeOutputLogsObjectType
modelAsString: true
values:
- value: logs
logs:
type: string
description: The text output from the Code Interpreter tool call.
required:
- type
- logs
runStepDeltaStepDetailsToolCallsCodeOutputLogsObject:
title: Code interpreter log output
type: object
description: Text output from the Code Interpreter tool call as part of a run step.
properties:
index:
type: integer
description: The index of the output in the outputs array.
type:
description: Always `logs`.
type: string
enum: ["logs"]
x-ms-enum:
name: RunStepDeltaStepDetailsToolCallsCodeOutputLogsObjectType
modelAsString: true
values:
- value: logs
logs:
type: string
description: The text output from the Code Interpreter tool call.
required:
- index
- type
runStepDetailsToolCallsCodeOutputImageObject:
title: Code interpreter image output
type: object
properties:
type:
description: Always `image`.
type: string
enum:
- image
x-ms-enum:
name: RunStepDetailsToolCallsCodeOutputImageObjectType
modelAsString: true
values:
- value: image
image:
type: object
properties:
file_id:
description: The file ID of the image.
type: string
required:
- file_id
required:
- type
- image
runStepDeltaStepDetailsToolCallsCodeOutputImageObject:
title: Code interpreter image output
type: object
properties:
index:
type: integer
description: The index of the output in the outputs array.
type:
description: Always `image`.
type: string
enum: ["image"]
x-ms-enum:
name: RunStepDeltaStepDetailsToolCallsCodeOutputImageObject
modelAsString: true
values:
- value: image
image:
type: object
properties:
file_id:
description: The file ID of the image.
type: string
required:
- index
- type
runStepDetailsToolCallsFileSearchObject:
title: File search tool call
type: object
properties:
id:
type: string
description: The ID of the tool call object.
type:
type: string
description: The type of tool call. This is always going to be `file_search` for this type of tool call.
enum: ["file_search"]
x-ms-enum:
name: RunStepDetailsToolCallsFileSearchObjectType
modelAsString: true
values:
- value: file_search
file_search:
type: object
description: For now, this is always going to be an empty object.
required:
- id
- type
- file_search
runStepDeltaStepDetailsToolCallsFileSearchObject:
title: File search tool call
type: object
properties:
index:
type: integer
description: The index of the tool call in the tool calls array.
id:
type: string
description: The ID of the tool call object.
type:
type: string
description: The type of tool call. This is always going to be `retrieval` for this type of tool call.
enum:
- file_search
x-ms-enum:
name: RunStepDeltaStepDetailsToolCallsFileSearchObjectType
modelAsString: true
values:
- value: file_search
file_search:
type: object
description: For now, this is always going to be an empty object.
required:
- index
- type
- file_search
runStepDetailsToolCallsFunctionObject:
type: object
title: Function tool call
properties:
id:
type: string
description: The ID of the tool call object.
type:
type: string
description: The type of tool call. This is always going to be `function` for this type of tool call.
enum:
- function
x-ms-enum:
name: RunStepDetailsToolCallsFunctionObjectType
modelAsString: true
values:
- value: function
function:
type: object
description: The definition of the function that was called.
properties:
name:
type: string
description: The name of the function.
arguments:
type: string
description: The arguments passed to the function.
output:
type: string
description: The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet.
nullable: true
required:
- name
- arguments
- output
required:
- id
- type
- function
runStepDeltaStepDetailsToolCallsFunctionObject:
type: object
title: Function tool call
properties:
index:
type: integer
description: The index of the tool call in the tool calls array.
id:
type: string
description: The ID of the tool call object.
type:
type: string
description: The type of tool call. This is always going to be `function` for this type of tool call.
enum: ["function"]
x-ms-enum:
name: RunStepDetailsToolCallsFunctionObjectType
modelAsString: true
values:
- value: function
function:
type: object
description: The definition of the function that was called.
properties:
name:
type: string
description: The name of the function.
arguments:
type: string
description: The arguments passed to the function.
output:
type: string
description: The output of the function. This will be `null` if the outputs have not been submitted yet.
nullable: true
required:
- index
- type
vectorStoreExpirationAfter:
type: object
title: Vector store expiration policy
description: The expiration policy for a vector store.
properties:
anchor:
description: "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`."
type: string
enum: ["last_active_at"]
x-ms-enum:
name: VectorStoreExpirationAfterAnchor
modelAsString: true
values:
- value: last_active_at
description: The anchor timestamp after which the expiration policy applies.
days:
description: The number of days after the anchor time that the vector store will expire.
type: integer
minimum: 1
maximum: 365
required:
- anchor
- days
vectorStoreObject:
type: object
title: Vector store
description: A vector store is a collection of processed files can be used by the `file_search` tool.
properties:
id:
description: The identifier, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `vector_store`.
type: string
enum: ["vector_store"]
created_at:
description: The Unix timestamp (in seconds) for when the vector store was created.
type: integer
name:
description: The name of the vector store.
type: string
usage_bytes:
description: The total number of bytes used by the files in the vector store.
type: integer
file_counts:
type: object
properties:
in_progress:
description: The number of files that are currently being processed.
type: integer
completed:
description: The number of files that have been successfully processed.
type: integer
failed:
description: The number of files that have failed to process.
type: integer
cancelled:
description: The number of files that were cancelled.
type: integer
total:
description: The total number of files.
type: integer
required:
- in_progress
- completed
- failed
- cancelled
- total
status:
description: The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
type: string
enum: ["expired", "in_progress", "completed"]
x-ms-enum:
name: VectorStoreObjectStatus
modelAsString: true
values:
- value: expired
- value: in_progress
- value: completed
expires_after:
$ref: "#/components/schemas/vectorStoreExpirationAfter"
expires_at:
description: The Unix timestamp (in seconds) for when the vector store will expire.
type: integer
nullable: true
last_active_at:
description: The Unix timestamp (in seconds) for when the vector store was last active.
type: integer
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
required:
- id
- object
- usage_bytes
- created_at
- status
- last_active_at
- name
- bytes
- file_counts
- metadata
createVectorStoreRequest:
type: object
additionalProperties: false
properties:
file_ids:
description: A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files.
type: array
maxItems: 500
items:
type: string
name:
description: The name of the vector store.
type: string
expires_after:
$ref: "#/components/schemas/vectorStoreExpirationAfter"
chunking_strategy:
type: object
description: >-
The chunking strategy used to chunk the file(s). If not set, will use the
`auto` strategy. Only applicable if `file_ids` is non-empty.
oneOf:
- $ref: "#/components/schemas/autoChunkingStrategyRequestParam"
- $ref: "#/components/schemas/staticChunkingStrategyRequestParam"
metadata:
description: *metadata_description
type: object
nullable: true
updateVectorStoreRequest:
type: object
additionalProperties: false
properties:
name:
description: The name of the vector store.
type: string
nullable: true
expires_after:
$ref: "#/components/schemas/vectorStoreExpirationAfter"
nullable: true
metadata:
description: *metadata_description
type: object
nullable: true
listVectorStoresResponse:
properties:
object:
type: string
example: "list"
data:
type: array
items:
$ref: "#/components/schemas/vectorStoreObject"
first_id:
type: string
example: "vs_abc123"
last_id:
type: string
example: "vs_abc456"
has_more:
type: boolean
example: false
required:
- object
- data
- first_id
- last_id
- has_more
deleteVectorStoreResponse:
type: object
properties:
id:
type: string
deleted:
type: boolean
object:
type: string
enum: [vector_store.deleted]
x-ms-enum:
name: DeleteVectorStoreResponseObject
modelAsString: true
values:
- value: vector_store.deleted
description: The delete vector store response object state
required:
- id
- object
- deleted
vectorStoreFileObject:
type: object
title: Vector store files
description: A list of files attached to a vector store.
properties:
id:
description: The identifier, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `vector_store.file`.
type: string
enum: ["vector_store.file"]
x-ms-enum:
name: VectorStoreFileObjectType
modelAsString: true
values:
- value: vector_store.file
usage_bytes:
description: The total vector store usage in bytes. Note that this may be different from the original file size.
type: integer
created_at:
description: The Unix timestamp (in seconds) for when the vector store file was created.
type: integer
vector_store_id:
description: The ID of the vector store that the file is attached to.
type: string
status:
description: The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
type: string
enum: ["in_progress", "completed", "cancelled", "failed"]
x-ms-enum:
name: VectorStoreFileObjectStatus
modelAsString: true
values:
- value: in_progress
- value: completed
- value: cancelled
- value: failed
last_error:
type: object
description: The last error associated with this vector store file. Will be `null` if there are no errors.
nullable: true
properties:
code:
type: string
description: One of `server_error` or `rate_limit_exceeded`.
enum:
[
"internal_error",
"file_not_found",
"parsing_error",
"unhandled_mime_type",
]
x-ms-enum:
name: VectorStoreFileObjectLastErrorCode
modelAsString: true
values:
- value: internal_error
- value: file_not_found
- value: parsing_error
- value: unhandled_mime_type
message:
type: string
description: A human-readable description of the error.
required:
- code
- message
chunking_strategy:
type: object
description: |
The chunking strategy used to chunk the file(s). If not set, will use the
`auto` strategy. Only applicable if `file_ids` is non-empty.
oneOf:
- $ref: "#/components/schemas/autoChunkingStrategyRequestParam"
- $ref: "#/components/schemas/staticChunkingStrategyRequestParam"
required:
- id
- object
- usage_bytes
- created_at
- vector_store_id
- status
- last_error
otherChunkingStrategyResponseParam:
type: object
title: Other Chunking Strategy
description: |
This is returned when the chunking strategy is unknown. Typically, this is
because the file was indexed before the `chunking_strategy` concept was
introduced in the API.
additionalProperties: false
properties:
type:
type: string
description: Always `other`.
enum:
- other
x-ms-enum:
name: OtherChunkingStrategyResponseParamType
modelAsString: true
values:
- value: other
required:
- type
staticChunkingStrategyResponseParam:
type: object
title: Static Chunking Strategy
additionalProperties: false
properties:
type:
type: string
description: Always `static`.
enum:
- static
x-ms-enum:
name: StaticChunkingStrategyResponseParamType
modelAsString: true
values:
- value: static
static:
$ref: "#/components/schemas/staticChunkingStrategy"
required:
- type
- static
staticChunkingStrategy:
type: object
additionalProperties: false
properties:
max_chunk_size_tokens:
type: integer
minimum: 100
maximum: 4096
description: |
The maximum number of tokens in each chunk. The default value is `800`.
The minimum value is `100` and the maximum value is `4096`.
chunk_overlap_tokens:
type: integer
description: >
The number of tokens that overlap between chunks. The default value is
`400`.
Note that the overlap must not exceed half of `max_chunk_size_tokens`.
required:
- max_chunk_size_tokens
- chunk_overlap_tokens
autoChunkingStrategyRequestParam:
type: object
title: Auto Chunking Strategy
description: |
The default strategy. This strategy currently uses a `max_chunk_size_tokens`
of `800` and `chunk_overlap_tokens` of `400`.
additionalProperties: false
properties:
type:
type: string
description: Always `auto`.
enum:
- auto
required:
- type
staticChunkingStrategyRequestParam:
type: object
title: Static Chunking Strategy
additionalProperties: false
properties:
type:
type: string
description: Always `static`.
enum:
- static
static:
$ref: "#/components/schemas/staticChunkingStrategy"
required:
- type
- static
chunkingStrategyRequestParam:
type: object
description: >-
The chunking strategy used to chunk the file(s). If not set, will use the
`auto` strategy.
oneOf:
- $ref: "#/components/schemas/autoChunkingStrategyRequestParam"
- $ref: "#/components/schemas/staticChunkingStrategyRequestParam"
createVectorStoreFileRequest:
type: object
additionalProperties: false
properties:
file_id:
description: A File ID that the vector store should use. Useful for tools like `file_search` that can access files.
type: string
chunking_strategy:
$ref: "#/components/schemas/chunkingStrategyRequestParam"
required:
- file_id
listVectorStoreFilesResponse:
properties:
object:
type: string
example: "list"
data:
type: array
items:
$ref: "#/components/schemas/vectorStoreFileObject"
first_id:
type: string
example: "file-abc123"
last_id:
type: string
example: "file-abc456"
has_more:
type: boolean
example: false
required:
- object
- data
- first_id
- last_id
- has_more
deleteVectorStoreFileResponse:
type: object
properties:
id:
type: string
deleted:
type: boolean
object:
type: string
enum: [vector_store.file.deleted]
x-ms-enum:
name: DeleteVectorStoreFileResponseObject
modelAsString: true
values:
- value: vector_store.file.deleted
required:
- id
- object
- deleted
vectorStoreFileBatchObject:
type: object
title: Vector store file batch
description: A batch of files attached to a vector store.
properties:
id:
description: The identifier, which can be referenced in API endpoints.
type: string
object:
description: The object type, which is always `vector_store.file_batch`.
type: string
enum: ["vector_store.files_batch"]
x-ms-enum:
name: VectorStoreFileBatchObjectType
modelAsString: true
values:
- value: vector_store.files_batch
created_at:
description: The Unix timestamp (in seconds) for when the vector store files batch was created.
type: integer
vector_store_id:
description: The ID of the vector store that the File is attached to.
type: string
status:
description: The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.
type: string
enum: ["in_progress", "completed", "cancelled", "failed"]
x-ms-enum:
name: VectorStoreFileBatchObjectStatus
modelAsString: true
values:
- value: in_progress
- value: completed
- value: cancelled
- value: failed
file_counts:
type: object
properties:
in_progress:
description: The number of files that are currently being processed.
type: integer
completed:
description: The number of files that have been processed.
type: integer
failed:
description: The number of files that have failed to process.
type: integer
cancelled:
description: The number of files that where cancelled.
type: integer
total:
description: The total number of files.
type: integer
required:
- in_progress
- completed
- cancelled
- failed
- total
required:
- id
- object
- created_at
- vector_store_id
- status
- file_counts
createVectorStoreFileBatchRequest:
type: object
additionalProperties: false
properties:
file_ids:
description: A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files.
type: array
minItems: 1
maxItems: 500
items:
type: string
chunking_strategy:
$ref: "#/components/schemas/chunkingStrategyRequestParam"
required:
- file_ids
assistantStreamEvent:
description: |
Represents an event emitted when streaming a Run.
Each event in a server-sent events stream has an `event` and `data` property:
```
event: thread.created
data: {"id": "thread_123", "object": "thread", ...}
```
We emit events whenever a new object is created, transitions to a new state, or is being
streamed in parts (deltas). For example, we emit `thread.run.created` when a new run
is created, `thread.run.completed` when a run completes, and so on. When an Assistant chooses
to create a message during a run, we emit a `thread.message.created event`, a
`thread.message.in_progress` event, many `thread.message.delta` events, and finally a
`thread.message.completed` event.
We may add additional events over time, so we recommend handling unknown events gracefully
in your code. See the [Assistants API quickstart](/docs/assistants/overview) to learn how to
integrate the Assistants API with streaming.
oneOf:
- $ref: "#/components/schemas/threadStreamEvent"
- $ref: "#/components/schemas/runStreamEvent"
- $ref: "#/components/schemas/runStepStreamEvent"
- $ref: "#/components/schemas/messageStreamEvent"
- $ref: "#/components/schemas/errorEvent"
- $ref: "#/components/schemas/doneEvent"
threadStreamEvent:
oneOf:
- type: object
properties:
event:
type: string
enum: ["thread.created"]
x-ms-enum:
name: ThreadStreamEventEnum
modelAsString: true
values:
- value: thread.created
description: The thread created event
data:
$ref: "#/components/schemas/threadObject"
required:
- event
- data
description: Occurs when a new thread is created.
runStreamEvent:
oneOf:
- type: object
properties:
event:
type: string
enum: ["thread.run.created"]
x-ms-enum:
name: RunStreamEventCreated
modelAsString: true
values:
- value: thread.run.created
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a new run is created.
- type: object
properties:
event:
type: string
enum: ["thread.run.queued"]
x-ms-enum:
name: RunStreamEventQueued
modelAsString: true
values:
- value: thread.run.queued
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a run moves to a `queued` status.
- type: object
properties:
event:
type: string
enum: ["thread.run.in_progress"]
x-ms-enum:
name: RunStreamEventInProgress
modelAsString: true
values:
- value: thread.run.in_progress
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a run moves to an `in_progress` status.
- type: object
properties:
event:
type: string
enum: ["thread.run.requires_action"]
x-ms-enum:
name: RunStreamEventRequiresAction
modelAsString: true
values:
- value: thread.run.requires_action
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a run moves to a `requires_action` status.
- type: object
properties:
event:
type: string
enum: ["thread.run.completed"]
x-ms-enum:
name: RunStreamEventCompleted
modelAsString: true
values:
- value: thread.run.completed
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a run is completed.
- type: object
properties:
event:
type: string
enum: ["thread.run.failed"]
x-ms-enum:
name: RunStreamEventFailed
modelAsString: true
values:
- value: thread.run.failed
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a run fails.
- type: object
properties:
event:
type: string
enum: ["thread.run.cancelling"]
x-ms-enum:
name: RunStreamEventCancelling
modelAsString: true
values:
- value: thread.run.cancelling
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a run moves to a `cancelling` status.
- type: object
properties:
event:
type: string
enum: ["thread.run.cancelled"]
x-ms-enum:
name: RunStreamEventCancelled
modelAsString: true
values:
- value: thread.run.cancelled
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a run is cancelled.
- type: object
properties:
event:
type: string
enum: ["thread.run.expired"]
x-ms-enum:
name: RunStreamEventExpired
modelAsString: true
values:
- value: thread.run.expired
data:
$ref: "#/components/schemas/runObject"
required:
- event
- data
description: Occurs when a run expires.
runStepStreamEvent:
oneOf:
- type: object
properties:
event:
type: string
enum: ["thread.run.step.created"]
x-ms-enum:
name: RunStepStreamEventCreated
modelAsString: true
values:
- value: thread.run.step.created
data:
$ref: "#/components/schemas/runStepObject"
required:
- event
- data
description: Occurs when a run step is created.
- type: object
properties:
event:
type: string
enum: ["thread.run.step.in_progress"]
x-ms-enum:
name: RunStepStreamEventInProgress
modelAsString: true
values:
- value: thread.run.step.in_progress
data:
$ref: "#/components/schemas/runStepObject"
required:
- event
- data
description: Occurs when a run step moves to an `in_progress` state.
- type: object
properties:
event:
type: string
enum: ["thread.run.step.delta"]
x-ms-enum:
name: RunStepStreamEventDelta
modelAsString: true
values:
- value: thread.run.step.delta
data:
$ref: "#/components/schemas/runStepDeltaObject"
required:
- event
- data
description: Occurs when parts of a run step are being streamed.
- type: object
properties:
event:
type: string
enum: ["thread.run.step.completed"]
x-ms-enum:
name: RunStepStreamEventCompleted
modelAsString: true
values:
- value: thread.run.step.completed
data:
$ref: "#/components/schemas/runStepObject"
required:
- event
- data
description: Occurs when a run step is completed.
- type: object
properties:
event:
type: string
enum: ["thread.run.step.failed"]
x-ms-enum:
name: RunStepStreamEventFailed
modelAsString: true
values:
- value: thread.run.step.failed
data:
$ref: "#/components/schemas/runStepObject"
required:
- event
- data
description: Occurs when a run step fails.
- type: object
properties:
event:
type: string
enum: ["thread.run.step.cancelled"]
x-ms-enum:
name: RunStepStreamEventCancelled
modelAsString: true
values:
- value: thread.run.step.cancelled
data:
$ref: "#/components/schemas/runStepObject"
required:
- event
- data
description: Occurs when a run step is cancelled.
- type: object
properties:
event:
type: string
enum: ["thread.run.step.expired"]
x-ms-enum:
name: RunStepStreamEventExpired
modelAsString: true
values:
- value: thread.run.step.expired
data:
$ref: "#/components/schemas/runStepObject"
required:
- event
- data
description: Occurs when a run step expires.
messageStreamEvent:
oneOf:
- type: object
properties:
event:
type: string
enum: ["thread.message.created"]
x-ms-enum:
name: MessageStreamEventCreated
modelAsString: true
values:
- value: thread.message.created
data:
$ref: "#/components/schemas/messageObject"
required:
- event
- data
description: Occurs when a message is created.
- type: object
properties:
event:
type: string
enum: ["thread.message.in_progress"]
x-ms-enum:
name: MessageStreamEventInProgress
modelAsString: true
values:
- value: thread.message.in_progress
data:
$ref: "#/components/schemas/messageObject"
required:
- event
- data
description: Occurs when a message moves to an `in_progress` state.
- type: object
properties:
event:
type: string
enum: ["thread.message.delta"]
x-ms-enum:
name: MessageStreamEventDelta
modelAsString: true
values:
- value: thread.message.delta
data:
$ref: "#/components/schemas/messageDeltaObject"
required:
- event
- data
description: Occurs when parts of a message are being streamed.
- type: object
properties:
event:
type: string
enum: ["thread.message.completed"]
x-ms-enum:
name: MessageStreamEventCompleted
modelAsString: true
values:
- value: thread.message.completed
data:
$ref: "#/components/schemas/messageObject"
required:
- event
- data
description: Occurs when a message is completed.
- type: object
properties:
event:
type: string
enum: ["thread.message.incomplete"]
x-ms-enum:
name: MessageStreamEventIncomplete
modelAsString: true
values:
- value: thread.message.incomplete
data:
$ref: "#/components/schemas/messageObject"
required:
- event
- data
description: Occurs when a message ends before it is completed.
errorEvent:
type: object
properties:
event:
type: string
enum: ["error"]
x-ms-enum:
name: ErrorEventEnum
modelAsString: true
values:
- value: error
data:
$ref: "#/components/schemas/error"
required:
- event
- data
description: Occurs when an error occurs. This can happen due to an internal server error or a timeout.
doneEvent:
type: object
properties:
event:
type: string
enum: ["done"]
x-ms-enum:
name: DoneEventEnum
modelAsString: true
values:
- value: done
data:
type: string
enum: ["[DONE]"]
x-ms-enum:
name: DoneEventDataEnum
modelAsString: true
values:
- value: "[DONE]"
required:
- event
- data
description: Occurs when a stream ends.
securitySchemes:
bearer:
type: oauth2
flows:
implicit:
authorizationUrl: https://login.microsoftonline.com/common/oauth2/v2.0/authorize
scopes: {}
x-tokenInfoFunc: api.middleware.auth.bearer_auth
x-scopeValidateFunc: api.middleware.auth.validate_scopes
apiKey:
type: apiKey
name: api-key
in: header