From 9c7347406ba5209df66d6285196ff9e64a2d07d7 Mon Sep 17 00:00:00 2001 From: Travis Wilson Date: Mon, 1 Apr 2024 18:15:50 -0700 Subject: [PATCH 01/25] initial commit for models in support of streaming Assistants calls --- specification/ai/OpenAI.Assistants/client.tsp | 11 + .../create_assistant.json | 4 + specification/ai/OpenAI.Assistants/main.tsp | 4 + .../ai/OpenAI.Assistants/messages/models.tsp | 203 + .../ai/OpenAI.Assistants/run_steps/models.tsp | 178 + .../ai/OpenAI.Assistants/runs/models.tsp | 14 + .../ai/OpenAI.Assistants/runs/routes.tsp | 2 + .../assistants_generated.json | 3678 +++++++++++++++++ .../assistants_generated.yaml | 1 + .../assistants_generated.yaml | 3016 ++++++++++++++ 10 files changed, 7111 insertions(+) create mode 100644 specification/ai/OpenAI.Assistants/examples/placeholder-for-future-release/create_assistant.json create mode 100644 specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json create mode 100644 specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml diff --git a/specification/ai/OpenAI.Assistants/client.tsp b/specification/ai/OpenAI.Assistants/client.tsp index 0b74d087a646..d1e651bbab53 100644 --- a/specification/ai/OpenAI.Assistants/client.tsp +++ b/specification/ai/OpenAI.Assistants/client.tsp @@ -146,6 +146,17 @@ namespace Azure.AI.OpenAI.Assistants; @@usage(MessageTextFileCitationAnnotation, Usage.output); @@usage(MessageTextFilePathAnnotation, Usage.output); +// Ensure generator inclusion of streaming "leaf" types not yet referenced by a route + +@@usage(MessageDeltaTextFileCitationAnnotation, Usage.output); +@@usage(MessageDeltaTextFilePathAnnotation, Usage.output); +@@usage(MessageDeltaImageFileContent, Usage.output); +@@usage(MessageDeltaTextContent, Usage.output); +@@usage(RunStepDeltaMessageCreationObject, Usage.output); +@@usage(RunStepDeltaFunction, Usage.output); +@@usage(RunStepDeltaCodeInterpreterLogOutput, Usage.output); +@@usage(RunStepDeltaCodeInterpreterImageOutputObject, Usage.output); + // Ensure some shared types remain public despite interaction with previously internalized details @@access(MessageTextFilePathAnnotation, Access.public); diff --git a/specification/ai/OpenAI.Assistants/examples/placeholder-for-future-release/create_assistant.json b/specification/ai/OpenAI.Assistants/examples/placeholder-for-future-release/create_assistant.json new file mode 100644 index 000000000000..24f1208ac3df --- /dev/null +++ b/specification/ai/OpenAI.Assistants/examples/placeholder-for-future-release/create_assistant.json @@ -0,0 +1,4 @@ +{ + "title": "Assistants_CreateAssistant", + "operationId": "Assistants_CreateAssistant" +} diff --git a/specification/ai/OpenAI.Assistants/main.tsp b/specification/ai/OpenAI.Assistants/main.tsp index b8113066df16..8c96005022e5 100644 --- a/specification/ai/OpenAI.Assistants/main.tsp +++ b/specification/ai/OpenAI.Assistants/main.tsp @@ -43,4 +43,8 @@ enum ServiceApiVersions { @useDependency(Azure.Core.Versions.v1_0_Preview_2) @doc("The initial version of Azure OpenAI Assistants that corresponds to functionality in OpenAI's first beta release.") v2024_02_15_preview: "2024-02-15-preview", + + @useDependency(Azure.Core.Versions.v1_0_Preview_2) + @doc("For code review purposes only. To be replaced with an intended upcoming version label when available.") + vFuturePlaceholder: "placeholder-for-future-release", } diff --git a/specification/ai/OpenAI.Assistants/messages/models.tsp b/specification/ai/OpenAI.Assistants/messages/models.tsp index 902cfa8f291b..cc142c4f732d 100644 --- a/specification/ai/OpenAI.Assistants/messages/models.tsp +++ b/specification/ai/OpenAI.Assistants/messages/models.tsp @@ -41,6 +41,30 @@ model ThreadMessage { @doc("The ID of the thread that this message belongs to.") threadId: string; + /** The status of the message. */ + @added(ServiceApiVersions.vFuturePlaceholder) + status: MessageStatus; + + /** On an incomplete message, details about why the message is incomplete. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "incomplete_details") + @added(ServiceApiVersions.vFuturePlaceholder) + incompleteDetails: MessageIncompleteDetailsReason | null; + + /** The Unix timestamp (in seconds) for when the message was completed. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encode(DateTimeKnownEncoding.unixTimestamp, int32) + @encodedName("application/json", "completed_at") + @added(ServiceApiVersions.vFuturePlaceholder) + completedAt: utcDateTime | null; + + /** The Unix timestamp (in seconds) for when the message was marked as incomplete. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encode(DateTimeKnownEncoding.unixTimestamp, int32) + @encodedName("application/json", "incomplete_at") + @added(ServiceApiVersions.vFuturePlaceholder) + incompleteAt: utcDateTime | null; + @doc("The role associated with the assistant thread message.") role: MessageRole; @@ -207,3 +231,182 @@ model MessageFile { @doc("The ID of the message that this file is attached to.") messageId: string; } + +/** The possible execution status values for a thread message. */ +@added(ServiceApiVersions.vFuturePlaceholder) +enum MessageStatus { + /** A run is currently creating this message. */ + inProgress: "in_progress", + + /** This message is incomplete. See incomplete_details for more information. */ + incomplete: "incomplete", + + /** This message was successfully completed by a run. */ + completed: "completed", +} + +/** Information providing additional detail about a message entering an incomplete status. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageIncompleteDetails { + /** The provided reason describing why the message was marked as incomplete. */ + reason: MessageIncompleteDetailsReason; +} + +/** A set of reasons describing why a message is marked as incomplete. */ +@added(ServiceApiVersions.vFuturePlaceholder) +enum MessageIncompleteDetailsReason { + /** The run generating the message was terminated due to content filter flagging. */ + contentFilter: "content_filter", + + /** The run generating the message exhausted available tokens before completion. */ + maxTokens: "max_tokens", + + /** The run generating the message was cancelled before completion. */ + runCancelled: "run_cancelled", + + /** The run generating the message failed. */ + runFailed: "run_failed", +} + +// +// These types are specifically used for streaming. +// + +/** Represents a message delta i.e. any changed fields on a message during streaming. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaChunk { + /** The identifier of the message, which can be referenced in API endpoints. */ + id: string; + + /** The object type, which is always `thread.message.delta`. */ + object: "thread.message.delta"; + + /** The delta containing the fields that have changed on the Message. */ + delta: MessageDelta; +} + +/** Represents the typed 'delta' payload within a streaming message delta chunk. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDelta { + /** The entity that produced the message. */ + role: MessageRole; + + /** The content of the message as an array of text and/or images. */ + content: MessageDeltaContent[]; + + /** A list of file IDs that the assistant can use. */ + @encodedName("application/json", "file_ids") + fileIds?: string[] = []; +} + +/** The abstract base representation of a partial streamed message content payload. */ +@discriminator("type") +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaContent { + /** The index of the content part of the message. */ + index: int32; + + /** The type of content for this content part. */ + type: string; +} + +/** Represents a streamed image file content part within a streaming message delta chunk. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaImageFileContent extends MessageDeltaContent { + /** The type of content for this content part, which is always "image_file." */ + type: "image_file"; + + /** The image_file data. */ + @encodedName("application/json", "image_file") + imageFile?: MessageDeltaImageFileContentObject; +} + +/** Represents the 'image_file' payload within streaming image file content. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaImageFileContentObject { + /** The file ID of the image in the message content. */ + @encodedName("application/json", "file_id") + fileId?: string; +} + +/** Represents a streamed text content part within a streaming message delta chunk. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaTextContentObject extends MessageDeltaContent { + /** The type of content for this content part, which is always "text." */ + type: "text"; + + /** The text content details. */ + text: MessageDeltaTextContent; +} + +/** Represents the data of a streamed text content part within a streaming message delta chunk. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaTextContent { + /** The data that makes up the text. */ + value?: string; + + /** Annotations for the text. */ + annotations?: MessageDeltaTextAnnotation[]; +} + +/** The abstract base representation of a streamed text content part's text annotation. */ +@discriminator("type") +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaTextAnnotation { + /** The index of the annotation within a text content part. */ + index: int32; + + /** The type of the text content annotation. */ + type: string; + + /** The start index of this annotation in the content text. */ + @encodedName("application/json", "start_index") + startIndex: int32; + + /** The end index of this annotation in the content text. */ + @encodedName("application/json", "end_index") + endIndex: int32; +} + +/** Represents a streamed file citation applied to a streaming text content part. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaTextFileCitationAnnotationObject + extends MessageDeltaTextAnnotation { + /** The type of the text content annotation, which is always "file_citation." */ + type: "file_citation"; + + /** The file citation information. */ + @encodedName("application/json", "file_citation") + fileCitation?: MessageDeltaTextFileCitationAnnotationObject; +} + +/** Represents the data of a streamed file citation as applied to a streaming text content part. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaTextFileCitationAnnotation { + /** The ID of the specific file the citation is from. */ + @encodedName("application/json", "file_id") + fileId?: string; + + /** The specific quote in the cited file. */ + quote?: string; +} + +/** Represents a streamed file path annotation applied to a streaming text content part. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaTextFilePathAnnotationObject + extends MessageDeltaTextAnnotation { + /** The type of the text content annotation, which is always "file_path." */ + type: "file_path"; + + /** The file path information. */ + @encodedName("application/json", "file_path") + filePath?: MessageDeltaTextFilePathAnnotationObject; +} + +/** Represents the data of a streamed file path annotation as applied to a streaming text content part. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model MessageDeltaTextFilePathAnnotation { + /** The file ID for the annotation. */ + @encodedName("application/json", "file_id") + fileId?: string; +} diff --git a/specification/ai/OpenAI.Assistants/run_steps/models.tsp b/specification/ai/OpenAI.Assistants/run_steps/models.tsp index 396ba9abe570..6c7f00dbc816 100644 --- a/specification/ai/OpenAI.Assistants/run_steps/models.tsp +++ b/specification/ai/OpenAI.Assistants/run_steps/models.tsp @@ -165,3 +165,181 @@ model RunStepError { @doc("The human-readable text associated with this error.") message: string; } + +// +// The following types facilitate streaming use. +// + +/** Represents a run step delta i.e. any changed fields on a run step during streaming. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaChunk { + /** The identifier of the run step, which can be referenced in API endpoints. */ + id: string; + + /** The object type, which is always `thread.run.step.delta`. */ + object: "thread.run.step.delta"; + + /** The delta containing the fields that have changed on the run step. */ + delta: RunStepDeltaChunkObject; +} + +/** Represents the delta payload in a streaming run step delta chunk. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaChunkObject { + /** The details of the run step. */ + @encodedName("application/json", "step_details") + stepDetails?: RunStepDeltaDetail[]; +} + +/** Represents a single run step detail item in a streaming run step's delta payload. */ +@discriminator("type") +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaDetail { + /** The object type for the run step detail object. */ + type: string; +} + +/** Represents a message creation within a streaming run step delta. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaMessageCreation extends RunStepDeltaDetail { + /** The object type, which is always "message_creation." */ + type: "message_creation"; + + /** The message creation data. */ + @encodedName("application/json", "message_creation") + messageCreation: RunStepDeltaMessageCreationObject; +} + +/** Represents the data within a streaming run step message creation response object. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaMessageCreationObject { + /** The ID of the newly-created message. */ + @encodedName("application/json", "message_id") + messageId?: string; +} + +/** Represents an invocation of tool calls as part of a streaming run step. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaToolCallObject extends RunStepDeltaDetail { + /** The object type, which is always "tool_calls." */ + type: "tool_calls"; + + /** The collection of tool calls for the tool call detail item. */ + @encodedName("application/json", "tool_calls") + toolCalls?: RunStepDeltaToolCall[]; +} + +/** The abstract base representation of a single tool call within a streaming run step's delta tool call details. */ +@discriminator("type") +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaToolCall { + /** The index of the tool call detail in the run step's tool_calls array. */ + index: int32; + + /** The ID of the tool call, used when submitting outputs to the run. */ + id: string; + + /** The type of the tool call detail item in a streaming run step's details. */ + type: string; +} + +/** Represents a function tool call within a streaming run step's tool call details. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaFunctionToolCall extends RunStepDeltaToolCall { + /** The object type, which is always "function." */ + type: "function"; + + /** The function data for the tool call. */ + function?: RunStepDeltaFunction; +} + +/** Represents a retrieval tool call within a streaming run step's tool call details. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaRetrievalToolCall extends RunStepDeltaToolCall { + /** The object type, which is always "retrieval." */ + type: "retrieval"; + + /** Reserved for future use. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + retrieval?: Record | null; +} + +/** Represents a Code Interpreter tool call within a streaming run step's tool call details. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCall { + /** The object type, which is always "code_interpreter." */ + type: "code_interpreter"; + + /** The Code Interpreter data for the tool call. */ + @encodedName("application/json", "code_interpreter") + codeInterpreter?: RunStepDeltaCodeInterpreterDetailItemObject; +} + +/** Represents the function data in a streaming run step delta's function tool call. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaFunction { + /** The name of the function. */ + name: string; + + /** The arguments passed to the function as input. */ + arguments: string; + + /** The output of the function, null if outputs have not yet been submitted. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + output: string | null; +} + +/** Represents the Code Interpreter tool call data in a streaming run step's tool calls. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaCodeInterpreterDetailItemObject { + /** The input into the Code Interpreter tool call. */ + input: string; + + /** + * 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. + */ + outputs?: RunStepDeltaCodeInterpreterOutput[]; +} + +/** The abstract base representation of a streaming run step tool call's Code Interpreter tool output. */ +@added(ServiceApiVersions.vFuturePlaceholder) +@discriminator("type") +model RunStepDeltaCodeInterpreterOutput { + /** The index of the output in the streaming run step tool call's Code Interpreter outputs array. */ + index: int32; + + /** The type of the streaming run step tool call's Code Interpreter output. */ + type: string; +} + +/** Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaCodeInterpreterLogOutput + extends RunStepDeltaCodeInterpreterOutput { + /** The type of the object, which is always "logs." */ + type: "logs"; + + /** The text output from the Code Interpreter tool call. */ + logs?: string; +} + +/** Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaCodeInterpreterImageOutput + extends RunStepDeltaCodeInterpreterOutput { + /** The object type, which is always "image." */ + type: "image"; + + /** The image data for the Code Interpreter tool call output. */ + image?: RunStepDeltaCodeInterpreterImageOutputObject; +} + +/** Represents the data for a streaming run step's Code Interpreter tool call image output. */ +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepDeltaCodeInterpreterImageOutputObject { + /** The file ID for the image. */ + @encodedName("application/json", "file_id") + fileId?: string; +} diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index 45d793556490..ee98ee4f5b1c 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -125,6 +125,13 @@ model CreateRunOptions { @doc("The overridden list of enabled tools that the assistant should use to run the thread.") tools?: ToolDefinition[] | null; + /** + * 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. + */ + @added(ServiceApiVersions.vFuturePlaceholder) + stream?: boolean; + ...OptionalNullableMetadata; } @@ -217,5 +224,12 @@ model CreateAndRunThreadOptions { @clientName("overrideTools", "csharp") tools?: ToolDefinition[]; + /** + * 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. + */ + @added(ServiceApiVersions.vFuturePlaceholder) + stream?: boolean; + ...OptionalNullableMetadata; } diff --git a/specification/ai/OpenAI.Assistants/runs/routes.tsp b/specification/ai/OpenAI.Assistants/runs/routes.tsp index 1a4f417b33db..23e5eb09aa15 100644 --- a/specification/ai/OpenAI.Assistants/runs/routes.tsp +++ b/specification/ai/OpenAI.Assistants/runs/routes.tsp @@ -90,6 +90,7 @@ op updateRun( * @param threadId The ID of the thread that was run. * @param runId The ID of the run that requires tool outputs. * @param toolOutputs The list of tool outputs requested by tool calls from the specified run. + * @param stream 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. * @returns Updated information about the run. */ #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" @@ -102,6 +103,7 @@ op submitToolOutputsToRun( @path threadId: string, @path runId: string, @encodedName("application/json", "tool_outputs") toolOutputs: ToolOutput[], + @added(ServiceApiVersions.vFuturePlaceholder) stream?: boolean, ): ThreadRun; /** diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json new file mode 100644 index 000000000000..983a1b09f4d5 --- /dev/null +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json @@ -0,0 +1,3678 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure OpenAI", + "version": "placeholder-for-future-release", + "description": "Azure OpenAI APIs for Assistants.", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "name": "endpoint", + "in": "path", + "description": "An OpenAI endpoint supporting assistants functionality.", + "required": true, + "type": "string" + } + ] + }, + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "security": [ + { + "ApiKeyAuth": [] + }, + { + "OAuth2Auth": [ + "https://cognitiveservices.azure.com/.default" + ] + } + ], + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "api-key", + "in": "header" + }, + "OAuth2Auth": { + "type": "oauth2", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + "scopes": { + "https://cognitiveservices.azure.com/.default": "" + } + } + }, + "tags": [], + "paths": { + "/assistants": { + "get": { + "operationId": "ListAssistants", + "description": "Gets a list of assistants that were previously created.", + "parameters": [ + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of assistants.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/Assistant" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + }, + "post": { + "operationId": "CreateAssistant", + "description": "Creates a new assistant.", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AssistantCreationOptions" + } + } + ], + "responses": { + "200": { + "description": "The new assistant instance.", + "schema": { + "$ref": "#/definitions/Assistant" + } + } + } + } + }, + "/assistants/{assistantId}": { + "get": { + "operationId": "GetAssistant", + "description": "Retrieves an existing assistant.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested assistant instance.", + "schema": { + "$ref": "#/definitions/Assistant" + } + } + } + }, + "post": { + "operationId": "UpdateAssistant", + "description": "Modifies an existing assistant.", + "parameters": [ + { + "$ref": "#/parameters/UpdateAssistantOptions.assistantId" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAssistantOptions" + } + } + ], + "responses": { + "200": { + "description": "The updated assistant instance.", + "schema": { + "$ref": "#/definitions/Assistant" + } + } + } + }, + "delete": { + "operationId": "DeleteAssistant", + "description": "Deletes an assistant.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to delete.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Status information about the requested deletion operation.", + "schema": { + "$ref": "#/definitions/AssistantDeletionStatus" + } + } + } + } + }, + "/assistants/{assistantId}/files": { + "get": { + "operationId": "ListAssistantFiles", + "description": "Gets a list of files attached to a specific assistant, as used by tools that can read files.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to retrieve the list of attached files for.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of files attached to the specified assistant.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/AssistantFile" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + }, + "post": { + "operationId": "CreateAssistantFile", + "description": "Attaches a previously uploaded file to an assistant for use by tools that can read files.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to attach the file to.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the previously uploaded file to attach.", + "x-ms-client-name": "fileId" + } + }, + "required": [ + "file_id" + ] + } + } + ], + "responses": { + "200": { + "description": "Information about the attached file.", + "schema": { + "$ref": "#/definitions/AssistantFile" + } + } + } + } + }, + "/assistants/{assistantId}/files/{fileId}": { + "get": { + "operationId": "GetAssistantFile", + "description": "Retrieves a file attached to an assistant.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant associated with the attached file.", + "required": true, + "type": "string" + }, + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "A representation of the attached file.", + "schema": { + "$ref": "#/definitions/AssistantFile" + } + } + } + }, + "delete": { + "operationId": "DeleteAssistantFile", + "description": "Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read\nfiles.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant from which the specified file should be unlinked.", + "required": true, + "type": "string" + }, + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to unlink from the specified assistant.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Status information about the requested file association deletion.", + "schema": { + "$ref": "#/definitions/AssistantFileDeletionStatus" + } + } + } + } + }, + "/files": { + "get": { + "operationId": "ListFiles", + "description": "Gets a list of previously uploaded files.", + "parameters": [ + { + "name": "purpose", + "in": "query", + "description": "A value that, when provided, limits list results to files matching the corresponding purpose.", + "required": false, + "type": "string", + "enum": [ + "fine-tune", + "fine-tune-results", + "assistants", + "assistants_output" + ], + "x-ms-enum": { + "name": "FilePurpose", + "modelAsString": true, + "values": [ + { + "name": "fineTune", + "value": "fine-tune", + "description": "Indicates a file is used for fine tuning input." + }, + { + "name": "fineTuneResults", + "value": "fine-tune-results", + "description": "Indicates a file is used for fine tuning results." + }, + { + "name": "assistants", + "value": "assistants", + "description": "Indicates a file is used as input to assistants." + }, + { + "name": "assistantsOutput", + "value": "assistants_output", + "description": "Indicates a file is used as output by assistants." + } + ] + } + } + ], + "responses": { + "200": { + "description": "The requested list of files.", + "schema": { + "$ref": "#/definitions/FileListResponse" + } + } + } + }, + "post": { + "operationId": "UploadFile", + "description": "Uploads a file for use by other operations.", + "consumes": [ + "multipart/form-data" + ], + "parameters": [ + { + "name": "file", + "in": "formData", + "description": "The file data (not filename) to upload.", + "required": true, + "type": "file" + }, + { + "name": "purpose", + "in": "formData", + "description": "The intended purpose of the file.", + "required": true, + "type": "string", + "enum": [ + "fine-tune", + "fine-tune-results", + "assistants", + "assistants_output" + ], + "x-ms-enum": { + "name": "FilePurpose", + "modelAsString": true, + "values": [ + { + "name": "fineTune", + "value": "fine-tune", + "description": "Indicates a file is used for fine tuning input." + }, + { + "name": "fineTuneResults", + "value": "fine-tune-results", + "description": "Indicates a file is used for fine tuning results." + }, + { + "name": "assistants", + "value": "assistants", + "description": "Indicates a file is used as input to assistants." + }, + { + "name": "assistantsOutput", + "value": "assistants_output", + "description": "Indicates a file is used as output by assistants." + } + ] + } + }, + { + "name": "filename", + "in": "formData", + "description": "A filename to associate with the uploaded data.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "A representation of the uploaded file.", + "schema": { + "$ref": "#/definitions/OpenAIFile" + } + } + } + } + }, + "/files/{fileId}": { + "get": { + "operationId": "GetFile", + "description": "Returns information about a specific file. Does not retrieve file content.", + "parameters": [ + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/OpenAIFile" + } + } + } + }, + "delete": { + "operationId": "DeleteFile", + "description": "Delete a previously uploaded file.", + "parameters": [ + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to delete.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/FileDeletionStatus" + } + } + } + } + }, + "/files/{fileId}/content": { + "get": { + "operationId": "GetFileContent", + "description": "Returns information about a specific file. Does not retrieve file content.", + "parameters": [ + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "type": "string", + "format": "byte" + } + } + } + } + }, + "/threads": { + "post": { + "operationId": "CreateThread", + "description": "Creates a new thread. Threads contain messages and can be run by assistants.", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AssistantThreadCreationOptions" + } + } + ], + "responses": { + "200": { + "description": "Information about the newly created thread.", + "schema": { + "$ref": "#/definitions/AssistantThread" + } + } + } + } + }, + "/threads/{threadId}": { + "get": { + "operationId": "GetThread", + "description": "Gets information about an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to retrieve information about.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Information about the requested thread.", + "schema": { + "$ref": "#/definitions/AssistantThread" + } + } + } + }, + "post": { + "operationId": "UpdateThread", + "description": "Modifies an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to modify.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + } + } + ], + "responses": { + "200": { + "description": "Information about the modified thread.", + "schema": { + "$ref": "#/definitions/AssistantThread" + } + } + } + }, + "delete": { + "operationId": "DeleteThread", + "description": "Deletes an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to delete.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Status information about the requested thread deletion operation.", + "schema": { + "$ref": "#/definitions/ThreadDeletionStatus" + } + } + } + } + }, + "/threads/{threadId}/messages": { + "get": { + "operationId": "ListMessages", + "description": "Gets a list of messages that exist on a thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to list messages from.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of messages.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/ThreadMessage" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + }, + "post": { + "operationId": "CreateMessage", + "description": "Creates a new message on a specified thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to create the new message on.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "role": { + "$ref": "#/definitions/MessageRole", + "description": "The role to associate with the new message." + }, + "content": { + "type": "string", + "description": "The textual content for the new message." + }, + "file_ids": { + "type": "array", + "description": "A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files.", + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "role", + "content" + ] + } + } + ], + "responses": { + "200": { + "description": "A representation of the new message.", + "schema": { + "$ref": "#/definitions/ThreadMessage" + } + } + } + } + }, + "/threads/{threadId}/messages/{messageId}": { + "get": { + "operationId": "GetMessage", + "description": "Gets an existing message from an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to retrieve the specified message from.", + "required": true, + "type": "string" + }, + { + "name": "messageId", + "in": "path", + "description": "The ID of the message to retrieve from the specified thread.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "A representation of the requested message.", + "schema": { + "$ref": "#/definitions/ThreadMessage" + } + } + } + }, + "post": { + "operationId": "UpdateMessage", + "description": "Modifies an existing message on an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread containing the specified message to modify.", + "required": true, + "type": "string" + }, + { + "name": "messageId", + "in": "path", + "description": "The ID of the message to modify on the specified thread.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + } + } + ], + "responses": { + "200": { + "description": "A representation of the modified message.", + "schema": { + "$ref": "#/definitions/ThreadMessage" + } + } + } + } + }, + "/threads/{threadId}/messages/{messageId}/files": { + "get": { + "operationId": "ListMessageFiles", + "description": "Gets a list of previously uploaded files associated with a message from a thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread containing the message to list files from.", + "required": true, + "type": "string" + }, + { + "name": "messageId", + "in": "path", + "description": "The ID of the message to list files from.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of files associated with the specified message.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/MessageFile" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + } + }, + "/threads/{threadId}/messages/{messageId}/files/{fileId}": { + "get": { + "operationId": "GetMessageFile", + "description": "Gets information about a file attachment to a message within a thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread containing the message to get information from.", + "required": true, + "type": "string" + }, + { + "name": "messageId", + "in": "path", + "description": "The ID of the message to get information from.", + "required": true, + "type": "string" + }, + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to get information about.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested file information.", + "schema": { + "$ref": "#/definitions/MessageFile" + } + } + } + } + }, + "/threads/{threadId}/runs": { + "get": { + "operationId": "ListRuns", + "description": "Gets a list of runs for a specified thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to list runs from.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of thread runs.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/ThreadRun" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + }, + "post": { + "operationId": "CreateRun", + "description": "Creates a new run for an assistant thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to run.", + "required": true, + "type": "string" + }, + { + "name": "createRunOptions", + "in": "body", + "description": "The details for the run to create.", + "required": true, + "schema": { + "$ref": "#/definitions/CreateRunOptions" + } + } + ], + "responses": { + "200": { + "description": "Information about the new thread run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}": { + "get": { + "operationId": "GetRun", + "description": "Gets an existing run from an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to retrieve run information from.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the thread to retrieve information about.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested information about the specified thread run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + }, + "post": { + "operationId": "UpdateRun", + "description": "Modifies an existing thread run.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread associated with the specified run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the run to modify.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + } + } + ], + "responses": { + "200": { + "description": "Information about the modified run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}/cancel": { + "post": { + "operationId": "CancelRun", + "description": "Cancels a run of an in progress thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread being run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the run to cancel.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Updated information about the cancelled run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}/steps": { + "get": { + "operationId": "ListRunSteps", + "description": "Gets a list of run steps from a thread run.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread that was run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the run to list steps from.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of run steps.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/RunStep" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}/steps/{stepId}": { + "get": { + "operationId": "GetRunStep", + "description": "Gets a single run step from a thread run.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread that was run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the specific run to retrieve the step from.", + "required": true, + "type": "string" + }, + { + "name": "stepId", + "in": "path", + "description": "The ID of the step to retrieve information about.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Information about the requested run step.", + "schema": { + "$ref": "#/definitions/RunStep" + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}/submit_tool_outputs": { + "post": { + "operationId": "SubmitToolOutputsToRun", + "description": "Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread that was run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the run that requires tool outputs.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "tool_outputs": { + "type": "array", + "description": "The list of tool outputs requested by tool calls from the specified run.", + "items": { + "$ref": "#/definitions/ToolOutput" + }, + "x-ms-client-name": "toolOutputs", + "x-ms-identifiers": [] + }, + "stream": { + "type": "boolean", + "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" + ] + } + } + ], + "responses": { + "200": { + "description": "Updated information about the run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + }, + "/threads/runs": { + "post": { + "operationId": "CreateThreadAndRun", + "description": "Creates a new assistant thread and immediately starts a run using that new thread.", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateAndRunThreadOptions" + } + } + ], + "responses": { + "200": { + "description": "Information about the newly created thread.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + } + }, + "definitions": { + "Assistant": { + "type": "object", + "description": "Represents an assistant that can call the model and use tools.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always assistant.", + "enum": [ + "assistant" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "name": { + "type": "string", + "description": "The name of the assistant.", + "x-nullable": true + }, + "description": { + "type": "string", + "description": "The description of the assistant.", + "x-nullable": true + }, + "model": { + "type": "string", + "description": "The ID of the model to use." + }, + "instructions": { + "type": "string", + "description": "The system instructions for the assistant to use.", + "x-nullable": true + }, + "tools": { + "type": "array", + "description": "The collection of tools enabled for the assistant.", + "default": [], + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "file_ids": { + "type": "array", + "description": "A list of attached file IDs, ordered by creation date in ascending order.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "created_at", + "name", + "description", + "model", + "instructions", + "tools", + "file_ids", + "metadata" + ] + }, + "AssistantCreationOptions": { + "type": "object", + "description": "The request details to use when creating a new assistant.", + "properties": { + "model": { + "type": "string", + "description": "The ID of the model to use." + }, + "name": { + "type": "string", + "description": "The name of the new assistant.", + "x-nullable": true + }, + "description": { + "type": "string", + "description": "The description of the new assistant.", + "x-nullable": true + }, + "instructions": { + "type": "string", + "description": "The system instructions for the new assistant to use.", + "x-nullable": true + }, + "tools": { + "type": "array", + "description": "The collection of tools to enable for the new assistant.", + "default": [], + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "file_ids": { + "type": "array", + "description": "A list of previously uploaded file IDs to attach to the assistant.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "model" + ] + }, + "AssistantDeletionStatus": { + "type": "object", + "description": "The status of an assistant deletion operation.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource specified for deletion." + }, + "deleted": { + "type": "boolean", + "description": "A value indicating whether deletion was successful." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'assistant.deleted'.", + "enum": [ + "assistant.deleted" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "AssistantFile": { + "type": "object", + "description": "Information about a file attached to an assistant, as used by tools that can read files.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'assistant.file'.", + "enum": [ + "assistant.file" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "assistant_id": { + "type": "string", + "description": "The assistant ID that the file is attached to.", + "x-ms-client-name": "assistantId" + } + }, + "required": [ + "id", + "object", + "created_at", + "assistant_id" + ] + }, + "AssistantFileDeletionStatus": { + "type": "object", + "description": "The status of an assistant file deletion operation.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource specified for deletion." + }, + "deleted": { + "type": "boolean", + "description": "A value indicating whether deletion was successful." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'assistant.file.deleted'.", + "enum": [ + "assistant.file.deleted" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "AssistantThread": { + "type": "object", + "description": "Information about a single thread associated with an assistant.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread'.", + "enum": [ + "thread" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "created_at", + "metadata" + ] + }, + "AssistantThreadCreationOptions": { + "type": "object", + "description": "The details used to create a new assistant thread.", + "properties": { + "messages": { + "type": "array", + "description": "The initial messages to associate with the new thread.", + "items": { + "$ref": "#/definitions/ThreadInitializationMessage" + }, + "x-ms-identifiers": [] + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + }, + "CodeInterpreterToolDefinition": { + "type": "object", + "description": "The input definition information for a code interpreter tool as used to configure an assistant.", + "allOf": [ + { + "$ref": "#/definitions/ToolDefinition" + } + ], + "x-ms-discriminator-value": "code_interpreter" + }, + "CreateAndRunThreadOptions": { + "type": "object", + "description": "The details used when creating and immediately running a new assistant thread.", + "properties": { + "assistant_id": { + "type": "string", + "description": "The ID of the assistant for which the thread should be created.", + "x-ms-client-name": "assistantId" + }, + "thread": { + "$ref": "#/definitions/AssistantThreadCreationOptions", + "description": "The details used to create the new thread." + }, + "model": { + "type": "string", + "description": "The overridden model that the assistant should use to run the thread." + }, + "instructions": { + "type": "string", + "description": "The overridden system instructions the assistant should use to run the thread." + }, + "tools": { + "type": "array", + "description": "The overridden list of enabled tools the assistant should use to run the thread.", + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "stream": { + "type": "boolean", + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "assistant_id" + ] + }, + "CreateRunOptions": { + "type": "object", + "description": "The details used when creating a new run of an assistant thread.", + "properties": { + "assistant_id": { + "type": "string", + "description": "The ID of the assistant that should run the thread.", + "x-ms-client-name": "assistantId" + }, + "model": { + "type": "string", + "description": "The overridden model name that the assistant should use to run the thread.", + "x-nullable": true + }, + "instructions": { + "type": "string", + "description": "The overridden system instructions that the assistant should use to run the thread.", + "x-nullable": true + }, + "additional_instructions": { + "type": "string", + "description": "Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior\non a per-run basis without overriding other instructions.", + "x-nullable": true, + "x-ms-client-name": "additionalInstructions" + }, + "tools": { + "type": "array", + "description": "The overridden list of enabled tools that the assistant should use to run the thread.", + "x-nullable": true, + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "stream": { + "type": "boolean", + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "assistant_id" + ] + }, + "FileDeletionStatus": { + "type": "object", + "description": "A status response from a file deletion operation.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource specified for deletion." + }, + "deleted": { + "type": "boolean", + "description": "A value indicating whether deletion was successful." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'file'.", + "enum": [ + "file" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "FileListResponse": { + "type": "object", + "description": "The response data from a file list operation.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always 'list'.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The files returned for the request.", + "items": { + "$ref": "#/definitions/OpenAIFile" + } + } + }, + "required": [ + "object", + "data" + ] + }, + "FilePurpose": { + "type": "string", + "description": "The possible values denoting the intended usage of a file.", + "enum": [ + "fine-tune", + "fine-tune-results", + "assistants", + "assistants_output" + ], + "x-ms-enum": { + "name": "FilePurpose", + "modelAsString": true, + "values": [ + { + "name": "fineTune", + "value": "fine-tune", + "description": "Indicates a file is used for fine tuning input." + }, + { + "name": "fineTuneResults", + "value": "fine-tune-results", + "description": "Indicates a file is used for fine tuning results." + }, + { + "name": "assistants", + "value": "assistants", + "description": "Indicates a file is used as input to assistants." + }, + { + "name": "assistantsOutput", + "value": "assistants_output", + "description": "Indicates a file is used as output by assistants." + } + ] + } + }, + "FunctionDefinition": { + "type": "object", + "description": "The input definition information for a function.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to be called." + }, + "description": { + "type": "string", + "description": "A description of what the function does, used by the model to choose when and how to call the function." + }, + "parameters": { + "description": "The parameters the functions accepts, described as a JSON Schema object." + } + }, + "required": [ + "name", + "parameters" + ] + }, + "FunctionToolDefinition": { + "type": "object", + "description": "The input definition information for a function tool as used to configure an assistant.", + "properties": { + "function": { + "$ref": "#/definitions/FunctionDefinition", + "description": "The definition of the concrete function that the function tool should call." + } + }, + "required": [ + "function" + ], + "allOf": [ + { + "$ref": "#/definitions/ToolDefinition" + } + ], + "x-ms-discriminator-value": "function" + }, + "MessageContent": { + "type": "object", + "description": "An abstract representation of a single item of thread message content.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "MessageFile": { + "type": "object", + "description": "Information about a file attached to an assistant thread message.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.message.file'.", + "enum": [ + "thread.message.file" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "message_id": { + "type": "string", + "description": "The ID of the message that this file is attached to.", + "x-ms-client-name": "messageId" + } + }, + "required": [ + "id", + "object", + "created_at", + "message_id" + ] + }, + "MessageImageFileContent": { + "type": "object", + "description": "A representation of image file content in a thread message.", + "properties": { + "image_file": { + "$ref": "#/definitions/MessageImageFileDetails", + "description": "The image file for this thread message content item.", + "x-ms-client-name": "imageFile" + } + }, + "required": [ + "image_file" + ], + "allOf": [ + { + "$ref": "#/definitions/MessageContent" + } + ], + "x-ms-discriminator-value": "image_file" + }, + "MessageImageFileDetails": { + "type": "object", + "description": "An image reference, as represented in thread message content.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID for the file associated with this image.", + "x-ms-client-name": "fileId" + } + }, + "required": [ + "file_id" + ] + }, + "MessageIncompleteDetailsReason": { + "type": "string", + "description": "A set of reasons describing why a message is marked as incomplete.", + "enum": [ + "content_filter", + "max_tokens", + "run_cancelled", + "run_failed" + ], + "x-ms-enum": { + "name": "MessageIncompleteDetailsReason", + "modelAsString": true, + "values": [ + { + "name": "contentFilter", + "value": "content_filter", + "description": "The run generating the message was terminated due to content filter flagging." + }, + { + "name": "maxTokens", + "value": "max_tokens", + "description": "The run generating the message exhausted available tokens before completion." + }, + { + "name": "runCancelled", + "value": "run_cancelled", + "description": "The run generating the message was cancelled before completion." + }, + { + "name": "runFailed", + "value": "run_failed", + "description": "The run generating the message failed." + } + ] + } + }, + "MessageRole": { + "type": "string", + "description": "The possible values for roles attributed to messages in a thread.", + "enum": [ + "user", + "assistant" + ], + "x-ms-enum": { + "name": "MessageRole", + "modelAsString": true, + "values": [ + { + "name": "user", + "value": "user", + "description": "The role representing the end-user." + }, + { + "name": "assistant", + "value": "assistant", + "description": "The role representing the assistant." + } + ] + } + }, + "MessageStatus": { + "type": "string", + "description": "The possible execution status values for a thread message.", + "enum": [ + "in_progress", + "incomplete", + "completed" + ], + "x-ms-enum": { + "name": "MessageStatus", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "A run is currently creating this message." + }, + { + "name": "incomplete", + "value": "incomplete", + "description": "This message is incomplete. See incomplete_details for more information." + }, + { + "name": "completed", + "value": "completed", + "description": "This message was successfully completed by a run." + } + ] + } + }, + "MessageTextAnnotation": { + "type": "object", + "description": "An abstract representation of an annotation to text thread message content.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + }, + "text": { + "type": "string", + "description": "The textual content associated with this text annotation item." + }, + "start_index": { + "type": "integer", + "format": "int32", + "description": "The first text index associated with this text annotation.", + "x-ms-client-name": "startIndex" + }, + "end_index": { + "type": "integer", + "format": "int32", + "description": "The last text index associated with this text annotation.", + "x-ms-client-name": "endIndex" + } + }, + "discriminator": "type", + "required": [ + "type", + "text", + "start_index", + "end_index" + ] + }, + "MessageTextContent": { + "type": "object", + "description": "A representation of a textual item of thread message content.", + "properties": { + "text": { + "$ref": "#/definitions/MessageTextDetails", + "description": "The text and associated annotations for this thread message content item." + } + }, + "required": [ + "text" + ], + "allOf": [ + { + "$ref": "#/definitions/MessageContent" + } + ], + "x-ms-discriminator-value": "text" + }, + "MessageTextDetails": { + "type": "object", + "description": "The text and associated annotations for a single item of assistant thread message content.", + "properties": { + "value": { + "type": "string", + "description": "The text data." + }, + "annotations": { + "type": "array", + "description": "A list of annotations associated with this text.", + "items": { + "$ref": "#/definitions/MessageTextAnnotation" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "value", + "annotations" + ] + }, + "MessageTextFileCitationAnnotation": { + "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": { + "file_citation": { + "$ref": "#/definitions/MessageTextFileCitationDetails", + "description": "A citation within the message that points to a specific quote from a specific file.\nGenerated when the assistant uses the \"retrieval\" tool to search files.", + "x-ms-client-name": "fileCitation" + } + }, + "required": [ + "file_citation" + ], + "allOf": [ + { + "$ref": "#/definitions/MessageTextAnnotation" + } + ], + "x-ms-discriminator-value": "file_citation" + }, + "MessageTextFileCitationDetails": { + "type": "object", + "description": "A representation of a file-based text citation, as used in a file-based annotation of text thread message content.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file associated with this citation.", + "x-ms-client-name": "fileId" + }, + "quote": { + "type": "string", + "description": "The specific quote cited in the associated file." + } + }, + "required": [ + "file_id", + "quote" + ] + }, + "MessageTextFilePathAnnotation": { + "type": "object", + "description": "A citation within the message that points to a file located at a specific path.", + "properties": { + "file_path": { + "$ref": "#/definitions/MessageTextFilePathDetails", + "description": "A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.", + "x-ms-client-name": "filePath" + } + }, + "required": [ + "file_path" + ], + "allOf": [ + { + "$ref": "#/definitions/MessageTextAnnotation" + } + ], + "x-ms-discriminator-value": "file_path" + }, + "MessageTextFilePathDetails": { + "type": "object", + "description": "An encapsulation of an image file ID, as used by message image content.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the specific file that the citation is from.", + "x-ms-client-name": "fileId" + } + }, + "required": [ + "file_id" + ] + }, + "OpenAIFile": { + "type": "object", + "description": "Represents an assistant that can call the model and use tools.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always 'file'.", + "enum": [ + "file" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "bytes": { + "type": "integer", + "format": "int32", + "description": "The size of the file, in bytes." + }, + "filename": { + "type": "string", + "description": "The name of the file." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "purpose": { + "$ref": "#/definitions/FilePurpose", + "description": "The intended purpose of a file." + } + }, + "required": [ + "object", + "id", + "bytes", + "filename", + "created_at", + "purpose" + ] + }, + "RequiredAction": { + "type": "object", + "description": "An abstract representation of a required action for an assistant thread run to continue.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "RequiredFunctionToolCall": { + "type": "object", + "description": "A representation of a requested call to a function tool, needed by the model to continue evaluation of a run.", + "properties": { + "function": { + "$ref": "#/definitions/RequiredFunctionToolCallDetails", + "description": "Detailed information about the function to be executed by the tool that includes name and arguments." + } + }, + "required": [ + "function" + ], + "allOf": [ + { + "$ref": "#/definitions/RequiredToolCall" + } + ], + "x-ms-discriminator-value": "function" + }, + "RequiredFunctionToolCallDetails": { + "type": "object", + "description": "The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation." + } + }, + "required": [ + "name", + "arguments" + ] + }, + "RequiredToolCall": { + "type": "object", + "description": "An abstract representation a a tool invocation needed by the model to continue a run.", + "properties": { + "type": { + "type": "string", + "description": "The object type for the required tool call." + }, + "id": { + "type": "string", + "description": "The ID of the tool call. This ID must be referenced when submitting tool outputs." + } + }, + "discriminator": "type", + "required": [ + "type", + "id" + ] + }, + "RetrievalToolDefinition": { + "type": "object", + "description": "The input definition information for a retrieval tool as used to configure an assistant.", + "allOf": [ + { + "$ref": "#/definitions/ToolDefinition" + } + ], + "x-ms-discriminator-value": "retrieval" + }, + "RunError": { + "type": "object", + "description": "The details of an error as encountered by an assistant thread run.", + "properties": { + "code": { + "type": "string", + "description": "The status for the error." + }, + "message": { + "type": "string", + "description": "The human-readable text associated with the error." + } + }, + "required": [ + "code", + "message" + ] + }, + "RunStatus": { + "type": "string", + "description": "Possible values for the status of an assistant thread run.", + "enum": [ + "queued", + "in_progress", + "requires_action", + "cancelling", + "cancelled", + "failed", + "completed", + "expired" + ], + "x-ms-enum": { + "name": "RunStatus", + "modelAsString": true, + "values": [ + { + "name": "queued", + "value": "queued", + "description": "Represents a run that is queued to start." + }, + { + "name": "inProgress", + "value": "in_progress", + "description": "Represents a run that is in progress." + }, + { + "name": "requiresAction", + "value": "requires_action", + "description": "Represents a run that needs another operation, such as tool output submission, to continue." + }, + { + "name": "cancelling", + "value": "cancelling", + "description": "Represents a run that is in the process of cancellation." + }, + { + "name": "cancelled", + "value": "cancelled", + "description": "Represents a run that has been cancelled." + }, + { + "name": "failed", + "value": "failed", + "description": "Represents a run that failed." + }, + { + "name": "completed", + "value": "completed", + "description": "Represents a run that successfully completed." + }, + { + "name": "expired", + "value": "expired", + "description": "Represents a run that expired before it could otherwise finish." + } + ] + } + }, + "RunStep": { + "type": "object", + "description": "Detailed information about a single step of an assistant thread run.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.run.step'.", + "enum": [ + "thread.run.step" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "type": { + "$ref": "#/definitions/RunStepType", + "description": "The type of run step, which can be either message_creation or tool_calls." + }, + "assistant_id": { + "type": "string", + "description": "The ID of the assistant associated with the run step.", + "x-ms-client-name": "assistantId" + }, + "thread_id": { + "type": "string", + "description": "The ID of the thread that was run.", + "x-ms-client-name": "threadId" + }, + "run_id": { + "type": "string", + "description": "The ID of the run that this run step is a part of.", + "x-ms-client-name": "runId" + }, + "status": { + "$ref": "#/definitions/RunStepStatus", + "description": "The status of this run step." + }, + "step_details": { + "$ref": "#/definitions/RunStepDetails", + "description": "The details for this run step.", + "x-ms-client-name": "stepDetails" + }, + "last_error": { + "type": "object", + "description": "If applicable, information about the last error encountered by this run step.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunStepError" + } + ], + "x-ms-client-name": "lastError" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "expired_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this item expired.", + "x-nullable": true, + "x-ms-client-name": "expiredAt" + }, + "completed_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this completed.", + "x-nullable": true, + "x-ms-client-name": "completedAt" + }, + "cancelled_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this was cancelled.", + "x-nullable": true, + "x-ms-client-name": "cancelledAt" + }, + "failed_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this failed.", + "x-nullable": true, + "x-ms-client-name": "failedAt" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "type", + "assistant_id", + "thread_id", + "run_id", + "status", + "step_details", + "last_error", + "created_at", + "expired_at", + "completed_at", + "cancelled_at", + "failed_at", + "metadata" + ] + }, + "RunStepCodeInterpreterImageOutput": { + "type": "object", + "description": "A representation of an image output emitted by a code interpreter tool in response to a tool call by the model.", + "properties": { + "image": { + "$ref": "#/definitions/RunStepCodeInterpreterImageReference", + "description": "Referential information for the image associated with this output." + } + }, + "required": [ + "image" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" + } + ], + "x-ms-discriminator-value": "image" + }, + "RunStepCodeInterpreterImageReference": { + "type": "object", + "description": "An image reference emitted by a code interpreter tool in response to a tool call by the model.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file associated with this image.", + "x-ms-client-name": "fileId" + } + }, + "required": [ + "file_id" + ] + }, + "RunStepCodeInterpreterLogOutput": { + "type": "object", + "description": "A representation of a log output emitted by a code interpreter tool in response to a tool call by the model.", + "properties": { + "logs": { + "type": "string", + "description": "The serialized log output emitted by the code interpreter." + } + }, + "required": [ + "logs" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" + } + ], + "x-ms-discriminator-value": "logs" + }, + "RunStepCodeInterpreterToolCall": { + "type": "object", + "description": "A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that\nrepresents inputs and outputs consumed and emitted by the code interpreter.", + "properties": { + "code_interpreter": { + "$ref": "#/definitions/RunStepCodeInterpreterToolCallDetails", + "description": "The details of the tool call to the code interpreter tool.", + "x-ms-client-name": "codeInterpreter" + } + }, + "required": [ + "code_interpreter" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepToolCall" + } + ], + "x-ms-discriminator-value": "code_interpreter" + }, + "RunStepCodeInterpreterToolCallDetails": { + "type": "object", + "description": "The detailed information about a code interpreter invocation by the model.", + "properties": { + "input": { + "type": "string", + "description": "The input provided by the model to the code interpreter tool." + }, + "outputs": { + "type": "array", + "description": "The outputs produced by the code interpreter tool back to the model in response to the tool call.", + "items": { + "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "input", + "outputs" + ] + }, + "RunStepCodeInterpreterToolCallOutput": { + "type": "object", + "description": "An abstract representation of an emitted output from a code interpreter tool.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "RunStepDetails": { + "type": "object", + "description": "An abstract representation of the details for a run step.", + "properties": { + "type": { + "$ref": "#/definitions/RunStepType", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "RunStepError": { + "type": "object", + "description": "The error information associated with a failed run step.", + "properties": { + "code": { + "$ref": "#/definitions/RunStepErrorCode", + "description": "The error code for this error." + }, + "message": { + "type": "string", + "description": "The human-readable text associated with this error." + } + }, + "required": [ + "code", + "message" + ] + }, + "RunStepErrorCode": { + "type": "string", + "description": "Possible error code values attributable to a failed run step.", + "enum": [ + "server_error", + "rate_limit_exceeded" + ], + "x-ms-enum": { + "name": "RunStepErrorCode", + "modelAsString": true, + "values": [ + { + "name": "serverError", + "value": "server_error", + "description": "Represents a server error." + }, + { + "name": "rateLimitExceeded", + "value": "rate_limit_exceeded", + "description": "Represents an error indicating configured rate limits were exceeded." + } + ] + } + }, + "RunStepFunctionToolCall": { + "type": "object", + "description": "A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs\nand output consumed and emitted by the specified function.", + "properties": { + "function": { + "$ref": "#/definitions/RunStepFunctionToolCallDetails", + "description": "The detailed information about the function called by the model." + } + }, + "required": [ + "function" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepToolCall" + } + ], + "x-ms-discriminator-value": "function" + }, + "RunStepFunctionToolCallDetails": { + "type": "object", + "description": "The detailed information about the function called by the model.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments that the model requires are provided to the named function." + }, + "output": { + "type": "string", + "description": "The output of the function, only populated for function calls that have already have had their outputs submitted.", + "x-nullable": true + } + }, + "required": [ + "name", + "arguments", + "output" + ] + }, + "RunStepMessageCreationDetails": { + "type": "object", + "description": "The detailed information associated with a message creation run step.", + "properties": { + "message_creation": { + "$ref": "#/definitions/RunStepMessageCreationReference", + "description": "Information about the message creation associated with this run step.", + "x-ms-client-name": "messageCreation" + } + }, + "required": [ + "message_creation" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepDetails" + } + ], + "x-ms-discriminator-value": "message_creation" + }, + "RunStepMessageCreationReference": { + "type": "object", + "description": "The details of a message created as a part of a run step.", + "properties": { + "message_id": { + "type": "string", + "description": "The ID of the message created by this run step.", + "x-ms-client-name": "messageId" + } + }, + "required": [ + "message_id" + ] + }, + "RunStepRetrievalToolCall": { + "type": "object", + "description": "A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents\nexecuted retrieval actions.", + "properties": { + "retrieval": { + "type": "object", + "description": "The key/value pairs produced by the retrieval tool.", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "retrieval" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepToolCall" + } + ], + "x-ms-discriminator-value": "retrieval" + }, + "RunStepStatus": { + "type": "string", + "description": "Possible values for the status of a run step.", + "enum": [ + "in_progress", + "cancelled", + "failed", + "completed", + "expired" + ], + "x-ms-enum": { + "name": "RunStepStatus", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "Represents a run step still in progress." + }, + { + "name": "cancelled", + "value": "cancelled", + "description": "Represents a run step that was cancelled." + }, + { + "name": "failed", + "value": "failed", + "description": "Represents a run step that failed." + }, + { + "name": "completed", + "value": "completed", + "description": "Represents a run step that successfully completed." + }, + { + "name": "expired", + "value": "expired", + "description": "Represents a run step that expired before otherwise finishing." + } + ] + } + }, + "RunStepToolCall": { + "type": "object", + "description": "An abstract representation of a detailed tool call as recorded within a run step for an existing run.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + }, + "id": { + "type": "string", + "description": "The ID of the tool call. This ID must be referenced when you submit tool outputs." + } + }, + "discriminator": "type", + "required": [ + "type", + "id" + ] + }, + "RunStepToolCallDetails": { + "type": "object", + "description": "The detailed information associated with a run step calling tools.", + "properties": { + "tool_calls": { + "type": "array", + "description": "A list of tool call details for this run step.", + "items": { + "$ref": "#/definitions/RunStepToolCall" + }, + "x-ms-client-name": "toolCalls" + } + }, + "required": [ + "tool_calls" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepDetails" + } + ], + "x-ms-discriminator-value": "tool_calls" + }, + "RunStepType": { + "type": "string", + "description": "The possible types of run steps.", + "enum": [ + "message_creation", + "tool_calls" + ], + "x-ms-enum": { + "name": "RunStepType", + "modelAsString": true, + "values": [ + { + "name": "messageCreation", + "value": "message_creation", + "description": "Represents a run step to create a message." + }, + { + "name": "toolCalls", + "value": "tool_calls", + "description": "Represents a run step that calls tools." + } + ] + } + }, + "SubmitToolOutputsAction": { + "type": "object", + "description": "The details for required tool calls that must be submitted for an assistant thread run to continue.", + "properties": { + "submit_tool_outputs": { + "$ref": "#/definitions/SubmitToolOutputsDetails", + "description": "The details describing tools that should be called to submit tool outputs.", + "x-ms-client-name": "submitToolOutputs" + } + }, + "required": [ + "submit_tool_outputs" + ], + "allOf": [ + { + "$ref": "#/definitions/RequiredAction" + } + ], + "x-ms-discriminator-value": "submit_tool_outputs" + }, + "SubmitToolOutputsDetails": { + "type": "object", + "description": "The details describing tools that should be called to submit tool outputs.", + "properties": { + "tool_calls": { + "type": "array", + "description": "The list of tool calls that must be resolved for the assistant thread run to continue.", + "items": { + "$ref": "#/definitions/RequiredToolCall" + }, + "x-ms-client-name": "toolCalls" + } + }, + "required": [ + "tool_calls" + ] + }, + "ThreadDeletionStatus": { + "type": "object", + "description": "The status of a thread deletion operation.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource specified for deletion." + }, + "deleted": { + "type": "boolean", + "description": "A value indicating whether deletion was successful." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.deleted'.", + "enum": [ + "thread.deleted" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "ThreadInitializationMessage": { + "type": "object", + "description": "A single message within an assistant thread, as provided during that thread's creation for its initial state.", + "properties": { + "role": { + "$ref": "#/definitions/MessageRole", + "description": "The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread." + }, + "content": { + "type": "string", + "description": "The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API." + }, + "file_ids": { + "type": "array", + "description": "A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can\naccess files.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "role", + "content" + ] + }, + "ThreadMessage": { + "type": "object", + "description": "A single, existing message within an assistant thread.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.message'.", + "enum": [ + "thread.message" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "thread_id": { + "type": "string", + "description": "The ID of the thread that this message belongs to.", + "x-ms-client-name": "threadId" + }, + "status": { + "$ref": "#/definitions/MessageStatus", + "description": "The status of the message." + }, + "incomplete_details": { + "$ref": "#/definitions/MessageIncompleteDetailsReason", + "description": "On an incomplete message, details about why the message is incomplete.", + "x-nullable": true, + "x-ms-client-name": "incompleteDetails" + }, + "completed_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp (in seconds) for when the message was completed.", + "x-nullable": true, + "x-ms-client-name": "completedAt" + }, + "incomplete_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", + "x-nullable": true, + "x-ms-client-name": "incompleteAt" + }, + "role": { + "$ref": "#/definitions/MessageRole", + "description": "The role associated with the assistant thread message." + }, + "content": { + "type": "array", + "description": "The list of content items associated with the assistant thread message.", + "items": { + "$ref": "#/definitions/MessageContent" + }, + "x-ms-identifiers": [] + }, + "assistant_id": { + "type": "string", + "description": "If applicable, the ID of the assistant that authored this message.", + "x-ms-client-name": "assistantId" + }, + "run_id": { + "type": "string", + "description": "If applicable, the ID of the run associated with the authoring of this message.", + "x-ms-client-name": "runId" + }, + "file_ids": { + "type": "array", + "description": "A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can\naccess files.", + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "created_at", + "thread_id", + "status", + "incomplete_details", + "completed_at", + "incomplete_at", + "role", + "content", + "file_ids", + "metadata" + ] + }, + "ThreadRun": { + "type": "object", + "description": "Data representing a single evaluation run of an assistant thread.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.run'.", + "enum": [ + "thread.run" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "thread_id": { + "type": "string", + "description": "The ID of the thread associated with this run.", + "x-ms-client-name": "threadId" + }, + "assistant_id": { + "type": "string", + "description": "The ID of the assistant associated with the thread this run was performed against.", + "x-ms-client-name": "assistantId" + }, + "status": { + "$ref": "#/definitions/RunStatus", + "description": "The status of the assistant thread run." + }, + "required_action": { + "type": "object", + "description": "The details of the action required for the assistant thread run to continue.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RequiredAction" + } + ], + "x-ms-client-name": "requiredAction" + }, + "last_error": { + "type": "object", + "description": "The last error, if any, encountered by this assistant thread run.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunError" + } + ], + "x-ms-client-name": "lastError" + }, + "model": { + "type": "string", + "description": "The ID of the model to use." + }, + "instructions": { + "type": "string", + "description": "The overridden system instructions used for this assistant thread run." + }, + "tools": { + "type": "array", + "description": "The overridden enabled tools used for this assistant thread run.", + "default": [], + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "file_ids": { + "type": "array", + "description": "A list of attached file IDs, ordered by creation date in ascending order.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "expires_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this item expires.", + "x-nullable": true, + "x-ms-client-name": "expiresAt" + }, + "started_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this item was started.", + "x-nullable": true, + "x-ms-client-name": "startedAt" + }, + "completed_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this completed.", + "x-nullable": true, + "x-ms-client-name": "completedAt" + }, + "cancelled_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this was cancelled.", + "x-nullable": true, + "x-ms-client-name": "cancelledAt" + }, + "failed_at": { + "type": "string", + "format": "date-time", + "description": "The Unix timestamp, in seconds, representing when this failed.", + "x-nullable": true, + "x-ms-client-name": "failedAt" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "thread_id", + "assistant_id", + "status", + "last_error", + "model", + "instructions", + "tools", + "file_ids", + "created_at", + "expires_at", + "started_at", + "completed_at", + "cancelled_at", + "failed_at", + "metadata" + ] + }, + "ToolDefinition": { + "type": "object", + "description": "An abstract representation of an input tool definition that an assistant can use.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "ToolOutput": { + "type": "object", + "description": "The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue.", + "properties": { + "tool_call_id": { + "type": "string", + "description": "The ID of the tool call being resolved, as provided in the tool calls of a required action from a run.", + "x-ms-client-name": "toolCallId" + }, + "output": { + "type": "string", + "description": "The output from the tool to be submitted." + } + } + }, + "UpdateAssistantOptions": { + "type": "object", + "description": "The request details to use when modifying an existing assistant.", + "properties": { + "model": { + "type": "string", + "description": "The ID of the model to use." + }, + "name": { + "type": "string", + "description": "The modified name for the assistant to use.", + "x-nullable": true + }, + "description": { + "type": "string", + "description": "The modified description for the assistant to use.", + "x-nullable": true + }, + "instructions": { + "type": "string", + "description": "The modified system instructions for the new assistant to use.", + "x-nullable": true + }, + "tools": { + "type": "array", + "description": "The modified collection of tools to enable for the assistant.", + "default": [], + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "file_ids": { + "type": "array", + "description": "The modified list of previously uploaded fileIDs to attach to the assistant.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "parameters": { + "UpdateAssistantOptions.assistantId": { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to modify.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + } + } +} diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 4e1c36fbe113..5ffa869ef232 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -2180,6 +2180,7 @@ components: type: string enum: - 2024-02-15-preview + - placeholder-for-future-release description: The known set of supported API versions. SubmitToolOutputsAction: type: object diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml new file mode 100644 index 000000000000..8a67ca76099e --- /dev/null +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml @@ -0,0 +1,3016 @@ +openapi: 3.0.0 +info: + title: Azure OpenAI + description: Azure OpenAI APIs for Assistants. + version: placeholder-for-future-release +tags: [] +paths: + /assistants: + post: + operationId: createAssistant + description: Creates a new assistant. + parameters: [] + responses: + '200': + description: The new assistant instance. + content: + application/json: + schema: + $ref: '#/components/schemas/Assistant' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantCreationOptions' + get: + operationId: listAssistants + description: Gets a list of assistants that were previously created. + parameters: + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of assistants. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/Assistant' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /assistants/{assistantId}: + get: + operationId: getAssistant + description: Retrieves an existing assistant. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant to retrieve. + schema: + type: string + responses: + '200': + description: The requested assistant instance. + content: + application/json: + schema: + $ref: '#/components/schemas/Assistant' + post: + operationId: updateAssistant + description: Modifies an existing assistant. + parameters: + - $ref: '#/components/parameters/UpdateAssistantOptions.assistantId' + responses: + '200': + description: The updated assistant instance. + content: + application/json: + schema: + $ref: '#/components/schemas/Assistant' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAssistantOptions' + delete: + operationId: deleteAssistant + description: Deletes an assistant. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant to delete. + schema: + type: string + responses: + '200': + description: Status information about the requested deletion operation. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantDeletionStatus' + /assistants/{assistantId}/files: + post: + operationId: createAssistantFile + description: Attaches a previously uploaded file to an assistant for use by tools that can read files. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant to attach the file to. + schema: + type: string + responses: + '200': + description: Information about the attached file. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantFile' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + file_id: + type: string + description: The ID of the previously uploaded file to attach. + required: + - file_id + get: + operationId: listAssistantFiles + description: Gets a list of files attached to a specific assistant, as used by tools that can read files. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant to retrieve the list of attached files for. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of files attached to the specified assistant. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/AssistantFile' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /assistants/{assistantId}/files/{fileId}: + get: + operationId: getAssistantFile + description: Retrieves a file attached to an assistant. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant associated with the attached file. + schema: + type: string + - name: fileId + in: path + required: true + description: The ID of the file to retrieve. + schema: + type: string + responses: + '200': + description: A representation of the attached file. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantFile' + delete: + operationId: deleteAssistantFile + description: |- + Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read + files. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant from which the specified file should be unlinked. + schema: + type: string + - name: fileId + in: path + required: true + description: The ID of the file to unlink from the specified assistant. + schema: + type: string + responses: + '200': + description: Status information about the requested file association deletion. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantFileDeletionStatus' + /files: + get: + operationId: listFiles + description: Gets a list of previously uploaded files. + parameters: + - name: purpose + in: query + required: false + description: A value that, when provided, limits list results to files matching the corresponding purpose. + schema: + $ref: '#/components/schemas/FilePurpose' + responses: + '200': + description: The requested list of files. + content: + application/json: + schema: + $ref: '#/components/schemas/FileListResponse' + post: + operationId: uploadFile + description: Uploads a file for use by other operations. + parameters: [] + responses: + '200': + description: A representation of the uploaded file. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + purpose: + allOf: + - $ref: '#/components/schemas/FilePurpose' + description: The intended purpose of the file. + filename: + type: string + description: A filename to associate with the uploaded data. + required: + - file + - purpose + /files/{fileId}: + delete: + operationId: deleteFile + description: Delete a previously uploaded file. + parameters: + - name: fileId + in: path + required: true + description: The ID of the file to delete. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/FileDeletionStatus' + get: + operationId: getFile + description: Returns information about a specific file. Does not retrieve file content. + parameters: + - name: fileId + in: path + required: true + description: The ID of the file to retrieve. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + /files/{fileId}/content: + get: + operationId: getFileContent + description: Returns information about a specific file. Does not retrieve file content. + parameters: + - name: fileId + in: path + required: true + description: The ID of the file to retrieve. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + type: string + format: byte + /threads: + post: + operationId: createThread + description: Creates a new thread. Threads contain messages and can be run by assistants. + parameters: [] + responses: + '200': + description: Information about the newly created thread. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThread' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThreadCreationOptions' + /threads/runs: + post: + operationId: createThreadAndRun + description: Creates a new assistant thread and immediately starts a run using that new thread. + parameters: [] + responses: + '200': + description: Information about the newly created thread. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAndRunThreadOptions' + /threads/{threadId}: + get: + operationId: getThread + description: Gets information about an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to retrieve information about. + schema: + type: string + responses: + '200': + description: Information about the requested thread. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThread' + post: + operationId: updateThread + description: Modifies an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to modify. + schema: + type: string + responses: + '200': + description: Information about the modified thread. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThread' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + delete: + operationId: deleteThread + description: Deletes an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to delete. + schema: + type: string + responses: + '200': + description: Status information about the requested thread deletion operation. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadDeletionStatus' + /threads/{threadId}/messages: + post: + operationId: createMessage + description: Creates a new message on a specified thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to create the new message on. + schema: + type: string + responses: + '200': + description: A representation of the new message. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadMessage' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The role to associate with the new message. + content: + type: string + description: The textual content for the new message. + file_ids: + type: array + items: + type: string + description: A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + required: + - role + - content + get: + operationId: listMessages + description: Gets a list of messages that exist on a thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to list messages from. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of messages. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/ThreadMessage' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /threads/{threadId}/messages/{messageId}: + get: + operationId: getMessage + description: Gets an existing message from an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to retrieve the specified message from. + schema: + type: string + - name: messageId + in: path + required: true + description: The ID of the message to retrieve from the specified thread. + schema: + type: string + responses: + '200': + description: A representation of the requested message. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadMessage' + post: + operationId: updateMessage + description: Modifies an existing message on an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread containing the specified message to modify. + schema: + type: string + - name: messageId + in: path + required: true + description: The ID of the message to modify on the specified thread. + schema: + type: string + responses: + '200': + description: A representation of the modified message. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadMessage' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /threads/{threadId}/messages/{messageId}/files: + get: + operationId: listMessageFiles + description: Gets a list of previously uploaded files associated with a message from a thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread containing the message to list files from. + schema: + type: string + - name: messageId + in: path + required: true + description: The ID of the message to list files from. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of files associated with the specified message. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/MessageFile' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /threads/{threadId}/messages/{messageId}/files/{fileId}: + get: + operationId: getMessageFile + description: Gets information about a file attachment to a message within a thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread containing the message to get information from. + schema: + type: string + - name: messageId + in: path + required: true + description: The ID of the message to get information from. + schema: + type: string + - name: fileId + in: path + required: true + description: The ID of the file to get information about. + schema: + type: string + responses: + '200': + description: The requested file information. + content: + application/json: + schema: + $ref: '#/components/schemas/MessageFile' + /threads/{threadId}/runs: + post: + operationId: createRun + description: Creates a new run for an assistant thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to run. + schema: + type: string + responses: + '200': + description: Information about the new thread run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + requestBody: + description: The details for the run to create. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRunOptions' + get: + operationId: listRuns + description: Gets a list of runs for a specified thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to list runs from. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of thread runs. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/ThreadRun' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /threads/{threadId}/runs/{runId}: + get: + operationId: getRun + description: Gets an existing run from an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to retrieve run information from. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the thread to retrieve information about. + schema: + type: string + responses: + '200': + description: The requested information about the specified thread run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + post: + operationId: updateRun + description: Modifies an existing thread run. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread associated with the specified run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the run to modify. + schema: + type: string + responses: + '200': + description: Information about the modified run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /threads/{threadId}/runs/{runId}/cancel: + post: + operationId: cancelRun + description: Cancels a run of an in progress thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread being run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the run to cancel. + schema: + type: string + responses: + '200': + description: Updated information about the cancelled run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + /threads/{threadId}/runs/{runId}/steps: + get: + operationId: listRunSteps + description: Gets a list of run steps from a thread run. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread that was run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the run to list steps from. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of run steps. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/RunStep' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /threads/{threadId}/runs/{runId}/steps/{stepId}: + get: + operationId: getRunStep + description: Gets a single run step from a thread run. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread that was run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the specific run to retrieve the step from. + schema: + type: string + - name: stepId + in: path + required: true + description: The ID of the step to retrieve information about. + schema: + type: string + responses: + '200': + description: Information about the requested run step. + content: + application/json: + schema: + $ref: '#/components/schemas/RunStep' + /threads/{threadId}/runs/{runId}/submit_tool_outputs: + post: + operationId: submitToolOutputsToRun + description: Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread that was run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the run that requires tool outputs. + schema: + type: string + responses: + '200': + description: Updated information about the run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + tool_outputs: + type: array + items: + $ref: '#/components/schemas/ToolOutput' + description: The list of tool outputs requested by tool calls from the specified run. + stream: + type: boolean + 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 +security: + - ApiKeyAuth: [] + - OAuth2Auth: + - https://cognitiveservices.azure.com/.default +components: + parameters: + UpdateAssistantOptions.assistantId: + name: assistantId + in: path + required: true + description: The ID of the assistant to modify. + schema: + type: string + schemas: + Assistant: + type: object + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - file_ids + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - assistant + description: The object type, which is always assistant. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + name: + type: string + nullable: true + description: The name of the assistant. + description: + type: string + nullable: true + description: The description of the assistant. + model: + type: string + description: The ID of the model to use. + instructions: + type: string + nullable: true + description: The system instructions for the assistant to use. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The collection of tools enabled for the assistant. + default: [] + file_ids: + type: array + items: + type: string + description: A list of attached file IDs, ordered by creation date in ascending order. + default: [] + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: Represents an assistant that can call the model and use tools. + AssistantCreationOptions: + type: object + required: + - model + properties: + model: + type: string + description: The ID of the model to use. + name: + type: string + nullable: true + description: The name of the new assistant. + description: + type: string + nullable: true + description: The description of the new assistant. + instructions: + type: string + nullable: true + description: The system instructions for the new assistant to use. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The collection of tools to enable for the new assistant. + default: [] + file_ids: + type: array + items: + type: string + description: A list of previously uploaded file IDs to attach to the assistant. + default: [] + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The request details to use when creating a new assistant. + AssistantDeletionStatus: + type: object + required: + - id + - deleted + - object + properties: + id: + type: string + description: The ID of the resource specified for deletion. + deleted: + type: boolean + description: A value indicating whether deletion was successful. + object: + type: string + enum: + - assistant.deleted + description: The object type, which is always 'assistant.deleted'. + description: The status of an assistant deletion operation. + AssistantFile: + type: object + required: + - id + - object + - created_at + - assistant_id + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - assistant.file + description: The object type, which is always 'assistant.file'. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + assistant_id: + type: string + description: The assistant ID that the file is attached to. + description: Information about a file attached to an assistant, as used by tools that can read files. + AssistantFileDeletionStatus: + type: object + required: + - id + - deleted + - object + properties: + id: + type: string + description: The ID of the resource specified for deletion. + deleted: + type: boolean + description: A value indicating whether deletion was successful. + object: + type: string + enum: + - assistant.file.deleted + description: The object type, which is always 'assistant.file.deleted'. + description: The status of an assistant file deletion operation. + AssistantThread: + type: object + required: + - id + - object + - created_at + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread + description: The object type, which is always 'thread'. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: Information about a single thread associated with an assistant. + AssistantThreadCreationOptions: + type: object + properties: + messages: + type: array + items: + $ref: '#/components/schemas/ThreadInitializationMessage' + description: The initial messages to associate with the new thread. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The details used to create a new assistant thread. + CodeInterpreterToolDefinition: + type: object + required: + - type + properties: + type: + type: string + enum: + - code_interpreter + description: The object type, which is always 'code_interpreter'. + allOf: + - $ref: '#/components/schemas/ToolDefinition' + description: The input definition information for a code interpreter tool as used to configure an assistant. + CreateAndRunThreadOptions: + type: object + required: + - assistant_id + properties: + assistant_id: + type: string + description: The ID of the assistant for which the thread should be created. + thread: + allOf: + - $ref: '#/components/schemas/AssistantThreadCreationOptions' + description: The details used to create the new thread. + model: + type: string + description: The overridden model that the assistant should use to run the thread. + instructions: + type: string + description: The overridden system instructions the assistant should use to run the thread. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The overridden list of enabled tools the assistant should use to run the thread. + stream: + type: boolean + 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. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The details used when creating and immediately running a new assistant thread. + CreateRunOptions: + type: object + required: + - assistant_id + properties: + assistant_id: + type: string + description: The ID of the assistant that should run the thread. + model: + type: string + nullable: true + description: The overridden model name that the assistant should use to run the thread. + instructions: + type: string + nullable: true + description: The overridden system instructions that the assistant should use to run the thread. + additional_instructions: + type: string + nullable: true + description: |- + Additional instructions to append 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. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + nullable: true + description: The overridden list of enabled tools that the assistant should use to run the thread. + stream: + type: boolean + 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. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The details used when creating a new run of an assistant thread. + FileDeletionStatus: + type: object + required: + - id + - deleted + - object + properties: + id: + type: string + description: The ID of the resource specified for deletion. + deleted: + type: boolean + description: A value indicating whether deletion was successful. + object: + type: string + enum: + - file + description: The object type, which is always 'file'. + description: A status response from a file deletion operation. + FileListResponse: + type: object + required: + - object + - data + properties: + object: + type: string + enum: + - list + description: The object type, which is always 'list'. + data: + type: array + items: + $ref: '#/components/schemas/OpenAIFile' + description: The files returned for the request. + description: The response data from a file list operation. + FilePurpose: + anyOf: + - type: string + - type: string + enum: + - fine-tune + - fine-tune-results + - assistants + - assistants_output + description: The possible values denoting the intended usage of a file. + FunctionDefinition: + type: object + required: + - name + - parameters + properties: + name: + type: string + description: The name of the function to be called. + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + parameters: + description: The parameters the functions accepts, described as a JSON Schema object. + description: The input definition information for a function. + FunctionToolDefinition: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The object type, which is always 'function'. + function: + allOf: + - $ref: '#/components/schemas/FunctionDefinition' + description: The definition of the concrete function that the function tool should call. + allOf: + - $ref: '#/components/schemas/ToolDefinition' + description: The input definition information for a function tool as used to configure an assistant. + ListSortOrder: + anyOf: + - type: string + - type: string + enum: + - asc + - desc + description: The available sorting options when requesting a list of response objects. + MessageContent: + type: object + required: + - type + properties: + type: + type: string + description: The object type. + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/MessageTextContent' + image_file: '#/components/schemas/MessageImageFileContent' + description: An abstract representation of a single item of thread message content. + MessageDelta: + type: object + required: + - role + - content + properties: + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The entity that produced the message. + content: + type: array + items: + $ref: '#/components/schemas/MessageDeltaContent' + description: The content of the message as an array of text and/or images. + file_ids: + type: array + items: + type: string + description: A list of file IDs that the assistant can use. + default: [] + description: Represents the typed 'delta' payload within a streaming message delta chunk. + MessageDeltaChunk: + type: object + required: + - id + - object + - delta + properties: + id: + type: string + description: The identifier of the message, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message.delta + description: The object type, which is always `thread.message.delta`. + delta: + allOf: + - $ref: '#/components/schemas/MessageDelta' + description: The delta containing the fields that have changed on the Message. + description: Represents a message delta i.e. any changed fields on a message during streaming. + MessageDeltaContent: + type: object + required: + - index + - type + properties: + index: + type: integer + format: int32 + description: The index of the content part of the message. + type: + type: string + description: The type of content for this content part. + discriminator: + propertyName: type + mapping: + image_file: '#/components/schemas/MessageDeltaImageFileContent' + text: '#/components/schemas/MessageDeltaTextContentObject' + description: The abstract base representation of a partial streamed message content payload. + MessageDeltaImageFileContent: + type: object + required: + - type + properties: + type: + type: string + enum: + - image_file + description: The type of content for this content part, which is always "image_file." + image_file: + allOf: + - $ref: '#/components/schemas/MessageDeltaImageFileContentObject' + description: The image_file data. + allOf: + - $ref: '#/components/schemas/MessageDeltaContent' + description: Represents a streamed image file content part within a streaming message delta chunk. + MessageDeltaImageFileContentObject: + type: object + properties: + file_id: + type: string + description: The file ID of the image in the message content. + description: Represents the 'image_file' payload within streaming image file content. + MessageDeltaTextAnnotation: + type: object + required: + - index + - type + - start_index + - end_index + properties: + index: + type: integer + format: int32 + description: The index of the annotation within a text content part. + type: + type: string + description: The type of the text content annotation. + start_index: + type: integer + format: int32 + description: The start index of this annotation in the content text. + end_index: + type: integer + format: int32 + description: The end index of this annotation in the content text. + discriminator: + propertyName: type + mapping: + file_citation: '#/components/schemas/MessageDeltaTextFileCitationAnnotationObject' + file_path: '#/components/schemas/MessageDeltaTextFilePathAnnotationObject' + description: The abstract base representation of a streamed text content part's text annotation. + MessageDeltaTextContent: + type: object + properties: + value: + type: string + description: The data that makes up the text. + annotations: + type: array + items: + $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Annotations for the text. + description: Represents the data of a streamed text content part within a streaming message delta chunk. + MessageDeltaTextContentObject: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: The type of content for this content part, which is always "text." + text: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextContent' + description: The text content details. + allOf: + - $ref: '#/components/schemas/MessageDeltaContent' + description: Represents a streamed text content part within a streaming message delta chunk. + MessageDeltaTextFileCitationAnnotation: + type: object + properties: + file_id: + type: string + description: The ID of the specific file the citation is from. + quote: + type: string + description: The specific quote in the cited file. + description: Represents the data of a streamed file citation as applied to a streaming text content part. + MessageDeltaTextFileCitationAnnotationObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_citation + description: The type of the text content annotation, which is always "file_citation." + file_citation: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextFileCitationAnnotationObject' + description: The file citation information. + allOf: + - $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Represents a streamed file citation applied to a streaming text content part. + MessageDeltaTextFilePathAnnotation: + type: object + properties: + file_id: + type: string + description: The file ID for the annotation. + description: Represents the data of a streamed file path annotation as applied to a streaming text content part. + MessageDeltaTextFilePathAnnotationObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_path + description: The type of the text content annotation, which is always "file_path." + file_path: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextFilePathAnnotationObject' + description: The file path information. + allOf: + - $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Represents a streamed file path annotation applied to a streaming text content part. + MessageFile: + type: object + required: + - id + - object + - created_at + - message_id + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message.file + description: The object type, which is always 'thread.message.file'. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + message_id: + type: string + description: The ID of the message that this file is attached to. + description: Information about a file attached to an assistant thread message. + MessageImageFileContent: + type: object + required: + - type + - image_file + properties: + type: + type: string + enum: + - image_file + description: The object type, which is always 'image_file'. + image_file: + allOf: + - $ref: '#/components/schemas/MessageImageFileDetails' + description: The image file for this thread message content item. + allOf: + - $ref: '#/components/schemas/MessageContent' + description: A representation of image file content in a thread message. + MessageImageFileDetails: + type: object + required: + - file_id + properties: + file_id: + type: string + description: The ID for the file associated with this image. + description: An image reference, as represented in thread message content. + MessageIncompleteDetails: + type: object + required: + - reason + properties: + reason: + allOf: + - $ref: '#/components/schemas/MessageIncompleteDetailsReason' + description: The provided reason describing why the message was marked as incomplete. + description: Information providing additional detail about a message entering an incomplete status. + MessageIncompleteDetailsReason: + type: string + enum: + - content_filter + - max_tokens + - run_cancelled + - run_failed + description: A set of reasons describing why a message is marked as incomplete. + MessageRole: + anyOf: + - type: string + - type: string + enum: + - user + - assistant + description: The possible values for roles attributed to messages in a thread. + MessageStatus: + type: string + enum: + - in_progress + - incomplete + - completed + description: The possible execution status values for a thread message. + MessageTextAnnotation: + type: object + required: + - type + - text + - start_index + - end_index + properties: + type: + type: string + description: The object type. + text: + type: string + description: The textual content associated with this text annotation item. + start_index: + type: integer + format: int32 + description: The first text index associated with this text annotation. + end_index: + type: integer + format: int32 + description: The last text index associated with this text annotation. + discriminator: + propertyName: type + mapping: + file_citation: '#/components/schemas/MessageTextFileCitationAnnotation' + file_path: '#/components/schemas/MessageTextFilePathAnnotation' + description: An abstract representation of an annotation to text thread message content. + MessageTextContent: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: The object type, which is always 'text'. + text: + allOf: + - $ref: '#/components/schemas/MessageTextDetails' + description: The text and associated annotations for this thread message content item. + allOf: + - $ref: '#/components/schemas/MessageContent' + description: A representation of a textual item of thread message content. + MessageTextDetails: + type: object + required: + - value + - annotations + properties: + value: + type: string + description: The text data. + annotations: + type: array + items: + $ref: '#/components/schemas/MessageTextAnnotation' + description: A list of annotations associated with this text. + description: The text and associated annotations for a single item of assistant thread message content. + MessageTextFileCitationAnnotation: + type: object + required: + - type + - file_citation + properties: + type: + type: string + enum: + - file_citation + description: The object type, which is always 'file_citation'. + file_citation: + allOf: + - $ref: '#/components/schemas/MessageTextFileCitationDetails' + description: |- + A citation within the message that points to a specific quote from a specific file. + Generated when the assistant uses the "retrieval" tool to search files. + allOf: + - $ref: '#/components/schemas/MessageTextAnnotation' + 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. + MessageTextFileCitationDetails: + type: object + required: + - file_id + - quote + properties: + file_id: + type: string + description: The ID of the file associated with this citation. + quote: + type: string + description: The specific quote cited in the associated file. + description: A representation of a file-based text citation, as used in a file-based annotation of text thread message content. + MessageTextFilePathAnnotation: + type: object + required: + - type + - file_path + properties: + type: + type: string + enum: + - file_path + description: The object type, which is always 'file_path'. + file_path: + allOf: + - $ref: '#/components/schemas/MessageTextFilePathDetails' + description: A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. + allOf: + - $ref: '#/components/schemas/MessageTextAnnotation' + description: A citation within the message that points to a file located at a specific path. + MessageTextFilePathDetails: + type: object + required: + - file_id + properties: + file_id: + type: string + description: The ID of the specific file that the citation is from. + description: An encapsulation of an image file ID, as used by message image content. + OpenAIFile: + type: object + required: + - object + - id + - bytes + - filename + - created_at + - purpose + properties: + object: + type: string + enum: + - file + description: The object type, which is always 'file'. + id: + type: string + description: The identifier, which can be referenced in API endpoints. + bytes: + type: integer + format: int32 + description: The size of the file, in bytes. + filename: + type: string + description: The name of the file. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + purpose: + allOf: + - $ref: '#/components/schemas/FilePurpose' + description: The intended purpose of a file. + description: Represents an assistant that can call the model and use tools. + RequiredAction: + type: object + required: + - type + properties: + type: + type: string + description: The object type. + discriminator: + propertyName: type + mapping: + submit_tool_outputs: '#/components/schemas/SubmitToolOutputsAction' + description: An abstract representation of a required action for an assistant thread run to continue. + RequiredFunctionToolCall: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The object type of the required tool call. Always 'function' for function tools. + function: + allOf: + - $ref: '#/components/schemas/RequiredFunctionToolCallDetails' + description: Detailed information about the function to be executed by the tool that includes name and arguments. + allOf: + - $ref: '#/components/schemas/RequiredToolCall' + description: A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. + RequiredFunctionToolCallDetails: + type: object + required: + - name + - arguments + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. + description: The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function. + RequiredToolCall: + type: object + required: + - type + - id + properties: + type: + type: string + description: The object type for the required tool call. + id: + type: string + description: The ID of the tool call. This ID must be referenced when submitting tool outputs. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/RequiredFunctionToolCall' + description: An abstract representation a a tool invocation needed by the model to continue a run. + RetrievalToolDefinition: + type: object + required: + - type + properties: + type: + type: string + enum: + - retrieval + description: The object type, which is always 'retrieval'. + allOf: + - $ref: '#/components/schemas/ToolDefinition' + description: The input definition information for a retrieval tool as used to configure an assistant. + RunError: + type: object + required: + - code + - message + properties: + code: + type: string + description: The status for the error. + message: + type: string + description: The human-readable text associated with the error. + description: The details of an error as encountered by an assistant thread run. + RunStatus: + anyOf: + - type: string + - type: string + enum: + - queued + - in_progress + - requires_action + - cancelling + - cancelled + - failed + - completed + - expired + description: Possible values for the status of an assistant thread run. + RunStep: + type: object + required: + - id + - object + - type + - assistant_id + - thread_id + - run_id + - status + - step_details + - last_error + - created_at + - expired_at + - completed_at + - cancelled_at + - failed_at + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.run.step + description: The object type, which is always 'thread.run.step'. + type: + allOf: + - $ref: '#/components/schemas/RunStepType' + description: The type of run step, which can be either message_creation or tool_calls. + assistant_id: + type: string + description: The ID of the assistant associated with the run step. + thread_id: + type: string + description: The ID of the thread that was run. + run_id: + type: string + description: The ID of the run that this run step is a part of. + status: + allOf: + - $ref: '#/components/schemas/RunStepStatus' + description: The status of this run step. + step_details: + allOf: + - $ref: '#/components/schemas/RunStepDetails' + description: The details for this run step. + last_error: + type: object + allOf: + - $ref: '#/components/schemas/RunStepError' + nullable: true + description: If applicable, information about the last error encountered by this run step. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + expired_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this item expired. + completed_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this completed. + cancelled_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this was cancelled. + failed_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this failed. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: Detailed information about a single step of an assistant thread run. + RunStepCodeInterpreterImageOutput: + type: object + required: + - type + - image + properties: + type: + type: string + enum: + - image + description: The object type, which is always 'image'. + image: + allOf: + - $ref: '#/components/schemas/RunStepCodeInterpreterImageReference' + description: Referential information for the image associated with this output. + allOf: + - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' + description: A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. + RunStepCodeInterpreterImageReference: + type: object + required: + - file_id + properties: + file_id: + type: string + description: The ID of the file associated with this image. + description: An image reference emitted by a code interpreter tool in response to a tool call by the model. + RunStepCodeInterpreterLogOutput: + type: object + required: + - type + - logs + properties: + type: + type: string + enum: + - logs + description: The object type, which is always 'logs'. + logs: + type: string + description: The serialized log output emitted by the code interpreter. + allOf: + - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' + description: A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. + RunStepCodeInterpreterToolCall: + type: object + required: + - type + - code_interpreter + properties: + type: + type: string + enum: + - code_interpreter + description: The object type, which is always 'code_interpreter'. + code_interpreter: + allOf: + - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallDetails' + description: The details of the tool call to the code interpreter tool. + allOf: + - $ref: '#/components/schemas/RunStepToolCall' + description: |- + A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that + represents inputs and outputs consumed and emitted by the code interpreter. + RunStepCodeInterpreterToolCallDetails: + type: object + required: + - input + - outputs + properties: + input: + type: string + description: The input provided by the model to the code interpreter tool. + outputs: + type: array + items: + $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' + description: The outputs produced by the code interpreter tool back to the model in response to the tool call. + description: The detailed information about a code interpreter invocation by the model. + RunStepCodeInterpreterToolCallOutput: + type: object + required: + - type + properties: + type: + type: string + description: The object type. + discriminator: + propertyName: type + mapping: + logs: '#/components/schemas/RunStepCodeInterpreterLogOutput' + image: '#/components/schemas/RunStepCodeInterpreterImageOutput' + description: An abstract representation of an emitted output from a code interpreter tool. + RunStepDeltaChunk: + type: object + required: + - id + - object + - delta + properties: + id: + type: string + description: The identifier of the run step, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.run.step.delta + description: The object type, which is always `thread.run.step.delta`. + delta: + allOf: + - $ref: '#/components/schemas/RunStepDeltaChunkObject' + description: The delta containing the fields that have changed on the run step. + description: Represents a run step delta i.e. any changed fields on a run step during streaming. + RunStepDeltaChunkObject: + type: object + properties: + step_details: + type: array + items: + $ref: '#/components/schemas/RunStepDeltaDetail' + description: The details of the run step. + description: Represents the delta payload in a streaming run step delta chunk. + RunStepDeltaCodeInterpreterDetailItemObject: + type: object + required: + - input + properties: + input: + type: string + description: The input into the Code Interpreter tool call. + outputs: + type: array + items: + $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + 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. + description: Represents the Code Interpreter tool call data in a streaming run step's tool calls. + RunStepDeltaCodeInterpreterImageOutput: + type: object + required: + - type + properties: + type: + type: string + enum: + - image + description: The object type, which is always "image." + image: + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutputObject' + description: The image data for the Code Interpreter tool call output. + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + description: Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. + RunStepDeltaCodeInterpreterImageOutputObject: + type: object + properties: + file_id: + type: string + description: The file ID for the image. + description: Represents the data for a streaming run step's Code Interpreter tool call image output. + RunStepDeltaCodeInterpreterLogOutput: + type: object + required: + - type + properties: + type: + type: string + enum: + - logs + description: The type of the object, which is always "logs." + logs: + type: string + description: The text output from the Code Interpreter tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + description: Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. + RunStepDeltaCodeInterpreterOutput: + type: object + required: + - index + - type + properties: + index: + type: integer + format: int32 + description: The index of the output in the streaming run step tool call's Code Interpreter outputs array. + type: + type: string + description: The type of the streaming run step tool call's Code Interpreter output. + discriminator: + propertyName: type + mapping: + logs: '#/components/schemas/RunStepDeltaCodeInterpreterLogOutput' + image: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutput' + description: The abstract base representation of a streaming run step tool call's Code Interpreter tool output. + RunStepDeltaCodeInterpreterToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - code_interpreter + description: The object type, which is always "code_interpreter." + code_interpreter: + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterDetailItemObject' + description: The Code Interpreter data for the tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a Code Interpreter tool call within a streaming run step's tool call details. + RunStepDeltaDetail: + type: object + required: + - type + properties: + type: + type: string + description: The object type for the run step detail object. + discriminator: + propertyName: type + mapping: + message_creation: '#/components/schemas/RunStepDeltaMessageCreation' + tool_calls: '#/components/schemas/RunStepDeltaToolCallObject' + description: Represents a single run step detail item in a streaming run step's delta payload. + RunStepDeltaFunction: + type: object + required: + - name + - arguments + - output + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments passed to the function as input. + output: + type: string + nullable: true + description: The output of the function, null if outputs have not yet been submitted. + description: Represents the function data in a streaming run step delta's function tool call. + RunStepDeltaFunctionToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - function + description: The object type, which is always "function." + function: + allOf: + - $ref: '#/components/schemas/RunStepDeltaFunction' + description: The function data for the tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a function tool call within a streaming run step's tool call details. + RunStepDeltaMessageCreation: + type: object + required: + - type + - message_creation + properties: + type: + type: string + enum: + - message_creation + - tool_calls + description: The object type, which is always "message_creation." + message_creation: + allOf: + - $ref: '#/components/schemas/RunStepDeltaMessageCreationObject' + description: The message creation data. + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: Represents a message creation within a streaming run step delta. + RunStepDeltaMessageCreationObject: + type: object + properties: + message_id: + type: string + description: The ID of the newly-created message. + description: Represents the data within a streaming run step message creation response object. + RunStepDeltaRetrievalToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - retrieval + description: The object type, which is always "retrieval." + retrieval: + type: object + additionalProperties: + type: string + nullable: true + description: Reserved for future use. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a retrieval tool call within a streaming run step's tool call details. + RunStepDeltaToolCall: + type: object + required: + - index + - id + - type + properties: + index: + type: integer + format: int32 + description: The index of the tool call detail in the run step's tool_calls array. + id: + type: string + description: The ID of the tool call, used when submitting outputs to the run. + type: + type: string + description: The type of the tool call detail item in a streaming run step's details. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/RunStepDeltaFunctionToolCall' + retrieval: '#/components/schemas/RunStepDeltaRetrievalToolCall' + code_interpreter: '#/components/schemas/RunStepDeltaCodeInterpreterToolCall' + description: The abstract base representation of a single tool call within a streaming run step's delta tool call details. + RunStepDeltaToolCallObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - tool_calls + description: The object type, which is always "tool_calls." + tool_calls: + type: array + items: + $ref: '#/components/schemas/RunStepDeltaToolCall' + description: The collection of tool calls for the tool call detail item. + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: Represents an invocation of tool calls as part of a streaming run step. + RunStepDetails: + type: object + required: + - type + properties: + type: + allOf: + - $ref: '#/components/schemas/RunStepType' + description: The object type. + discriminator: + propertyName: type + mapping: + message_creation: '#/components/schemas/RunStepMessageCreationDetails' + tool_calls: '#/components/schemas/RunStepToolCallDetails' + description: An abstract representation of the details for a run step. + RunStepError: + type: object + required: + - code + - message + properties: + code: + allOf: + - $ref: '#/components/schemas/RunStepErrorCode' + description: The error code for this error. + message: + type: string + description: The human-readable text associated with this error. + description: The error information associated with a failed run step. + RunStepErrorCode: + anyOf: + - type: string + - type: string + enum: + - server_error + - rate_limit_exceeded + description: Possible error code values attributable to a failed run step. + RunStepFunctionToolCall: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The object type, which is always 'function'. + function: + allOf: + - $ref: '#/components/schemas/RunStepFunctionToolCallDetails' + description: The detailed information about the function called by the model. + allOf: + - $ref: '#/components/schemas/RunStepToolCall' + description: |- + A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs + and output consumed and emitted by the specified function. + RunStepFunctionToolCallDetails: + type: object + required: + - name + - arguments + - output + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments that the model requires are provided to the named function. + output: + type: string + nullable: true + description: The output of the function, only populated for function calls that have already have had their outputs submitted. + description: The detailed information about the function called by the model. + RunStepMessageCreationDetails: + type: object + required: + - type + - message_creation + properties: + type: + type: string + enum: + - message_creation + - tool_calls + description: The object type, which is always 'message_creation'. + message_creation: + allOf: + - $ref: '#/components/schemas/RunStepMessageCreationReference' + description: Information about the message creation associated with this run step. + allOf: + - $ref: '#/components/schemas/RunStepDetails' + description: The detailed information associated with a message creation run step. + RunStepMessageCreationReference: + type: object + required: + - message_id + properties: + message_id: + type: string + description: The ID of the message created by this run step. + description: The details of a message created as a part of a run step. + RunStepRetrievalToolCall: + type: object + required: + - type + - retrieval + properties: + type: + type: string + enum: + - retrieval + description: The object type, which is always 'retrieval'. + retrieval: + type: object + additionalProperties: + type: string + description: The key/value pairs produced by the retrieval tool. + allOf: + - $ref: '#/components/schemas/RunStepToolCall' + description: |- + A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents + executed retrieval actions. + RunStepStatus: + anyOf: + - type: string + - type: string + enum: + - in_progress + - cancelled + - failed + - completed + - expired + description: Possible values for the status of a run step. + RunStepToolCall: + type: object + required: + - type + - id + properties: + type: + type: string + description: The object type. + id: + type: string + description: The ID of the tool call. This ID must be referenced when you submit tool outputs. + discriminator: + propertyName: type + mapping: + code_interpreter: '#/components/schemas/RunStepCodeInterpreterToolCall' + retrieval: '#/components/schemas/RunStepRetrievalToolCall' + function: '#/components/schemas/RunStepFunctionToolCall' + description: An abstract representation of a detailed tool call as recorded within a run step for an existing run. + RunStepToolCallDetails: + type: object + required: + - type + - tool_calls + properties: + type: + type: string + enum: + - tool_calls + description: The object type, which is always 'tool_calls'. + tool_calls: + type: array + items: + $ref: '#/components/schemas/RunStepToolCall' + description: A list of tool call details for this run step. + allOf: + - $ref: '#/components/schemas/RunStepDetails' + description: The detailed information associated with a run step calling tools. + RunStepType: + anyOf: + - type: string + - type: string + enum: + - message_creation + - tool_calls + description: The possible types of run steps. + ServiceApiVersions: + type: string + enum: + - 2024-02-15-preview + - placeholder-for-future-release + description: The known set of supported API versions. + SubmitToolOutputsAction: + type: object + required: + - type + - submit_tool_outputs + properties: + type: + type: string + enum: + - submit_tool_outputs + description: The object type, which is always 'submit_tool_outputs'. + submit_tool_outputs: + allOf: + - $ref: '#/components/schemas/SubmitToolOutputsDetails' + description: The details describing tools that should be called to submit tool outputs. + allOf: + - $ref: '#/components/schemas/RequiredAction' + description: The details for required tool calls that must be submitted for an assistant thread run to continue. + SubmitToolOutputsDetails: + type: object + required: + - tool_calls + properties: + tool_calls: + type: array + items: + $ref: '#/components/schemas/RequiredToolCall' + description: The list of tool calls that must be resolved for the assistant thread run to continue. + description: The details describing tools that should be called to submit tool outputs. + ThreadDeletionStatus: + type: object + required: + - id + - deleted + - object + properties: + id: + type: string + description: The ID of the resource specified for deletion. + deleted: + type: boolean + description: A value indicating whether deletion was successful. + object: + type: string + enum: + - thread.deleted + description: The object type, which is always 'thread.deleted'. + description: The status of a thread deletion operation. + ThreadInitializationMessage: + type: object + required: + - role + - content + properties: + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread. + content: + type: string + description: The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API. + file_ids: + type: array + items: + type: string + description: |- + A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can + access files. + default: [] + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: A single message within an assistant thread, as provided during that thread's creation for its initial state. + ThreadMessage: + type: object + required: + - id + - object + - created_at + - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at + - role + - content + - file_ids + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message + description: The object type, which is always 'thread.message'. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + thread_id: + type: string + description: The ID of the thread that this message belongs to. + status: + allOf: + - $ref: '#/components/schemas/MessageStatus' + description: The status of the message. + incomplete_details: + oneOf: + - $ref: '#/components/schemas/MessageIncompleteDetailsReason' + nullable: true + description: On an incomplete message, details about why the message is incomplete. + completed_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp (in seconds) for when the message was completed. + incomplete_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp (in seconds) for when the message was marked as incomplete. + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The role associated with the assistant thread message. + content: + type: array + items: + $ref: '#/components/schemas/MessageContent' + description: The list of content items associated with the assistant thread message. + assistant_id: + type: string + description: If applicable, the ID of the assistant that authored this message. + run_id: + type: string + description: If applicable, the ID of the run associated with the authoring of this message. + file_ids: + type: array + items: + type: string + description: |- + A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can + access files. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: A single, existing message within an assistant thread. + ThreadRun: + type: object + required: + - id + - object + - thread_id + - assistant_id + - status + - last_error + - model + - instructions + - tools + - file_ids + - created_at + - expires_at + - started_at + - completed_at + - cancelled_at + - failed_at + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.run + description: The object type, which is always 'thread.run'. + thread_id: + type: string + description: The ID of the thread associated with this run. + assistant_id: + type: string + description: The ID of the assistant associated with the thread this run was performed against. + status: + allOf: + - $ref: '#/components/schemas/RunStatus' + description: The status of the assistant thread run. + required_action: + type: object + allOf: + - $ref: '#/components/schemas/RequiredAction' + nullable: true + description: The details of the action required for the assistant thread run to continue. + last_error: + type: object + allOf: + - $ref: '#/components/schemas/RunError' + nullable: true + description: The last error, if any, encountered by this assistant thread run. + model: + type: string + description: The ID of the model to use. + instructions: + type: string + description: The overridden system instructions used for this assistant thread run. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The overridden enabled tools used for this assistant thread run. + default: [] + file_ids: + type: array + items: + type: string + description: A list of attached file IDs, ordered by creation date in ascending order. + default: [] + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + expires_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this item expires. + started_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this item was started. + completed_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this completed. + cancelled_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this was cancelled. + failed_at: + type: string + format: date-time + nullable: true + description: The Unix timestamp, in seconds, representing when this failed. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: Data representing a single evaluation run of an assistant thread. + ToolDefinition: + type: object + required: + - type + properties: + type: + type: string + description: The object type. + discriminator: + propertyName: type + mapping: + code_interpreter: '#/components/schemas/CodeInterpreterToolDefinition' + retrieval: '#/components/schemas/RetrievalToolDefinition' + function: '#/components/schemas/FunctionToolDefinition' + description: An abstract representation of an input tool definition that an assistant can use. + ToolOutput: + type: object + properties: + tool_call_id: + type: string + description: The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. + output: + type: string + description: The output from the tool to be submitted. + description: The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. + UpdateAssistantOptions: + type: object + properties: + model: + type: string + description: The ID of the model to use. + name: + type: string + nullable: true + description: The modified name for the assistant to use. + description: + type: string + nullable: true + description: The modified description for the assistant to use. + instructions: + type: string + nullable: true + description: The modified system instructions for the new assistant to use. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The modified collection of tools to enable for the assistant. + default: [] + file_ids: + type: array + items: + type: string + description: The modified list of previously uploaded fileIDs to attach to the assistant. + default: [] + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The request details to use when modifying an existing assistant. + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: api-key + OAuth2Auth: + type: oauth2 + flows: + implicit: + authorizationUrl: https://login.microsoftonline.com/common/oauth2/v2.0/authorize + scopes: + https://cognitiveservices.azure.com/.default: '' +servers: + - url: '{endpoint}' + description: Azure OpenAI APIs for Assistants. + variables: + endpoint: + default: '' + description: An OpenAI endpoint supporting assistants functionality. From c740a1cb0cc3f2eb63b5f83723fbf3593aad1451 Mon Sep 17 00:00:00 2001 From: Travis Wilson Date: Mon, 8 Apr 2024 14:23:29 -0700 Subject: [PATCH 02/25] merge + pr feedback --- .../ai/OpenAI.Assistants/messages/models.tsp | 62 ++++--- .../ai/OpenAI.Assistants/run_steps/models.tsp | 13 +- .../assistants_generated.json | 76 +++++---- .../assistants_generated.json | 84 +++++----- .../assistants_generated.yaml | 63 ++++---- .../assistants_generated.yaml | 152 +++++++++--------- 6 files changed, 251 insertions(+), 199 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/messages/models.tsp b/specification/ai/OpenAI.Assistants/messages/models.tsp index cc142c4f732d..13083f754519 100644 --- a/specification/ai/OpenAI.Assistants/messages/models.tsp +++ b/specification/ai/OpenAI.Assistants/messages/models.tsp @@ -143,14 +143,6 @@ model MessageTextAnnotation { @doc("The textual content associated with this text annotation item.") text: string; - - @encodedName("application/json", "start_index") - @doc("The first text index associated with this text annotation.") - startIndex: int32; - - @encodedName("application/json", "end_index") - @doc("The last text index associated with this text annotation.") - endIndex: int32; } // File citation annotation + details @@ -167,6 +159,14 @@ model MessageTextFileCitationAnnotation extends MessageTextAnnotation { Generated when the assistant uses the "retrieval" tool to search files. """) fileCitation: MessageTextFileCitationDetails; + + @encodedName("application/json", "start_index") + @doc("The first text index associated with this text annotation.") + startIndex?: int32; + + @encodedName("application/json", "end_index") + @doc("The last text index associated with this text annotation.") + endIndex?: int32; } @doc("A representation of a file-based text citation, as used in a file-based annotation of text thread message content.") @@ -191,6 +191,14 @@ model MessageTextFilePathAnnotation extends MessageTextAnnotation { @encodedName("application/json", "file_path") @doc("A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.") filePath: MessageTextFilePathDetails; + + @encodedName("application/json", "start_index") + @doc("The first text index associated with this text annotation.") + startIndex?: int32; + + @encodedName("application/json", "end_index") + @doc("The last text index associated with this text annotation.") + endIndex?: int32; } @doc("An encapsulation of an image file ID, as used by message image content.") @@ -234,7 +242,9 @@ model MessageFile { /** The possible execution status values for a thread message. */ @added(ServiceApiVersions.vFuturePlaceholder) -enum MessageStatus { +union MessageStatus { + string, + /** A run is currently creating this message. */ inProgress: "in_progress", @@ -254,7 +264,9 @@ model MessageIncompleteDetails { /** A set of reasons describing why a message is marked as incomplete. */ @added(ServiceApiVersions.vFuturePlaceholder) -enum MessageIncompleteDetailsReason { +union MessageIncompleteDetailsReason { + string, + /** The run generating the message was terminated due to content filter flagging. */ contentFilter: "content_filter", @@ -336,7 +348,7 @@ model MessageDeltaTextContentObject extends MessageDeltaContent { type: "text"; /** The text content details. */ - text: MessageDeltaTextContent; + text?: MessageDeltaTextContent; } /** Represents the data of a streamed text content part within a streaming message delta chunk. */ @@ -358,14 +370,6 @@ model MessageDeltaTextAnnotation { /** The type of the text content annotation. */ type: string; - - /** The start index of this annotation in the content text. */ - @encodedName("application/json", "start_index") - startIndex: int32; - - /** The end index of this annotation in the content text. */ - @encodedName("application/json", "end_index") - endIndex: int32; } /** Represents a streamed file citation applied to a streaming text content part. */ @@ -377,7 +381,15 @@ model MessageDeltaTextFileCitationAnnotationObject /** The file citation information. */ @encodedName("application/json", "file_citation") - fileCitation?: MessageDeltaTextFileCitationAnnotationObject; + fileCitation?: MessageDeltaTextFileCitationAnnotation; + + /** The start index of this annotation in the content text. */ + @encodedName("application/json", "start_index") + startIndex?: int32; + + /** The end index of this annotation in the content text. */ + @encodedName("application/json", "end_index") + endIndex?: int32; } /** Represents the data of a streamed file citation as applied to a streaming text content part. */ @@ -400,7 +412,15 @@ model MessageDeltaTextFilePathAnnotationObject /** The file path information. */ @encodedName("application/json", "file_path") - filePath?: MessageDeltaTextFilePathAnnotationObject; + filePath?: MessageDeltaTextFilePathAnnotation; + + /** The start index of this annotation in the content text. */ + @encodedName("application/json", "start_index") + startIndex?: int32; + + /** The end index of this annotation in the content text. */ + @encodedName("application/json", "end_index") + endIndex?: int32; } /** Represents the data of a streamed file path annotation as applied to a streaming text content part. */ diff --git a/specification/ai/OpenAI.Assistants/run_steps/models.tsp b/specification/ai/OpenAI.Assistants/run_steps/models.tsp index 6c7f00dbc816..cdb0a7eeb6db 100644 --- a/specification/ai/OpenAI.Assistants/run_steps/models.tsp +++ b/specification/ai/OpenAI.Assistants/run_steps/models.tsp @@ -180,15 +180,15 @@ model RunStepDeltaChunk { object: "thread.run.step.delta"; /** The delta containing the fields that have changed on the run step. */ - delta: RunStepDeltaChunkObject; + delta: RunStepDelta; } /** Represents the delta payload in a streaming run step delta chunk. */ @added(ServiceApiVersions.vFuturePlaceholder) -model RunStepDeltaChunkObject { +model RunStepDelta { /** The details of the run step. */ @encodedName("application/json", "step_details") - stepDetails?: RunStepDeltaDetail[]; + stepDetails?: RunStepDeltaDetail; } /** Represents a single run step detail item in a streaming run step's delta payload. */ @@ -207,7 +207,7 @@ model RunStepDeltaMessageCreation extends RunStepDeltaDetail { /** The message creation data. */ @encodedName("application/json", "message_creation") - messageCreation: RunStepDeltaMessageCreationObject; + messageCreation?: RunStepDeltaMessageCreationObject; } /** Represents the data within a streaming run step message creation response object. */ @@ -260,8 +260,7 @@ model RunStepDeltaRetrievalToolCall extends RunStepDeltaToolCall { type: "retrieval"; /** Reserved for future use. */ - #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - retrieval?: Record | null; + retrieval?: Record; } /** Represents a Code Interpreter tool call within a streaming run step's tool call details. */ @@ -293,7 +292,7 @@ model RunStepDeltaFunction { @added(ServiceApiVersions.vFuturePlaceholder) model RunStepDeltaCodeInterpreterDetailItemObject { /** The input into the Code Interpreter tool call. */ - input: string; + input?: string; /** * The outputs from the Code Interpreter tool call. Code Interpreter can output one or more diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json index fa94a2de4c62..acf4c21a668b 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json @@ -2318,26 +2318,12 @@ "text": { "type": "string", "description": "The textual content associated with this text annotation item." - }, - "start_index": { - "type": "integer", - "format": "int32", - "description": "The first text index associated with this text annotation.", - "x-ms-client-name": "startIndex" - }, - "end_index": { - "type": "integer", - "format": "int32", - "description": "The last text index associated with this text annotation.", - "x-ms-client-name": "endIndex" } }, "discriminator": "type", "required": [ "type", - "text", - "start_index", - "end_index" + "text" ] }, "MessageTextContent": { @@ -2389,6 +2375,18 @@ "$ref": "#/definitions/MessageTextFileCitationDetails", "description": "A citation within the message that points to a specific quote from a specific file.\nGenerated when the assistant uses the \"retrieval\" tool to search files.", "x-ms-client-name": "fileCitation" + }, + "start_index": { + "type": "integer", + "format": "int32", + "description": "The first text index associated with this text annotation.", + "x-ms-client-name": "startIndex" + }, + "end_index": { + "type": "integer", + "format": "int32", + "description": "The last text index associated with this text annotation.", + "x-ms-client-name": "endIndex" } }, "required": [ @@ -2428,6 +2426,18 @@ "$ref": "#/definitions/MessageTextFilePathDetails", "description": "A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.", "x-ms-client-name": "filePath" + }, + "start_index": { + "type": "integer", + "format": "int32", + "description": "The first text index associated with this text annotation.", + "x-ms-client-name": "startIndex" + }, + "end_index": { + "type": "integer", + "format": "int32", + "description": "The last text index associated with this text annotation.", + "x-ms-client-name": "endIndex" } }, "required": [ @@ -2723,29 +2733,29 @@ "x-ms-client-name": "createdAt" }, "expired_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this item expired.", "x-nullable": true, "x-ms-client-name": "expiredAt" }, "completed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this completed.", "x-nullable": true, "x-ms-client-name": "completedAt" }, "cancelled_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this was cancelled.", "x-nullable": true, "x-ms-client-name": "cancelledAt" }, "failed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this failed.", "x-nullable": true, "x-ms-client-name": "failedAt" @@ -3415,36 +3425,36 @@ "x-ms-client-name": "createdAt" }, "expires_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this item expires.", "x-nullable": true, "x-ms-client-name": "expiresAt" }, "started_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this item was started.", "x-nullable": true, "x-ms-client-name": "startedAt" }, "completed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this completed.", "x-nullable": true, "x-ms-client-name": "completedAt" }, "cancelled_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this was cancelled.", "x-nullable": true, "x-ms-client-name": "cancelledAt" }, "failed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this failed.", "x-nullable": true, "x-ms-client-name": "failedAt" diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json index 983a1b09f4d5..f826d080ee4e 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json @@ -2396,26 +2396,12 @@ "text": { "type": "string", "description": "The textual content associated with this text annotation item." - }, - "start_index": { - "type": "integer", - "format": "int32", - "description": "The first text index associated with this text annotation.", - "x-ms-client-name": "startIndex" - }, - "end_index": { - "type": "integer", - "format": "int32", - "description": "The last text index associated with this text annotation.", - "x-ms-client-name": "endIndex" } }, "discriminator": "type", "required": [ "type", - "text", - "start_index", - "end_index" + "text" ] }, "MessageTextContent": { @@ -2467,6 +2453,18 @@ "$ref": "#/definitions/MessageTextFileCitationDetails", "description": "A citation within the message that points to a specific quote from a specific file.\nGenerated when the assistant uses the \"retrieval\" tool to search files.", "x-ms-client-name": "fileCitation" + }, + "start_index": { + "type": "integer", + "format": "int32", + "description": "The first text index associated with this text annotation.", + "x-ms-client-name": "startIndex" + }, + "end_index": { + "type": "integer", + "format": "int32", + "description": "The last text index associated with this text annotation.", + "x-ms-client-name": "endIndex" } }, "required": [ @@ -2506,6 +2504,18 @@ "$ref": "#/definitions/MessageTextFilePathDetails", "description": "A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.", "x-ms-client-name": "filePath" + }, + "start_index": { + "type": "integer", + "format": "int32", + "description": "The first text index associated with this text annotation.", + "x-ms-client-name": "startIndex" + }, + "end_index": { + "type": "integer", + "format": "int32", + "description": "The last text index associated with this text annotation.", + "x-ms-client-name": "endIndex" } }, "required": [ @@ -2801,29 +2811,29 @@ "x-ms-client-name": "createdAt" }, "expired_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this item expired.", "x-nullable": true, "x-ms-client-name": "expiredAt" }, "completed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this completed.", "x-nullable": true, "x-ms-client-name": "completedAt" }, "cancelled_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this was cancelled.", "x-nullable": true, "x-ms-client-name": "cancelledAt" }, "failed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this failed.", "x-nullable": true, "x-ms-client-name": "failedAt" @@ -3367,15 +3377,15 @@ "x-ms-client-name": "incompleteDetails" }, "completed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp (in seconds) for when the message was completed.", "x-nullable": true, "x-ms-client-name": "completedAt" }, "incomplete_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", "x-nullable": true, "x-ms-client-name": "incompleteAt" @@ -3521,36 +3531,36 @@ "x-ms-client-name": "createdAt" }, "expires_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this item expires.", "x-nullable": true, "x-ms-client-name": "expiresAt" }, "started_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this item was started.", "x-nullable": true, "x-ms-client-name": "startedAt" }, "completed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this completed.", "x-nullable": true, "x-ms-client-name": "completedAt" }, "cancelled_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this was cancelled.", "x-nullable": true, "x-ms-client-name": "cancelledAt" }, "failed_at": { - "type": "string", - "format": "date-time", + "type": "integer", + "format": "unixtime", "description": "The Unix timestamp, in seconds, representing when this failed.", "x-nullable": true, "x-ms-client-name": "failedAt" diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 5ffa869ef232..50f43e73f1ab 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -1566,8 +1566,6 @@ components: required: - type - text - - start_index - - end_index properties: type: type: string @@ -1575,14 +1573,6 @@ components: text: type: string description: The textual content associated with this text annotation item. - start_index: - type: integer - format: int32 - description: The first text index associated with this text annotation. - end_index: - type: integer - format: int32 - description: The last text index associated with this text annotation. discriminator: propertyName: type mapping: @@ -1639,6 +1629,14 @@ components: description: |- A citation within the message that points to a specific quote from a specific file. Generated when the assistant uses the "retrieval" tool to search files. + start_index: + type: integer + format: int32 + description: The first text index associated with this text annotation. + end_index: + type: integer + format: int32 + description: The last text index associated with this text annotation. allOf: - $ref: '#/components/schemas/MessageTextAnnotation' 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. @@ -1670,6 +1668,14 @@ components: allOf: - $ref: '#/components/schemas/MessageTextFilePathDetails' description: A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. + start_index: + type: integer + format: int32 + description: The first text index associated with this text annotation. + end_index: + type: integer + format: int32 + description: The last text index associated with this text annotation. allOf: - $ref: '#/components/schemas/MessageTextAnnotation' description: A citation within the message that points to a file located at a specific path. @@ -1876,23 +1882,23 @@ components: format: unixtime description: The Unix timestamp, in seconds, representing when this object was created. expired_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this item expired. completed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this completed. cancelled_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this was cancelled. failed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. metadata: @@ -2080,7 +2086,6 @@ components: type: string enum: - message_creation - - tool_calls description: The object type, which is always 'message_creation'. message_creation: allOf: @@ -2388,28 +2393,28 @@ components: format: unixtime description: The Unix timestamp, in seconds, representing when this object was created. expires_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this item expires. started_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this item was started. completed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this completed. cancelled_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this was cancelled. failed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. metadata: diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml index 8a67ca76099e..580075e1c513 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml @@ -1605,8 +1605,6 @@ components: required: - index - type - - start_index - - end_index properties: index: type: integer @@ -1615,14 +1613,6 @@ components: type: type: string description: The type of the text content annotation. - start_index: - type: integer - format: int32 - description: The start index of this annotation in the content text. - end_index: - type: integer - format: int32 - description: The end index of this annotation in the content text. discriminator: propertyName: type mapping: @@ -1645,7 +1635,6 @@ components: type: object required: - type - - text properties: type: type: string @@ -1681,8 +1670,16 @@ components: description: The type of the text content annotation, which is always "file_citation." file_citation: allOf: - - $ref: '#/components/schemas/MessageDeltaTextFileCitationAnnotationObject' + - $ref: '#/components/schemas/MessageDeltaTextFileCitationAnnotation' description: The file citation information. + start_index: + type: integer + format: int32 + description: The start index of this annotation in the content text. + end_index: + type: integer + format: int32 + description: The end index of this annotation in the content text. allOf: - $ref: '#/components/schemas/MessageDeltaTextAnnotation' description: Represents a streamed file citation applied to a streaming text content part. @@ -1705,8 +1702,16 @@ components: description: The type of the text content annotation, which is always "file_path." file_path: allOf: - - $ref: '#/components/schemas/MessageDeltaTextFilePathAnnotationObject' + - $ref: '#/components/schemas/MessageDeltaTextFilePathAnnotation' description: The file path information. + start_index: + type: integer + format: int32 + description: The start index of this annotation in the content text. + end_index: + type: integer + format: int32 + description: The end index of this annotation in the content text. allOf: - $ref: '#/components/schemas/MessageDeltaTextAnnotation' description: Represents a streamed file path annotation applied to a streaming text content part. @@ -1772,12 +1777,14 @@ components: description: The provided reason describing why the message was marked as incomplete. description: Information providing additional detail about a message entering an incomplete status. MessageIncompleteDetailsReason: - type: string - enum: - - content_filter - - max_tokens - - run_cancelled - - run_failed + anyOf: + - type: string + - type: string + enum: + - content_filter + - max_tokens + - run_cancelled + - run_failed description: A set of reasons describing why a message is marked as incomplete. MessageRole: anyOf: @@ -1788,19 +1795,19 @@ components: - assistant description: The possible values for roles attributed to messages in a thread. MessageStatus: - type: string - enum: - - in_progress - - incomplete - - completed + anyOf: + - type: string + - type: string + enum: + - in_progress + - incomplete + - completed description: The possible execution status values for a thread message. MessageTextAnnotation: type: object required: - type - text - - start_index - - end_index properties: type: type: string @@ -1808,14 +1815,6 @@ components: text: type: string description: The textual content associated with this text annotation item. - start_index: - type: integer - format: int32 - description: The first text index associated with this text annotation. - end_index: - type: integer - format: int32 - description: The last text index associated with this text annotation. discriminator: propertyName: type mapping: @@ -1872,6 +1871,14 @@ components: description: |- A citation within the message that points to a specific quote from a specific file. Generated when the assistant uses the "retrieval" tool to search files. + start_index: + type: integer + format: int32 + description: The first text index associated with this text annotation. + end_index: + type: integer + format: int32 + description: The last text index associated with this text annotation. allOf: - $ref: '#/components/schemas/MessageTextAnnotation' 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. @@ -1903,6 +1910,14 @@ components: allOf: - $ref: '#/components/schemas/MessageTextFilePathDetails' description: A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. + start_index: + type: integer + format: int32 + description: The first text index associated with this text annotation. + end_index: + type: integer + format: int32 + description: The last text index associated with this text annotation. allOf: - $ref: '#/components/schemas/MessageTextAnnotation' description: A citation within the message that points to a file located at a specific path. @@ -2109,23 +2124,23 @@ components: format: unixtime description: The Unix timestamp, in seconds, representing when this object was created. expired_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this item expired. completed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this completed. cancelled_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this was cancelled. failed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. metadata: @@ -2228,6 +2243,14 @@ components: logs: '#/components/schemas/RunStepCodeInterpreterLogOutput' image: '#/components/schemas/RunStepCodeInterpreterImageOutput' description: An abstract representation of an emitted output from a code interpreter tool. + RunStepDelta: + type: object + properties: + step_details: + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: The details of the run step. + description: Represents the delta payload in a streaming run step delta chunk. RunStepDeltaChunk: type: object required: @@ -2245,22 +2268,11 @@ components: description: The object type, which is always `thread.run.step.delta`. delta: allOf: - - $ref: '#/components/schemas/RunStepDeltaChunkObject' + - $ref: '#/components/schemas/RunStepDelta' description: The delta containing the fields that have changed on the run step. description: Represents a run step delta i.e. any changed fields on a run step during streaming. - RunStepDeltaChunkObject: - type: object - properties: - step_details: - type: array - items: - $ref: '#/components/schemas/RunStepDeltaDetail' - description: The details of the run step. - description: Represents the delta payload in a streaming run step delta chunk. RunStepDeltaCodeInterpreterDetailItemObject: type: object - required: - - input properties: input: type: string @@ -2403,13 +2415,11 @@ components: type: object required: - type - - message_creation properties: type: type: string enum: - message_creation - - tool_calls description: The object type, which is always "message_creation." message_creation: allOf: @@ -2439,7 +2449,6 @@ components: type: object additionalProperties: type: string - nullable: true description: Reserved for future use. allOf: - $ref: '#/components/schemas/RunStepDeltaToolCall' @@ -2571,7 +2580,6 @@ components: type: string enum: - message_creation - - tool_calls description: The object type, which is always 'message_creation'. message_creation: allOf: @@ -2790,13 +2798,13 @@ components: nullable: true description: On an incomplete message, details about why the message is incomplete. completed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp (in seconds) for when the message was completed. incomplete_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp (in seconds) for when the message was marked as incomplete. role: @@ -2902,28 +2910,28 @@ components: format: unixtime description: The Unix timestamp, in seconds, representing when this object was created. expires_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this item expires. started_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this item was started. completed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this completed. cancelled_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this was cancelled. failed_at: - type: string - format: date-time + type: integer + format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. metadata: From b9cb5fd6a24d7e6bdb38254cc732b8ce150e7a13 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 23 Apr 2024 16:00:16 -0700 Subject: [PATCH 03/25] [OpenAI] [Assistants] PR feedback (#28786) * Adding streaming events and modified class visibilities * Represented the alias as a union to align better with the swagger and have a class generated * Adding chunk classes to be included on code emission --- specification/ai/OpenAI.Assistants/client.tsp | 44 ++++++ specification/ai/OpenAI.Assistants/main.tsp | 1 + .../ai/OpenAI.Assistants/streaming/events.tsp | 134 ++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 specification/ai/OpenAI.Assistants/streaming/events.tsp diff --git a/specification/ai/OpenAI.Assistants/client.tsp b/specification/ai/OpenAI.Assistants/client.tsp index d1e651bbab53..c34831ce7274 100644 --- a/specification/ai/OpenAI.Assistants/client.tsp +++ b/specification/ai/OpenAI.Assistants/client.tsp @@ -149,13 +149,57 @@ namespace Azure.AI.OpenAI.Assistants; // Ensure generator inclusion of streaming "leaf" types not yet referenced by a route @@usage(MessageDeltaTextFileCitationAnnotation, Usage.output); +@@access(MessageDeltaTextFileCitationAnnotation, Access.public); + @@usage(MessageDeltaTextFilePathAnnotation, Usage.output); +@@access(MessageDeltaTextFilePathAnnotation, Access.public); + @@usage(MessageDeltaImageFileContent, Usage.output); +@@access(MessageDeltaImageFileContent, Access.public); + @@usage(MessageDeltaTextContent, Usage.output); +@@access(MessageDeltaTextContent, Access.public); + @@usage(RunStepDeltaMessageCreationObject, Usage.output); +@@access(RunStepDeltaMessageCreationObject, Access.public); + @@usage(RunStepDeltaFunction, Usage.output); +@@access(RunStepDeltaFunction, Access.public); + @@usage(RunStepDeltaCodeInterpreterLogOutput, Usage.output); +@@access(RunStepDeltaCodeInterpreterLogOutput, Access.public); + @@usage(RunStepDeltaCodeInterpreterImageOutputObject, Usage.output); +@@access(RunStepDeltaCodeInterpreterImageOutputObject, Access.public); + +@@usage(RunStepDeltaChunk, Usage.output); +@@access(RunStepDeltaChunk, Access.public); + +@@usage(MessageDeltaChunk, Usage.output); +@@access(MessageDeltaChunk, Access.public); + +// // Stream events + +@@usage(AssistantStreamEvent, Usage.output); +@@access(AssistantStreamEvent, Access.internal); + +@@usage(ThreadStreamEvent, Usage.output); +@@access(ThreadStreamEvent, Access.internal); + +@@usage(RunStreamEvent, Usage.output); +@@access(RunStreamEvent, Access.internal); + +@@usage(RunStepStreamEvent, Usage.output); +@@access(RunStepStreamEvent, Access.internal); + +@@usage(MessageStreamEvent, Usage.output); +@@access(MessageStreamEvent, Access.internal); + +@@usage(ErrorEvent, Usage.output); +@@access(ErrorEvent, Access.internal); + +@@usage(DoneEvent, Usage.output); +@@access(DoneEvent, Access.internal); // Ensure some shared types remain public despite interaction with previously internalized details diff --git a/specification/ai/OpenAI.Assistants/main.tsp b/specification/ai/OpenAI.Assistants/main.tsp index 8c96005022e5..e804cce1c662 100644 --- a/specification/ai/OpenAI.Assistants/main.tsp +++ b/specification/ai/OpenAI.Assistants/main.tsp @@ -7,6 +7,7 @@ import "./messages/main.tsp"; import "./runs/main.tsp"; import "./run_steps/main.tsp"; import "./files/main.tsp"; +import "./streaming/events.tsp"; using TypeSpec.Http; using TypeSpec.Versioning; diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp new file mode 100644 index 000000000000..6a6059723657 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -0,0 +1,134 @@ +import "@typespec/versioning"; + +using TypeSpec.Versioning; + +namespace Azure.AI.OpenAI.Assistants; + +union AssistantStreamEvent { ThreadStreamEvent | RunStreamEvent | RunStepStreamEvent | MessageStreamEvent | ErrorEvent | DoneEvent } + +/** Thread operation related streaming events */ +union ThreadStreamEvent { + string, + + /** Event sent when a new thread is created. The data of this event is of type AssistantThread */ + ThreadCreated : "thread.created", +} + +/** Run operation related streaming events */ +@added(ServiceApiVersions.vFuturePlaceholder) +union RunStreamEvent { + string, + /** Event sent when a new run is created. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunCreated: "thread.run.created", + + /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + TheardRunQueued: "thread.run.queued", + + /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunInProgress: "thread.run.in_progress", + + /** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunRequiresAction: "thread.run.requires_action", + + /** Event sent when a run is completed. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunCompleted: "thread.run.completed", + + /** Event sent when a run fails. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunFailed: "thread.run.failed", + + /** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunCancelling: "thread.run.cancelling", + + /** Event sent when a run is cancelled. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunCancelled: "thread.run.cancelled", + + /** Event sent when a run is expired. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunExpired: "thread.run.expired", +} + +/** Run step operation related streaming events */ +@added(ServiceApiVersions.vFuturePlaceholder) +union RunStepStreamEvent { + string, + + /** Event sent when a new thread run step is created. The data of this event is of type RunStep */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunStepCreated: "thread.run.step.created", + + /** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunStepInProgress: "thread.run.step.in_progress", + + /** Event sent when a run stepis being streamed. The data of this event is of type RunStepDelta */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunStepDelta: "thread.run.step.delta", + + /** Event sent when a run step is completed. The data of this event is of type RunStep */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunStepCompleted: "thread.run.step.completed", + + /** Event sent when a run step fails. The data of this event is of type RunStep */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunStepFailed: "thread.run.step.failed", + + /** Event sent when a run step is cancelled. The data of this event is of type RunStep */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunStepCancelled: "thread.run.step.cancelled", + + /** Event sent when a run step is expired. The data of this event is of type RunStep */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadRunStepExpired: "thread.run.step.expired", +} + +/** Message operation related streaming events */ +@added(ServiceApiVersions.vFuturePlaceholder) +union MessageStreamEvent { + string, + + /** Event sent when a new message is created. The data of this event is of type ThreadMessage */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadMessageCreated: "thread.message.created", + + /** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadMessageInProgress: "thread.message.in_progress", + + /** Event sent when a message is being streamed. The data of this event is of type MessageDelta */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadMessageDelta: "thread.message.delta", + + /** Event sent when a message is completed. The data of this event is of type ThreadMessage */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadMessageCompleted: "thread.message.completed", + + /** Event sent before a message is completed. The data of this event is of type ThreadMessage */ + @added(ServiceApiVersions.vFuturePlaceholder) + ThreadMessageIncomplete: "thread.message.incomplete", +} + +@added(ServiceApiVersions.vFuturePlaceholder) +union ErrorEvent { + string, + + /** Event sent when an error occurs, such as an internal server error or a timeout. */ + @added(ServiceApiVersions.vFuturePlaceholder) + Error: "error" +} + +@added(ServiceApiVersions.vFuturePlaceholder) +union DoneEvent { + string, + + /** Event sent when the stream is done. */ + @added(ServiceApiVersions.vFuturePlaceholder) + Done: "done" +} From ab5b4c0ec783ba3a6d6f540aa3ef47847bf7c21a Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Mon, 6 May 2024 11:19:12 +0200 Subject: [PATCH 04/25] Update specification/ai/OpenAI.Assistants/streaming/events.tsp --- specification/ai/OpenAI.Assistants/streaming/events.tsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp index 6a6059723657..81ba692f201d 100644 --- a/specification/ai/OpenAI.Assistants/streaming/events.tsp +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -24,7 +24,7 @@ union RunStreamEvent { /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */ @added(ServiceApiVersions.vFuturePlaceholder) - TheardRunQueued: "thread.run.queued", + ThreadRunQueued: "thread.run.queued", /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */ @added(ServiceApiVersions.vFuturePlaceholder) From 7a6e0f3fba539dd7c26399b8012402fbbd62f333 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Mon, 6 May 2024 11:19:45 +0200 Subject: [PATCH 05/25] Added usage models for run and runStep (#28864) * Added usage models for run and runStep * Added added annotation * Added warning suppresion for nullable fields --- .../ai/OpenAI.Assistants/run_steps/models.tsp | 22 +++++++++++++++++++ .../ai/OpenAI.Assistants/runs/models.tsp | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/specification/ai/OpenAI.Assistants/run_steps/models.tsp b/specification/ai/OpenAI.Assistants/run_steps/models.tsp index cdb0a7eeb6db..cf66b3453228 100644 --- a/specification/ai/OpenAI.Assistants/run_steps/models.tsp +++ b/specification/ai/OpenAI.Assistants/run_steps/models.tsp @@ -70,9 +70,31 @@ model RunStep { @doc("The Unix timestamp, in seconds, representing when this failed.") failedAt: utcDateTime | null; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @doc("Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.") + @added(ServiceApiVersions.vFuturePlaceholder) + usage: RunStepCompletionUsage | null; + ...RequiredNullableMetadata; } +@doc("Usage statistics related to the run step.") +@added(ServiceApiVersions.vFuturePlaceholder) +model RunStepCompletionUsage { + + @doc("Number of completion tokens used over the course of the run step.") + @encodedName("application/json", "completion_tokens") + completionTokens: int64; + + @doc("Number of prompt tokens used over the course of the run step.") + @encodedName("application/json", "prompt_tokens") + promptTokens: int64; + + @doc("Total number of tokens used (prompt + completion).") + @encodedName("application/json", "total_tokens") + totalTokens: int64; +} + @doc("The possible types of run steps.") @added(ServiceApiVersions.v2024_02_15_preview) union RunStepType { diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index ee98ee4f5b1c..131b940a4c3b 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -95,9 +95,31 @@ model ThreadRun { @doc("The Unix timestamp, in seconds, representing when this failed.") failedAt: utcDateTime | null; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @doc("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.).") + @added(ServiceApiVersions.vFuturePlaceholder) + usage: RunCompletionUsage | null; + ...RequiredNullableMetadata; } +@doc("Usage statistics related to the run.") +@added(ServiceApiVersions.vFuturePlaceholder) +model RunCompletionUsage { + + @doc("Number of completion tokens used over the course of the run.") + @encodedName("application/json", "completion_tokens") + completionTokens: int64; + + @doc("Number of prompt tokens used over the course of the run.") + @encodedName("application/json", "prompt_tokens") + promptTokens: int64; + + @doc("Total number of tokens used (prompt + completion).") + @encodedName("application/json", "total_tokens") + totalTokens: int64; +} + @doc("The details used when creating a new run of an assistant thread.") @added(ServiceApiVersions.v2024_02_15_preview) model CreateRunOptions { From 134e5126a2e3c8ef20ef8002a6ca689c2c703d51 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Mon, 6 May 2024 14:10:28 +0200 Subject: [PATCH 06/25] Compiled with new models and unions --- .../assistants_generated.json | 80 ++++++++++++ .../assistants_generated.yaml | 9 ++ .../assistants_generated.yaml | 120 ++++++++++++++++++ 3 files changed, 209 insertions(+) diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json index f826d080ee4e..c7a8ceb3d5ad 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json @@ -2669,6 +2669,35 @@ ], "x-ms-discriminator-value": "retrieval" }, + "RunCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run.", + "properties": { + "completion_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of completion tokens used over the course of the run.", + "x-ms-client-name": "completionTokens" + }, + "prompt_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of prompt tokens used over the course of the run.", + "x-ms-client-name": "promptTokens" + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "description": "Total number of tokens used (prompt + completion).", + "x-ms-client-name": "totalTokens" + } + }, + "required": [ + "completion_tokens", + "prompt_tokens", + "total_tokens" + ] + }, "RunError": { "type": "object", "description": "The details of an error as encountered by an assistant thread run.", @@ -2838,6 +2867,16 @@ "x-nullable": true, "x-ms-client-name": "failedAt" }, + "usage": { + "type": "object", + "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunStepCompletionUsage" + } + ] + }, "metadata": { "type": "object", "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", @@ -2862,6 +2901,7 @@ "completed_at", "cancelled_at", "failed_at", + "usage", "metadata" ] }, @@ -2973,6 +3013,35 @@ "type" ] }, + "RunStepCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run step.", + "properties": { + "completion_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of completion tokens used over the course of the run step.", + "x-ms-client-name": "completionTokens" + }, + "prompt_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of prompt tokens used over the course of the run step.", + "x-ms-client-name": "promptTokens" + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "description": "Total number of tokens used (prompt + completion).", + "x-ms-client-name": "totalTokens" + } + }, + "required": [ + "completion_tokens", + "prompt_tokens", + "total_tokens" + ] + }, "RunStepDetails": { "type": "object", "description": "An abstract representation of the details for a run step.", @@ -3565,6 +3634,16 @@ "x-nullable": true, "x-ms-client-name": "failedAt" }, + "usage": { + "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.).", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunCompletionUsage" + } + ] + }, "metadata": { "type": "object", "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", @@ -3591,6 +3670,7 @@ "completed_at", "cancelled_at", "failed_at", + "usage", "metadata" ] }, diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 50f43e73f1ab..0866c766c7c3 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -1281,6 +1281,8 @@ components: - assistant.file.deleted description: The object type, which is always 'assistant.file.deleted'. description: The status of an assistant file deletion operation. + AssistantStreamEvent: + $ref: '#/components/schemas/ThreadStreamEvent' AssistantThread: type: object required: @@ -2424,6 +2426,13 @@ components: nullable: true description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. description: Data representing a single evaluation run of an assistant thread. + ThreadStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.created + description: Thread operation related streaming events ToolDefinition: type: object required: diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml index 580075e1c513..fc87e465efff 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml @@ -1284,6 +1284,14 @@ components: - assistant.file.deleted description: The object type, which is always 'assistant.file.deleted'. description: The status of an assistant file deletion operation. + AssistantStreamEvent: + anyOf: + - $ref: '#/components/schemas/ThreadStreamEvent' + - $ref: '#/components/schemas/RunStreamEvent' + - $ref: '#/components/schemas/RunStepStreamEvent' + - $ref: '#/components/schemas/MessageStreamEvent' + - $ref: '#/components/schemas/ErrorEvent' + - $ref: '#/components/schemas/DoneEvent' AssistantThread: type: object required: @@ -1414,6 +1422,18 @@ components: nullable: true description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. description: The details used when creating a new run of an assistant thread. + DoneEvent: + anyOf: + - type: string + - type: string + enum: + - done + ErrorEvent: + anyOf: + - type: string + - type: string + enum: + - error FileDeletionStatus: type: object required: @@ -1803,6 +1823,17 @@ components: - incomplete - completed description: The possible execution status values for a thread message. + MessageStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.message.created + - thread.message.in_progress + - thread.message.delta + - thread.message.completed + - thread.message.incomplete + description: Message operation related streaming events MessageTextAnnotation: type: object required: @@ -2038,6 +2069,26 @@ components: allOf: - $ref: '#/components/schemas/ToolDefinition' description: The input definition information for a retrieval tool as used to configure an assistant. + RunCompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int64 + description: Number of completion tokens used over the course of the run. + prompt_tokens: + type: integer + format: int64 + description: Number of prompt tokens used over the course of the run. + total_tokens: + type: integer + format: int64 + description: Total number of tokens used (prompt + completion). + description: Usage statistics related to the run. RunError: type: object required: @@ -2082,6 +2133,7 @@ components: - completed_at - cancelled_at - failed_at + - usage - metadata properties: id: @@ -2143,6 +2195,12 @@ components: format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. + usage: + type: object + allOf: + - $ref: '#/components/schemas/RunStepCompletionUsage' + nullable: true + description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. metadata: type: object additionalProperties: @@ -2243,6 +2301,26 @@ components: logs: '#/components/schemas/RunStepCodeInterpreterLogOutput' image: '#/components/schemas/RunStepCodeInterpreterImageOutput' description: An abstract representation of an emitted output from a code interpreter tool. + RunStepCompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int64 + description: Number of completion tokens used over the course of the run step. + prompt_tokens: + type: integer + format: int64 + description: Number of prompt tokens used over the course of the run step. + total_tokens: + type: integer + format: int64 + description: Total number of tokens used (prompt + completion). + description: Usage statistics related to the run step. RunStepDelta: type: object properties: @@ -2629,6 +2707,19 @@ components: - completed - expired description: Possible values for the status of a run step. + RunStepStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.run.step.created + - thread.run.step.in_progress + - thread.run.step.delta + - thread.run.step.completed + - thread.run.step.failed + - thread.run.step.cancelled + - thread.run.step.expired + description: Run step operation related streaming events RunStepToolCall: type: object required: @@ -2675,6 +2766,21 @@ components: - message_creation - tool_calls description: The possible types of run steps. + RunStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.run.created + - thread.run.queued + - thread.run.in_progress + - thread.run.requires_action + - thread.run.completed + - thread.run.failed + - thread.run.cancelling + - thread.run.cancelled + - thread.run.expired + description: Run operation related streaming events ServiceApiVersions: type: string enum: @@ -2855,6 +2961,7 @@ components: - completed_at - cancelled_at - failed_at + - usage - metadata properties: id: @@ -2934,6 +3041,12 @@ components: format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. + usage: + type: object + allOf: + - $ref: '#/components/schemas/RunCompletionUsage' + nullable: true + 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.). metadata: type: object additionalProperties: @@ -2941,6 +3054,13 @@ components: nullable: true description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. description: Data representing a single evaluation run of an assistant thread. + ThreadStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.created + description: Thread operation related streaming events ToolDefinition: type: object required: From 1bc4ad2b04608652a8e4d2180d11f69038fdfcd9 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 7 May 2024 10:10:23 +0200 Subject: [PATCH 07/25] back ported everything to a past version. Extracted SubmitToolOutputsOptions model --- specification/ai/OpenAI.Assistants/main.tsp | 4 -- .../ai/OpenAI.Assistants/messages/models.tsp | 38 ++++++------- .../ai/OpenAI.Assistants/run_steps/models.tsp | 36 ++++++------ .../ai/OpenAI.Assistants/runs/models.tsp | 23 ++++++-- .../ai/OpenAI.Assistants/runs/routes.tsp | 5 +- .../ai/OpenAI.Assistants/streaming/events.tsp | 56 +++++++++---------- 6 files changed, 85 insertions(+), 77 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/main.tsp b/specification/ai/OpenAI.Assistants/main.tsp index e804cce1c662..f9668ff2fad5 100644 --- a/specification/ai/OpenAI.Assistants/main.tsp +++ b/specification/ai/OpenAI.Assistants/main.tsp @@ -44,8 +44,4 @@ enum ServiceApiVersions { @useDependency(Azure.Core.Versions.v1_0_Preview_2) @doc("The initial version of Azure OpenAI Assistants that corresponds to functionality in OpenAI's first beta release.") v2024_02_15_preview: "2024-02-15-preview", - - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @doc("For code review purposes only. To be replaced with an intended upcoming version label when available.") - vFuturePlaceholder: "placeholder-for-future-release", } diff --git a/specification/ai/OpenAI.Assistants/messages/models.tsp b/specification/ai/OpenAI.Assistants/messages/models.tsp index 13083f754519..c00b0650d998 100644 --- a/specification/ai/OpenAI.Assistants/messages/models.tsp +++ b/specification/ai/OpenAI.Assistants/messages/models.tsp @@ -42,27 +42,27 @@ model ThreadMessage { threadId: string; /** The status of the message. */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) status: MessageStatus; /** On an incomplete message, details about why the message is incomplete. */ #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @encodedName("application/json", "incomplete_details") - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) incompleteDetails: MessageIncompleteDetailsReason | null; /** The Unix timestamp (in seconds) for when the message was completed. */ #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @encode(DateTimeKnownEncoding.unixTimestamp, int32) @encodedName("application/json", "completed_at") - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) completedAt: utcDateTime | null; /** The Unix timestamp (in seconds) for when the message was marked as incomplete. */ #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @encode(DateTimeKnownEncoding.unixTimestamp, int32) @encodedName("application/json", "incomplete_at") - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) incompleteAt: utcDateTime | null; @doc("The role associated with the assistant thread message.") @@ -241,7 +241,7 @@ model MessageFile { } /** The possible execution status values for a thread message. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) union MessageStatus { string, @@ -256,14 +256,14 @@ union MessageStatus { } /** Information providing additional detail about a message entering an incomplete status. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageIncompleteDetails { /** The provided reason describing why the message was marked as incomplete. */ reason: MessageIncompleteDetailsReason; } /** A set of reasons describing why a message is marked as incomplete. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) union MessageIncompleteDetailsReason { string, @@ -285,7 +285,7 @@ union MessageIncompleteDetailsReason { // /** Represents a message delta i.e. any changed fields on a message during streaming. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaChunk { /** The identifier of the message, which can be referenced in API endpoints. */ id: string; @@ -298,7 +298,7 @@ model MessageDeltaChunk { } /** Represents the typed 'delta' payload within a streaming message delta chunk. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDelta { /** The entity that produced the message. */ role: MessageRole; @@ -313,7 +313,7 @@ model MessageDelta { /** The abstract base representation of a partial streamed message content payload. */ @discriminator("type") -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaContent { /** The index of the content part of the message. */ index: int32; @@ -323,7 +323,7 @@ model MessageDeltaContent { } /** Represents a streamed image file content part within a streaming message delta chunk. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaImageFileContent extends MessageDeltaContent { /** The type of content for this content part, which is always "image_file." */ type: "image_file"; @@ -334,7 +334,7 @@ model MessageDeltaImageFileContent extends MessageDeltaContent { } /** Represents the 'image_file' payload within streaming image file content. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaImageFileContentObject { /** The file ID of the image in the message content. */ @encodedName("application/json", "file_id") @@ -342,7 +342,7 @@ model MessageDeltaImageFileContentObject { } /** Represents a streamed text content part within a streaming message delta chunk. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaTextContentObject extends MessageDeltaContent { /** The type of content for this content part, which is always "text." */ type: "text"; @@ -352,7 +352,7 @@ model MessageDeltaTextContentObject extends MessageDeltaContent { } /** Represents the data of a streamed text content part within a streaming message delta chunk. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaTextContent { /** The data that makes up the text. */ value?: string; @@ -363,7 +363,7 @@ model MessageDeltaTextContent { /** The abstract base representation of a streamed text content part's text annotation. */ @discriminator("type") -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaTextAnnotation { /** The index of the annotation within a text content part. */ index: int32; @@ -373,7 +373,7 @@ model MessageDeltaTextAnnotation { } /** Represents a streamed file citation applied to a streaming text content part. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaTextFileCitationAnnotationObject extends MessageDeltaTextAnnotation { /** The type of the text content annotation, which is always "file_citation." */ @@ -393,7 +393,7 @@ model MessageDeltaTextFileCitationAnnotationObject } /** Represents the data of a streamed file citation as applied to a streaming text content part. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaTextFileCitationAnnotation { /** The ID of the specific file the citation is from. */ @encodedName("application/json", "file_id") @@ -404,7 +404,7 @@ model MessageDeltaTextFileCitationAnnotation { } /** Represents a streamed file path annotation applied to a streaming text content part. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaTextFilePathAnnotationObject extends MessageDeltaTextAnnotation { /** The type of the text content annotation, which is always "file_path." */ @@ -424,7 +424,7 @@ model MessageDeltaTextFilePathAnnotationObject } /** Represents the data of a streamed file path annotation as applied to a streaming text content part. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model MessageDeltaTextFilePathAnnotation { /** The file ID for the annotation. */ @encodedName("application/json", "file_id") diff --git a/specification/ai/OpenAI.Assistants/run_steps/models.tsp b/specification/ai/OpenAI.Assistants/run_steps/models.tsp index cf66b3453228..2a6ca75d544a 100644 --- a/specification/ai/OpenAI.Assistants/run_steps/models.tsp +++ b/specification/ai/OpenAI.Assistants/run_steps/models.tsp @@ -72,14 +72,14 @@ model RunStep { #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.") - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) usage: RunStepCompletionUsage | null; ...RequiredNullableMetadata; } @doc("Usage statistics related to the run step.") -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepCompletionUsage { @doc("Number of completion tokens used over the course of the run step.") @@ -193,7 +193,7 @@ model RunStepError { // /** Represents a run step delta i.e. any changed fields on a run step during streaming. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaChunk { /** The identifier of the run step, which can be referenced in API endpoints. */ id: string; @@ -206,7 +206,7 @@ model RunStepDeltaChunk { } /** Represents the delta payload in a streaming run step delta chunk. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDelta { /** The details of the run step. */ @encodedName("application/json", "step_details") @@ -215,14 +215,14 @@ model RunStepDelta { /** Represents a single run step detail item in a streaming run step's delta payload. */ @discriminator("type") -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaDetail { /** The object type for the run step detail object. */ type: string; } /** Represents a message creation within a streaming run step delta. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaMessageCreation extends RunStepDeltaDetail { /** The object type, which is always "message_creation." */ type: "message_creation"; @@ -233,7 +233,7 @@ model RunStepDeltaMessageCreation extends RunStepDeltaDetail { } /** Represents the data within a streaming run step message creation response object. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaMessageCreationObject { /** The ID of the newly-created message. */ @encodedName("application/json", "message_id") @@ -241,7 +241,7 @@ model RunStepDeltaMessageCreationObject { } /** Represents an invocation of tool calls as part of a streaming run step. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaToolCallObject extends RunStepDeltaDetail { /** The object type, which is always "tool_calls." */ type: "tool_calls"; @@ -253,7 +253,7 @@ model RunStepDeltaToolCallObject extends RunStepDeltaDetail { /** The abstract base representation of a single tool call within a streaming run step's delta tool call details. */ @discriminator("type") -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaToolCall { /** The index of the tool call detail in the run step's tool_calls array. */ index: int32; @@ -266,7 +266,7 @@ model RunStepDeltaToolCall { } /** Represents a function tool call within a streaming run step's tool call details. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaFunctionToolCall extends RunStepDeltaToolCall { /** The object type, which is always "function." */ type: "function"; @@ -276,7 +276,7 @@ model RunStepDeltaFunctionToolCall extends RunStepDeltaToolCall { } /** Represents a retrieval tool call within a streaming run step's tool call details. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaRetrievalToolCall extends RunStepDeltaToolCall { /** The object type, which is always "retrieval." */ type: "retrieval"; @@ -286,7 +286,7 @@ model RunStepDeltaRetrievalToolCall extends RunStepDeltaToolCall { } /** Represents a Code Interpreter tool call within a streaming run step's tool call details. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCall { /** The object type, which is always "code_interpreter." */ type: "code_interpreter"; @@ -297,7 +297,7 @@ model RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCall { } /** Represents the function data in a streaming run step delta's function tool call. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaFunction { /** The name of the function. */ name: string; @@ -311,7 +311,7 @@ model RunStepDeltaFunction { } /** Represents the Code Interpreter tool call data in a streaming run step's tool calls. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaCodeInterpreterDetailItemObject { /** The input into the Code Interpreter tool call. */ input?: string; @@ -325,7 +325,7 @@ model RunStepDeltaCodeInterpreterDetailItemObject { } /** The abstract base representation of a streaming run step tool call's Code Interpreter tool output. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) @discriminator("type") model RunStepDeltaCodeInterpreterOutput { /** The index of the output in the streaming run step tool call's Code Interpreter outputs array. */ @@ -336,7 +336,7 @@ model RunStepDeltaCodeInterpreterOutput { } /** Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaCodeInterpreterLogOutput extends RunStepDeltaCodeInterpreterOutput { /** The type of the object, which is always "logs." */ @@ -347,7 +347,7 @@ model RunStepDeltaCodeInterpreterLogOutput } /** Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaCodeInterpreterImageOutput extends RunStepDeltaCodeInterpreterOutput { /** The object type, which is always "image." */ @@ -358,7 +358,7 @@ model RunStepDeltaCodeInterpreterImageOutput } /** Represents the data for a streaming run step's Code Interpreter tool call image output. */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaCodeInterpreterImageOutputObject { /** The file ID for the image. */ @encodedName("application/json", "file_id") diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index 131b940a4c3b..28105b816c89 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -97,14 +97,14 @@ model ThreadRun { #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("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.).") - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) usage: RunCompletionUsage | null; ...RequiredNullableMetadata; } @doc("Usage statistics related to the run.") -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) model RunCompletionUsage { @doc("Number of completion tokens used over the course of the run.") @@ -151,7 +151,7 @@ model CreateRunOptions { * 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. */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) stream?: boolean; ...OptionalNullableMetadata; @@ -250,8 +250,23 @@ model CreateAndRunThreadOptions { * 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. */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) stream?: boolean; ...OptionalNullableMetadata; } + +@doc("Submit the results for the requested tool calls from the service.") +@added(ServiceApiVersions.v2024_02_15_preview) +model SubmitToolOutputsOptions { + @encodedName("application/json", "tool_outputs") + @doc("A list of tools for which the outputs are being submitted.") + toolOutputs: ToolOutput[]; + + + @doc(""" + 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. + """) + stream?: boolean | null; +} diff --git a/specification/ai/OpenAI.Assistants/runs/routes.tsp b/specification/ai/OpenAI.Assistants/runs/routes.tsp index 23e5eb09aa15..ffe73c3aaae4 100644 --- a/specification/ai/OpenAI.Assistants/runs/routes.tsp +++ b/specification/ai/OpenAI.Assistants/runs/routes.tsp @@ -89,8 +89,6 @@ op updateRun( * * @param threadId The ID of the thread that was run. * @param runId The ID of the run that requires tool outputs. - * @param toolOutputs The list of tool outputs requested by tool calls from the specified run. - * @param stream 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. * @returns Updated information about the run. */ #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" @@ -102,8 +100,7 @@ op updateRun( op submitToolOutputsToRun( @path threadId: string, @path runId: string, - @encodedName("application/json", "tool_outputs") toolOutputs: ToolOutput[], - @added(ServiceApiVersions.vFuturePlaceholder) stream?: boolean, + ...SubmitToolOutputsOptions ): ThreadRun; /** diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp index 81ba692f201d..aef5c509ff95 100644 --- a/specification/ai/OpenAI.Assistants/streaming/events.tsp +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -15,120 +15,120 @@ union ThreadStreamEvent { } /** Run operation related streaming events */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) union RunStreamEvent { string, /** Event sent when a new run is created. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunCreated: "thread.run.created", /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunQueued: "thread.run.queued", /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunInProgress: "thread.run.in_progress", /** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunRequiresAction: "thread.run.requires_action", /** Event sent when a run is completed. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunCompleted: "thread.run.completed", /** Event sent when a run fails. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunFailed: "thread.run.failed", /** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunCancelling: "thread.run.cancelling", /** Event sent when a run is cancelled. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunCancelled: "thread.run.cancelled", /** Event sent when a run is expired. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunExpired: "thread.run.expired", } /** Run step operation related streaming events */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) union RunStepStreamEvent { string, /** Event sent when a new thread run step is created. The data of this event is of type RunStep */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepCreated: "thread.run.step.created", /** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepInProgress: "thread.run.step.in_progress", /** Event sent when a run stepis being streamed. The data of this event is of type RunStepDelta */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepDelta: "thread.run.step.delta", /** Event sent when a run step is completed. The data of this event is of type RunStep */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepCompleted: "thread.run.step.completed", /** Event sent when a run step fails. The data of this event is of type RunStep */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepFailed: "thread.run.step.failed", /** Event sent when a run step is cancelled. The data of this event is of type RunStep */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepCancelled: "thread.run.step.cancelled", /** Event sent when a run step is expired. The data of this event is of type RunStep */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepExpired: "thread.run.step.expired", } /** Message operation related streaming events */ -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) union MessageStreamEvent { string, /** Event sent when a new message is created. The data of this event is of type ThreadMessage */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadMessageCreated: "thread.message.created", /** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadMessageInProgress: "thread.message.in_progress", /** Event sent when a message is being streamed. The data of this event is of type MessageDelta */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadMessageDelta: "thread.message.delta", /** Event sent when a message is completed. The data of this event is of type ThreadMessage */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadMessageCompleted: "thread.message.completed", /** Event sent before a message is completed. The data of this event is of type ThreadMessage */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) ThreadMessageIncomplete: "thread.message.incomplete", } -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) union ErrorEvent { string, /** Event sent when an error occurs, such as an internal server error or a timeout. */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) Error: "error" } -@added(ServiceApiVersions.vFuturePlaceholder) +@added(ServiceApiVersions.v2024_02_15_preview) union DoneEvent { string, /** Event sent when the stream is done. */ - @added(ServiceApiVersions.vFuturePlaceholder) + @added(ServiceApiVersions.v2024_02_15_preview) Done: "done" } From be46bddbfb6d50a317b0eee66f34b0d56d0f0588 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 7 May 2024 10:12:44 +0200 Subject: [PATCH 08/25] re-compile --- .../ai/OpenAI.Assistants/runs/models.tsp | 1 + .../assistants_generated.json | 221 +++++- .../assistants_generated.yaml | 655 +++++++++++++++++- 3 files changed, 851 insertions(+), 26 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index 28105b816c89..8b55d08416b8 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -256,6 +256,7 @@ model CreateAndRunThreadOptions { ...OptionalNullableMetadata; } +#suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("Submit the results for the requested tool calls from the service.") @added(ServiceApiVersions.v2024_02_15_preview) model SubmitToolOutputsOptions { diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json index acf4c21a668b..4ee028845b18 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json @@ -1619,21 +1619,7 @@ "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "tool_outputs": { - "type": "array", - "description": "The list of tool outputs requested by tool calls from the specified run.", - "items": { - "$ref": "#/definitions/ToolOutput" - }, - "x-ms-client-name": "toolOutputs", - "x-ms-identifiers": [] - } - }, - "required": [ - "tool_outputs" - ] + "$ref": "#/definitions/SubmitToolOutputsOptions" } } ], @@ -2006,6 +1992,10 @@ }, "x-ms-identifiers": [] }, + "stream": { + "type": "boolean", + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." + }, "metadata": { "type": "object", "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", @@ -2053,6 +2043,10 @@ }, "x-ms-identifiers": [] }, + "stream": { + "type": "boolean", + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." + }, "metadata": { "type": "object", "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", @@ -2283,6 +2277,42 @@ "file_id" ] }, + "MessageIncompleteDetailsReason": { + "type": "string", + "description": "A set of reasons describing why a message is marked as incomplete.", + "enum": [ + "content_filter", + "max_tokens", + "run_cancelled", + "run_failed" + ], + "x-ms-enum": { + "name": "MessageIncompleteDetailsReason", + "modelAsString": true, + "values": [ + { + "name": "contentFilter", + "value": "content_filter", + "description": "The run generating the message was terminated due to content filter flagging." + }, + { + "name": "maxTokens", + "value": "max_tokens", + "description": "The run generating the message exhausted available tokens before completion." + }, + { + "name": "runCancelled", + "value": "run_cancelled", + "description": "The run generating the message was cancelled before completion." + }, + { + "name": "runFailed", + "value": "run_failed", + "description": "The run generating the message failed." + } + ] + } + }, "MessageRole": { "type": "string", "description": "The possible values for roles attributed to messages in a thread.", @@ -2307,6 +2337,36 @@ ] } }, + "MessageStatus": { + "type": "string", + "description": "The possible execution status values for a thread message.", + "enum": [ + "in_progress", + "incomplete", + "completed" + ], + "x-ms-enum": { + "name": "MessageStatus", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "A run is currently creating this message." + }, + { + "name": "incomplete", + "value": "incomplete", + "description": "This message is incomplete. See incomplete_details for more information." + }, + { + "name": "completed", + "value": "completed", + "description": "This message was successfully completed by a run." + } + ] + } + }, "MessageTextAnnotation": { "type": "object", "description": "An abstract representation of an annotation to text thread message content.", @@ -2591,6 +2651,35 @@ ], "x-ms-discriminator-value": "retrieval" }, + "RunCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run.", + "properties": { + "completion_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of completion tokens used over the course of the run.", + "x-ms-client-name": "completionTokens" + }, + "prompt_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of prompt tokens used over the course of the run.", + "x-ms-client-name": "promptTokens" + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "description": "Total number of tokens used (prompt + completion).", + "x-ms-client-name": "totalTokens" + } + }, + "required": [ + "completion_tokens", + "prompt_tokens", + "total_tokens" + ] + }, "RunError": { "type": "object", "description": "The details of an error as encountered by an assistant thread run.", @@ -2760,6 +2849,16 @@ "x-nullable": true, "x-ms-client-name": "failedAt" }, + "usage": { + "type": "object", + "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunStepCompletionUsage" + } + ] + }, "metadata": { "type": "object", "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", @@ -2784,6 +2883,7 @@ "completed_at", "cancelled_at", "failed_at", + "usage", "metadata" ] }, @@ -2895,6 +2995,35 @@ "type" ] }, + "RunStepCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run step.", + "properties": { + "completion_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of completion tokens used over the course of the run step.", + "x-ms-client-name": "completionTokens" + }, + "prompt_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of prompt tokens used over the course of the run step.", + "x-ms-client-name": "promptTokens" + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "description": "Total number of tokens used (prompt + completion).", + "x-ms-client-name": "totalTokens" + } + }, + "required": [ + "completion_tokens", + "prompt_tokens", + "total_tokens" + ] + }, "RunStepDetails": { "type": "object", "description": "An abstract representation of the details for a run step.", @@ -3195,6 +3324,29 @@ "tool_calls" ] }, + "SubmitToolOutputsOptions": { + "type": "object", + "description": "Submit the results for the requested tool calls from the service.", + "properties": { + "tool_outputs": { + "type": "array", + "description": "A list of tools for which the outputs are being submitted.", + "items": { + "$ref": "#/definitions/ToolOutput" + }, + "x-ms-client-name": "toolOutputs", + "x-ms-identifiers": [] + }, + "stream": { + "type": "boolean", + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, \nterminating when the Run enters a terminal state with a `data: [DONE]` message.", + "x-nullable": true + } + }, + "required": [ + "tool_outputs" + ] + }, "ThreadDeletionStatus": { "type": "object", "description": "The status of a thread deletion operation.", @@ -3288,6 +3440,30 @@ "description": "The ID of the thread that this message belongs to.", "x-ms-client-name": "threadId" }, + "status": { + "$ref": "#/definitions/MessageStatus", + "description": "The status of the message." + }, + "incomplete_details": { + "$ref": "#/definitions/MessageIncompleteDetailsReason", + "description": "On an incomplete message, details about why the message is incomplete.", + "x-nullable": true, + "x-ms-client-name": "incompleteDetails" + }, + "completed_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the message was completed.", + "x-nullable": true, + "x-ms-client-name": "completedAt" + }, + "incomplete_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", + "x-nullable": true, + "x-ms-client-name": "incompleteAt" + }, "role": { "$ref": "#/definitions/MessageRole", "description": "The role associated with the assistant thread message." @@ -3332,6 +3508,10 @@ "object", "created_at", "thread_id", + "status", + "incomplete_details", + "completed_at", + "incomplete_at", "role", "content", "file_ids", @@ -3459,6 +3639,16 @@ "x-nullable": true, "x-ms-client-name": "failedAt" }, + "usage": { + "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.).", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunCompletionUsage" + } + ] + }, "metadata": { "type": "object", "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", @@ -3485,6 +3675,7 @@ "completed_at", "cancelled_at", "failed_at", + "usage", "metadata" ] }, diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 0866c766c7c3..ad66a11dbdf9 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -1097,15 +1097,7 @@ paths: content: application/json: schema: - type: object - properties: - tool_outputs: - type: array - items: - $ref: '#/components/schemas/ToolOutput' - description: The list of tool outputs requested by tool calls from the specified run. - required: - - tool_outputs + $ref: '#/components/schemas/SubmitToolOutputsOptions' security: - ApiKeyAuth: [] - OAuth2Auth: @@ -1282,7 +1274,13 @@ components: description: The object type, which is always 'assistant.file.deleted'. description: The status of an assistant file deletion operation. AssistantStreamEvent: - $ref: '#/components/schemas/ThreadStreamEvent' + anyOf: + - $ref: '#/components/schemas/ThreadStreamEvent' + - $ref: '#/components/schemas/RunStreamEvent' + - $ref: '#/components/schemas/RunStepStreamEvent' + - $ref: '#/components/schemas/MessageStreamEvent' + - $ref: '#/components/schemas/ErrorEvent' + - $ref: '#/components/schemas/DoneEvent' AssistantThread: type: object required: @@ -1361,6 +1359,11 @@ components: items: $ref: '#/components/schemas/ToolDefinition' description: The overridden list of enabled tools the assistant should use to run the thread. + stream: + type: boolean + 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. metadata: type: object additionalProperties: @@ -1396,6 +1399,11 @@ components: $ref: '#/components/schemas/ToolDefinition' nullable: true description: The overridden list of enabled tools that the assistant should use to run the thread. + stream: + type: boolean + 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. metadata: type: object additionalProperties: @@ -1403,6 +1411,18 @@ components: nullable: true description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. description: The details used when creating a new run of an assistant thread. + DoneEvent: + anyOf: + - type: string + - type: string + enum: + - done + ErrorEvent: + anyOf: + - type: string + - type: string + enum: + - error FileDeletionStatus: type: object required: @@ -1504,6 +1524,206 @@ components: text: '#/components/schemas/MessageTextContent' image_file: '#/components/schemas/MessageImageFileContent' description: An abstract representation of a single item of thread message content. + MessageDelta: + type: object + required: + - role + - content + properties: + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The entity that produced the message. + content: + type: array + items: + $ref: '#/components/schemas/MessageDeltaContent' + description: The content of the message as an array of text and/or images. + file_ids: + type: array + items: + type: string + description: A list of file IDs that the assistant can use. + default: [] + description: Represents the typed 'delta' payload within a streaming message delta chunk. + MessageDeltaChunk: + type: object + required: + - id + - object + - delta + properties: + id: + type: string + description: The identifier of the message, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message.delta + description: The object type, which is always `thread.message.delta`. + delta: + allOf: + - $ref: '#/components/schemas/MessageDelta' + description: The delta containing the fields that have changed on the Message. + description: Represents a message delta i.e. any changed fields on a message during streaming. + MessageDeltaContent: + type: object + required: + - index + - type + properties: + index: + type: integer + format: int32 + description: The index of the content part of the message. + type: + type: string + description: The type of content for this content part. + discriminator: + propertyName: type + mapping: + image_file: '#/components/schemas/MessageDeltaImageFileContent' + text: '#/components/schemas/MessageDeltaTextContentObject' + description: The abstract base representation of a partial streamed message content payload. + MessageDeltaImageFileContent: + type: object + required: + - type + properties: + type: + type: string + enum: + - image_file + description: The type of content for this content part, which is always "image_file." + image_file: + allOf: + - $ref: '#/components/schemas/MessageDeltaImageFileContentObject' + description: The image_file data. + allOf: + - $ref: '#/components/schemas/MessageDeltaContent' + description: Represents a streamed image file content part within a streaming message delta chunk. + MessageDeltaImageFileContentObject: + type: object + properties: + file_id: + type: string + description: The file ID of the image in the message content. + description: Represents the 'image_file' payload within streaming image file content. + MessageDeltaTextAnnotation: + type: object + required: + - index + - type + properties: + index: + type: integer + format: int32 + description: The index of the annotation within a text content part. + type: + type: string + description: The type of the text content annotation. + discriminator: + propertyName: type + mapping: + file_citation: '#/components/schemas/MessageDeltaTextFileCitationAnnotationObject' + file_path: '#/components/schemas/MessageDeltaTextFilePathAnnotationObject' + description: The abstract base representation of a streamed text content part's text annotation. + MessageDeltaTextContent: + type: object + properties: + value: + type: string + description: The data that makes up the text. + annotations: + type: array + items: + $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Annotations for the text. + description: Represents the data of a streamed text content part within a streaming message delta chunk. + MessageDeltaTextContentObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - text + description: The type of content for this content part, which is always "text." + text: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextContent' + description: The text content details. + allOf: + - $ref: '#/components/schemas/MessageDeltaContent' + description: Represents a streamed text content part within a streaming message delta chunk. + MessageDeltaTextFileCitationAnnotation: + type: object + properties: + file_id: + type: string + description: The ID of the specific file the citation is from. + quote: + type: string + description: The specific quote in the cited file. + description: Represents the data of a streamed file citation as applied to a streaming text content part. + MessageDeltaTextFileCitationAnnotationObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_citation + description: The type of the text content annotation, which is always "file_citation." + file_citation: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextFileCitationAnnotation' + description: The file citation information. + start_index: + type: integer + format: int32 + description: The start index of this annotation in the content text. + end_index: + type: integer + format: int32 + description: The end index of this annotation in the content text. + allOf: + - $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Represents a streamed file citation applied to a streaming text content part. + MessageDeltaTextFilePathAnnotation: + type: object + properties: + file_id: + type: string + description: The file ID for the annotation. + description: Represents the data of a streamed file path annotation as applied to a streaming text content part. + MessageDeltaTextFilePathAnnotationObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_path + description: The type of the text content annotation, which is always "file_path." + file_path: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextFilePathAnnotation' + description: The file path information. + start_index: + type: integer + format: int32 + description: The start index of this annotation in the content text. + end_index: + type: integer + format: int32 + description: The end index of this annotation in the content text. + allOf: + - $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Represents a streamed file path annotation applied to a streaming text content part. MessageFile: type: object required: @@ -1555,6 +1775,26 @@ components: type: string description: The ID for the file associated with this image. description: An image reference, as represented in thread message content. + MessageIncompleteDetails: + type: object + required: + - reason + properties: + reason: + allOf: + - $ref: '#/components/schemas/MessageIncompleteDetailsReason' + description: The provided reason describing why the message was marked as incomplete. + description: Information providing additional detail about a message entering an incomplete status. + MessageIncompleteDetailsReason: + anyOf: + - type: string + - type: string + enum: + - content_filter + - max_tokens + - run_cancelled + - run_failed + description: A set of reasons describing why a message is marked as incomplete. MessageRole: anyOf: - type: string @@ -1563,6 +1803,26 @@ components: - user - assistant description: The possible values for roles attributed to messages in a thread. + MessageStatus: + anyOf: + - type: string + - type: string + enum: + - in_progress + - incomplete + - completed + description: The possible execution status values for a thread message. + MessageStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.message.created + - thread.message.in_progress + - thread.message.delta + - thread.message.completed + - thread.message.incomplete + description: Message operation related streaming events MessageTextAnnotation: type: object required: @@ -1798,6 +2058,26 @@ components: allOf: - $ref: '#/components/schemas/ToolDefinition' description: The input definition information for a retrieval tool as used to configure an assistant. + RunCompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int64 + description: Number of completion tokens used over the course of the run. + prompt_tokens: + type: integer + format: int64 + description: Number of prompt tokens used over the course of the run. + total_tokens: + type: integer + format: int64 + description: Total number of tokens used (prompt + completion). + description: Usage statistics related to the run. RunError: type: object required: @@ -1842,6 +2122,7 @@ components: - completed_at - cancelled_at - failed_at + - usage - metadata properties: id: @@ -1903,6 +2184,12 @@ components: format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. + usage: + type: object + allOf: + - $ref: '#/components/schemas/RunStepCompletionUsage' + nullable: true + description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. metadata: type: object additionalProperties: @@ -2003,6 +2290,278 @@ components: logs: '#/components/schemas/RunStepCodeInterpreterLogOutput' image: '#/components/schemas/RunStepCodeInterpreterImageOutput' description: An abstract representation of an emitted output from a code interpreter tool. + RunStepCompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int64 + description: Number of completion tokens used over the course of the run step. + prompt_tokens: + type: integer + format: int64 + description: Number of prompt tokens used over the course of the run step. + total_tokens: + type: integer + format: int64 + description: Total number of tokens used (prompt + completion). + description: Usage statistics related to the run step. + RunStepDelta: + type: object + properties: + step_details: + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: The details of the run step. + description: Represents the delta payload in a streaming run step delta chunk. + RunStepDeltaChunk: + type: object + required: + - id + - object + - delta + properties: + id: + type: string + description: The identifier of the run step, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.run.step.delta + description: The object type, which is always `thread.run.step.delta`. + delta: + allOf: + - $ref: '#/components/schemas/RunStepDelta' + description: The delta containing the fields that have changed on the run step. + description: Represents a run step delta i.e. any changed fields on a run step during streaming. + RunStepDeltaCodeInterpreterDetailItemObject: + type: object + properties: + input: + type: string + description: The input into the Code Interpreter tool call. + outputs: + type: array + items: + $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + 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. + description: Represents the Code Interpreter tool call data in a streaming run step's tool calls. + RunStepDeltaCodeInterpreterImageOutput: + type: object + required: + - type + properties: + type: + type: string + enum: + - image + description: The object type, which is always "image." + image: + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutputObject' + description: The image data for the Code Interpreter tool call output. + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + description: Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. + RunStepDeltaCodeInterpreterImageOutputObject: + type: object + properties: + file_id: + type: string + description: The file ID for the image. + description: Represents the data for a streaming run step's Code Interpreter tool call image output. + RunStepDeltaCodeInterpreterLogOutput: + type: object + required: + - type + properties: + type: + type: string + enum: + - logs + description: The type of the object, which is always "logs." + logs: + type: string + description: The text output from the Code Interpreter tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + description: Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. + RunStepDeltaCodeInterpreterOutput: + type: object + required: + - index + - type + properties: + index: + type: integer + format: int32 + description: The index of the output in the streaming run step tool call's Code Interpreter outputs array. + type: + type: string + description: The type of the streaming run step tool call's Code Interpreter output. + discriminator: + propertyName: type + mapping: + logs: '#/components/schemas/RunStepDeltaCodeInterpreterLogOutput' + image: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutput' + description: The abstract base representation of a streaming run step tool call's Code Interpreter tool output. + RunStepDeltaCodeInterpreterToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - code_interpreter + description: The object type, which is always "code_interpreter." + code_interpreter: + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterDetailItemObject' + description: The Code Interpreter data for the tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a Code Interpreter tool call within a streaming run step's tool call details. + RunStepDeltaDetail: + type: object + required: + - type + properties: + type: + type: string + description: The object type for the run step detail object. + discriminator: + propertyName: type + mapping: + message_creation: '#/components/schemas/RunStepDeltaMessageCreation' + tool_calls: '#/components/schemas/RunStepDeltaToolCallObject' + description: Represents a single run step detail item in a streaming run step's delta payload. + RunStepDeltaFunction: + type: object + required: + - name + - arguments + - output + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments passed to the function as input. + output: + type: string + nullable: true + description: The output of the function, null if outputs have not yet been submitted. + description: Represents the function data in a streaming run step delta's function tool call. + RunStepDeltaFunctionToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - function + description: The object type, which is always "function." + function: + allOf: + - $ref: '#/components/schemas/RunStepDeltaFunction' + description: The function data for the tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a function tool call within a streaming run step's tool call details. + RunStepDeltaMessageCreation: + type: object + required: + - type + properties: + type: + type: string + enum: + - message_creation + description: The object type, which is always "message_creation." + message_creation: + allOf: + - $ref: '#/components/schemas/RunStepDeltaMessageCreationObject' + description: The message creation data. + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: Represents a message creation within a streaming run step delta. + RunStepDeltaMessageCreationObject: + type: object + properties: + message_id: + type: string + description: The ID of the newly-created message. + description: Represents the data within a streaming run step message creation response object. + RunStepDeltaRetrievalToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - retrieval + description: The object type, which is always "retrieval." + retrieval: + type: object + additionalProperties: + type: string + description: Reserved for future use. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a retrieval tool call within a streaming run step's tool call details. + RunStepDeltaToolCall: + type: object + required: + - index + - id + - type + properties: + index: + type: integer + format: int32 + description: The index of the tool call detail in the run step's tool_calls array. + id: + type: string + description: The ID of the tool call, used when submitting outputs to the run. + type: + type: string + description: The type of the tool call detail item in a streaming run step's details. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/RunStepDeltaFunctionToolCall' + retrieval: '#/components/schemas/RunStepDeltaRetrievalToolCall' + code_interpreter: '#/components/schemas/RunStepDeltaCodeInterpreterToolCall' + description: The abstract base representation of a single tool call within a streaming run step's delta tool call details. + RunStepDeltaToolCallObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - tool_calls + description: The object type, which is always "tool_calls." + tool_calls: + type: array + items: + $ref: '#/components/schemas/RunStepDeltaToolCall' + description: The collection of tool calls for the tool call detail item. + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: Represents an invocation of tool calls as part of a streaming run step. RunStepDetails: type: object required: @@ -2137,6 +2696,19 @@ components: - completed - expired description: Possible values for the status of a run step. + RunStepStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.run.step.created + - thread.run.step.in_progress + - thread.run.step.delta + - thread.run.step.completed + - thread.run.step.failed + - thread.run.step.cancelled + - thread.run.step.expired + description: Run step operation related streaming events RunStepToolCall: type: object required: @@ -2183,11 +2755,25 @@ components: - message_creation - tool_calls description: The possible types of run steps. + RunStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.run.created + - thread.run.queued + - thread.run.in_progress + - thread.run.requires_action + - thread.run.completed + - thread.run.failed + - thread.run.cancelling + - thread.run.cancelled + - thread.run.expired + description: Run operation related streaming events ServiceApiVersions: type: string enum: - 2024-02-15-preview - - placeholder-for-future-release description: The known set of supported API versions. SubmitToolOutputsAction: type: object @@ -2218,6 +2804,23 @@ components: $ref: '#/components/schemas/RequiredToolCall' description: The list of tool calls that must be resolved for the assistant thread run to continue. description: The details describing tools that should be called to submit tool outputs. + SubmitToolOutputsOptions: + type: object + required: + - tool_outputs + properties: + tool_outputs: + type: array + items: + $ref: '#/components/schemas/ToolOutput' + description: A list of tools for which the outputs are being submitted. + 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. + description: Submit the results for the requested tool calls from the service. ThreadDeletionStatus: type: object required: @@ -2272,6 +2875,10 @@ components: - object - created_at - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at - role - content - file_ids @@ -2292,6 +2899,25 @@ components: thread_id: type: string description: The ID of the thread that this message belongs to. + status: + allOf: + - $ref: '#/components/schemas/MessageStatus' + description: The status of the message. + incomplete_details: + oneOf: + - $ref: '#/components/schemas/MessageIncompleteDetailsReason' + nullable: true + description: On an incomplete message, details about why the message is incomplete. + completed_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the message was completed. + incomplete_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the message was marked as incomplete. role: allOf: - $ref: '#/components/schemas/MessageRole' @@ -2340,6 +2966,7 @@ components: - completed_at - cancelled_at - failed_at + - usage - metadata properties: id: @@ -2419,6 +3046,12 @@ components: format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. + usage: + type: object + allOf: + - $ref: '#/components/schemas/RunCompletionUsage' + nullable: true + 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.). metadata: type: object additionalProperties: From 29fb047650375c44eca056275f6adf14ce2fc2d5 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 7 May 2024 14:01:21 +0200 Subject: [PATCH 09/25] Removed toolresources for now and added warning supressions --- specification/ai/OpenAI.Assistants/runs/models.tsp | 11 +++++++---- .../2024-02-15-preview/assistants_generated.json | 9 ++++++--- .../2024-02-15-preview/assistants_generated.yaml | 5 ++++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index 8b55d08416b8..b4656e2815a6 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -231,20 +231,23 @@ model CreateAndRunThreadOptions { @doc("The ID of the assistant for which the thread should be created.") assistantId: string; - @doc("The details used to create the new thread.") + @doc("The details used to create the new thread. If no thread is provided, an empty one will be created.") thread?: AssistantThreadCreationOptions; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("The overridden model that the assistant should use to run the thread.") @clientName("overrideModelName", "csharp") - `model`?: string; + `model`?: string | null; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("The overridden system instructions the assistant should use to run the thread.") @clientName("overrideInstructions", "csharp") - instructions?: string; + instructions?: string | null; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("The overridden list of enabled tools the assistant should use to run the thread.") @clientName("overrideTools", "csharp") - tools?: ToolDefinition[]; + tools?: ToolDefinition[] | null; /** * If `true`, returns a stream of events that happen during the Run as server-sent events, diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json index 4ee028845b18..f43ed0a0b977 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json @@ -1974,19 +1974,22 @@ }, "thread": { "$ref": "#/definitions/AssistantThreadCreationOptions", - "description": "The details used to create the new thread." + "description": "The details used to create the new thread. If no thread is provided, an empty one will be created." }, "model": { "type": "string", - "description": "The overridden model that the assistant should use to run the thread." + "description": "The overridden model that the assistant should use to run the thread.", + "x-nullable": true }, "instructions": { "type": "string", - "description": "The overridden system instructions the assistant should use to run the thread." + "description": "The overridden system instructions the assistant should use to run the thread.", + "x-nullable": true }, "tools": { "type": "array", "description": "The overridden list of enabled tools the assistant should use to run the thread.", + "x-nullable": true, "items": { "$ref": "#/definitions/ToolDefinition" }, diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index ad66a11dbdf9..ae4e2f0931bf 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -1347,17 +1347,20 @@ components: thread: allOf: - $ref: '#/components/schemas/AssistantThreadCreationOptions' - description: The details used to create the new thread. + description: The details used to create the new thread. If no thread is provided, an empty one will be created. model: type: string + nullable: true description: The overridden model that the assistant should use to run the thread. instructions: type: string + nullable: true description: The overridden system instructions the assistant should use to run the thread. tools: type: array items: $ref: '#/components/schemas/ToolDefinition' + nullable: true description: The overridden list of enabled tools the assistant should use to run the thread. stream: type: boolean From f92727a3b24f31bea56021b68aec02fb68a557f9 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 7 May 2024 15:17:20 +0200 Subject: [PATCH 10/25] Brought up to date the classes related to streaming for AssistantStreamEvent --- .../ai/OpenAI.Assistants/messages/models.tsp | 13 +++-- .../ai/OpenAI.Assistants/run_steps/models.tsp | 11 ++-- .../ai/OpenAI.Assistants/runs/models.tsp | 17 +++++++ .../ai/OpenAI.Assistants/streaming/events.tsp | 22 +++++++- .../assistants_generated.json | 40 ++++++++++++++- .../assistants_generated.yaml | 51 ++++++++++++++----- 6 files changed, 129 insertions(+), 25 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/messages/models.tsp b/specification/ai/OpenAI.Assistants/messages/models.tsp index c00b0650d998..a6b286399fd0 100644 --- a/specification/ai/OpenAI.Assistants/messages/models.tsp +++ b/specification/ai/OpenAI.Assistants/messages/models.tsp @@ -278,6 +278,9 @@ union MessageIncompleteDetailsReason { /** The run generating the message failed. */ runFailed: "run_failed", + + /** The run generating the message expired. */ + runExpired: "run_expired", } // @@ -305,10 +308,6 @@ model MessageDelta { /** The content of the message as an array of text and/or images. */ content: MessageDeltaContent[]; - - /** A list of file IDs that the assistant can use. */ - @encodedName("application/json", "file_ids") - fileIds?: string[] = []; } /** The abstract base representation of a partial streamed message content payload. */ @@ -383,6 +382,9 @@ model MessageDeltaTextFileCitationAnnotationObject @encodedName("application/json", "file_citation") fileCitation?: MessageDeltaTextFileCitationAnnotation; + /** The text in the message content that needs to be replaced */ + text?: string; + /** The start index of this annotation in the content text. */ @encodedName("application/json", "start_index") startIndex?: int32; @@ -421,6 +423,9 @@ model MessageDeltaTextFilePathAnnotationObject /** The end index of this annotation in the content text. */ @encodedName("application/json", "end_index") endIndex?: int32; + + /** The text in the message content that needs to be replaced */ + text?: string; } /** Represents the data of a streamed file path annotation as applied to a streaming text content part. */ diff --git a/specification/ai/OpenAI.Assistants/run_steps/models.tsp b/specification/ai/OpenAI.Assistants/run_steps/models.tsp index 2a6ca75d544a..454a364a1445 100644 --- a/specification/ai/OpenAI.Assistants/run_steps/models.tsp +++ b/specification/ai/OpenAI.Assistants/run_steps/models.tsp @@ -73,7 +73,7 @@ model RunStep { #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.") @added(ServiceApiVersions.v2024_02_15_preview) - usage: RunStepCompletionUsage | null; + usage?: RunStepCompletionUsage | null; // required in OpenAI, not present in AOpenAI ...RequiredNullableMetadata; } @@ -282,7 +282,8 @@ model RunStepDeltaRetrievalToolCall extends RunStepDeltaToolCall { type: "retrieval"; /** Reserved for future use. */ - retrieval?: Record; + @encodedName("application/json", "file_search") + fileSearch?: Record; } /** Represents a Code Interpreter tool call within a streaming run step's tool call details. */ @@ -300,14 +301,14 @@ model RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCall { @added(ServiceApiVersions.v2024_02_15_preview) model RunStepDeltaFunction { /** The name of the function. */ - name: string; + name?: string; /** The arguments passed to the function as input. */ - arguments: string; + arguments?: string; /** The output of the function, null if outputs have not yet been submitted. */ #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - output: string | null; + output?: string | null; } /** Represents the Code Interpreter tool call data in a streaming run step's tool calls. */ diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index b4656e2815a6..527631cc7aaf 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -95,6 +95,11 @@ model ThreadRun { @doc("The Unix timestamp, in seconds, representing when this failed.") failedAt: utcDateTime | null; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "incomplete_details") + @doc("Details on why the run is incomplete. Will be `null` if the run is not incomplete.") + incompleteDetails: IncompleteRunDetails | null; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("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.).") @added(ServiceApiVersions.v2024_02_15_preview) @@ -103,6 +108,18 @@ model ThreadRun { ...RequiredNullableMetadata; } +/** The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. */ +@added(ServiceApiVersions.v2024_02_15_preview) +union IncompleteRunDetails { + string, + + /** Maximum completion tokens exceeded */ + maxCompletionTokens: "max_completion_tokens", + + /** Maximum prompt tokens exceeded */ + maxPromptTokens: "max_prompt_tokens", +} + @doc("Usage statistics related to the run.") @added(ServiceApiVersions.v2024_02_15_preview) model RunCompletionUsage { diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp index aef5c509ff95..5ae7ebe2d647 100644 --- a/specification/ai/OpenAI.Assistants/streaming/events.tsp +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -4,6 +4,24 @@ using TypeSpec.Versioning; namespace Azure.AI.OpenAI.Assistants; +@doc(""" +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. +""") union AssistantStreamEvent { ThreadStreamEvent | RunStreamEvent | RunStepStreamEvent | MessageStreamEvent | ErrorEvent | DoneEvent } /** Thread operation related streaming events */ @@ -68,7 +86,7 @@ union RunStepStreamEvent { @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepInProgress: "thread.run.step.in_progress", - /** Event sent when a run stepis being streamed. The data of this event is of type RunStepDelta */ + /** Event sent when a run stepis being streamed. The data of this event is of type RunStepDeltaChunk */ @added(ServiceApiVersions.v2024_02_15_preview) ThreadRunStepDelta: "thread.run.step.delta", @@ -102,7 +120,7 @@ union MessageStreamEvent { @added(ServiceApiVersions.v2024_02_15_preview) ThreadMessageInProgress: "thread.message.in_progress", - /** Event sent when a message is being streamed. The data of this event is of type MessageDelta */ + /** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */ @added(ServiceApiVersions.v2024_02_15_preview) ThreadMessageDelta: "thread.message.delta", diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json index f43ed0a0b977..baf14c039515 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json @@ -2195,6 +2195,30 @@ ], "x-ms-discriminator-value": "function" }, + "IncompleteRunDetails": { + "type": "string", + "description": "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.", + "enum": [ + "max_completion_tokens", + "max_prompt_tokens" + ], + "x-ms-enum": { + "name": "IncompleteRunDetails", + "modelAsString": true, + "values": [ + { + "name": "maxCompletionTokens", + "value": "max_completion_tokens", + "description": "Maximum completion tokens exceeded" + }, + { + "name": "maxPromptTokens", + "value": "max_prompt_tokens", + "description": "Maximum prompt tokens exceeded" + } + ] + } + }, "MessageContent": { "type": "object", "description": "An abstract representation of a single item of thread message content.", @@ -2287,7 +2311,8 @@ "content_filter", "max_tokens", "run_cancelled", - "run_failed" + "run_failed", + "run_expired" ], "x-ms-enum": { "name": "MessageIncompleteDetailsReason", @@ -2312,6 +2337,11 @@ "name": "runFailed", "value": "run_failed", "description": "The run generating the message failed." + }, + { + "name": "runExpired", + "value": "run_expired", + "description": "The run generating the message expired." } ] } @@ -2886,7 +2916,6 @@ "completed_at", "cancelled_at", "failed_at", - "usage", "metadata" ] }, @@ -3642,6 +3671,12 @@ "x-nullable": true, "x-ms-client-name": "failedAt" }, + "incomplete_details": { + "$ref": "#/definitions/IncompleteRunDetails", + "description": "Details on why the run is incomplete. Will be `null` if the run is not incomplete.", + "x-nullable": true, + "x-ms-client-name": "incompleteDetails" + }, "usage": { "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.).", @@ -3678,6 +3713,7 @@ "completed_at", "cancelled_at", "failed_at", + "incomplete_details", "usage", "metadata" ] diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index ae4e2f0931bf..1ce9c32a6ac0 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -1281,6 +1281,23 @@ components: - $ref: '#/components/schemas/MessageStreamEvent' - $ref: '#/components/schemas/ErrorEvent' - $ref: '#/components/schemas/DoneEvent' + description: |- + 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. AssistantThread: type: object required: @@ -1505,6 +1522,14 @@ components: allOf: - $ref: '#/components/schemas/ToolDefinition' description: The input definition information for a function tool as used to configure an assistant. + IncompleteRunDetails: + anyOf: + - type: string + - type: string + enum: + - max_completion_tokens + - max_prompt_tokens + description: The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. ListSortOrder: anyOf: - type: string @@ -1542,12 +1567,6 @@ components: items: $ref: '#/components/schemas/MessageDeltaContent' description: The content of the message as an array of text and/or images. - file_ids: - type: array - items: - type: string - description: A list of file IDs that the assistant can use. - default: [] description: Represents the typed 'delta' payload within a streaming message delta chunk. MessageDeltaChunk: type: object @@ -1684,6 +1703,9 @@ components: allOf: - $ref: '#/components/schemas/MessageDeltaTextFileCitationAnnotation' description: The file citation information. + text: + type: string + description: The text in the message content that needs to be replaced start_index: type: integer format: int32 @@ -1724,6 +1746,9 @@ components: type: integer format: int32 description: The end index of this annotation in the content text. + text: + type: string + description: The text in the message content that needs to be replaced allOf: - $ref: '#/components/schemas/MessageDeltaTextAnnotation' description: Represents a streamed file path annotation applied to a streaming text content part. @@ -1797,6 +1822,7 @@ components: - max_tokens - run_cancelled - run_failed + - run_expired description: A set of reasons describing why a message is marked as incomplete. MessageRole: anyOf: @@ -2125,7 +2151,6 @@ components: - completed_at - cancelled_at - failed_at - - usage - metadata properties: id: @@ -2448,10 +2473,6 @@ components: description: Represents a single run step detail item in a streaming run step's delta payload. RunStepDeltaFunction: type: object - required: - - name - - arguments - - output properties: name: type: string @@ -2515,7 +2536,7 @@ components: enum: - retrieval description: The object type, which is always "retrieval." - retrieval: + file_search: type: object additionalProperties: type: string @@ -2969,6 +2990,7 @@ components: - completed_at - cancelled_at - failed_at + - incomplete_details - usage - metadata properties: @@ -3049,6 +3071,11 @@ components: format: unixtime nullable: true description: The Unix timestamp, in seconds, representing when this failed. + incomplete_details: + oneOf: + - $ref: '#/components/schemas/IncompleteRunDetails' + nullable: true + description: Details on why the run is incomplete. Will be `null` if the run is not incomplete. usage: type: object allOf: From b0b951a3d2460734543e49113a487675596bf4c7 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Thu, 9 May 2024 13:28:56 +0200 Subject: [PATCH 11/25] Making filename mandatory uploadFile operation --- specification/ai/OpenAI.Assistants/files/routes.tsp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specification/ai/OpenAI.Assistants/files/routes.tsp b/specification/ai/OpenAI.Assistants/files/routes.tsp index 4ec51ee9327f..3879bd030c3c 100644 --- a/specification/ai/OpenAI.Assistants/files/routes.tsp +++ b/specification/ai/OpenAI.Assistants/files/routes.tsp @@ -53,8 +53,10 @@ op uploadFile( * any specific data source like a file. It can be inferred in some circumstances (as when using direct * file input, like curl does) but should remain configurable when using a stream or other data source * lacking an a priori name. + * If this value is not sent to the OpenAI backend the request will result in an error, so `filename` is + * functinonally required. */ - filename?: string, + filename: string, ): OpenAIFile; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" From 1fa3db0fe0d92958ea48c30491a0d4dd376f0072 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Thu, 9 May 2024 13:29:20 +0200 Subject: [PATCH 12/25] Project compilation --- .../preview/2024-02-15-preview/assistants_generated.json | 2 +- .../OpenApiV3/2024-02-15-preview/assistants_generated.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json index baf14c039515..ce135555031f 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json @@ -583,7 +583,7 @@ "name": "filename", "in": "formData", "description": "A filename to associate with the uploaded data.", - "required": false, + "required": true, "type": "string" } ], diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 1ce9c32a6ac0..077a8ef9b464 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -340,6 +340,7 @@ paths: required: - file - purpose + - filename /files/{fileId}: delete: operationId: deleteFile From 9e35e633fbadac5e875cf28f0c2466ff53c0758f Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Thu, 9 May 2024 13:46:17 +0200 Subject: [PATCH 13/25] Re-formated definitiones according to CI instructions --- .../ai/OpenAI.Assistants/files/routes.tsp | 2 +- .../ai/OpenAI.Assistants/run_steps/models.tsp | 1 - .../ai/OpenAI.Assistants/runs/models.tsp | 2 - .../ai/OpenAI.Assistants/runs/routes.tsp | 2 +- .../ai/OpenAI.Assistants/streaming/events.tsp | 181 +++++++++--------- 5 files changed, 97 insertions(+), 91 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/files/routes.tsp b/specification/ai/OpenAI.Assistants/files/routes.tsp index 3879bd030c3c..a5ffb7b940df 100644 --- a/specification/ai/OpenAI.Assistants/files/routes.tsp +++ b/specification/ai/OpenAI.Assistants/files/routes.tsp @@ -53,7 +53,7 @@ op uploadFile( * any specific data source like a file. It can be inferred in some circumstances (as when using direct * file input, like curl does) but should remain configurable when using a stream or other data source * lacking an a priori name. - * If this value is not sent to the OpenAI backend the request will result in an error, so `filename` is + * If this value is not sent to the OpenAI backend the request will result in an error, so `filename` is * functinonally required. */ filename: string, diff --git a/specification/ai/OpenAI.Assistants/run_steps/models.tsp b/specification/ai/OpenAI.Assistants/run_steps/models.tsp index 454a364a1445..6a17ee099d81 100644 --- a/specification/ai/OpenAI.Assistants/run_steps/models.tsp +++ b/specification/ai/OpenAI.Assistants/run_steps/models.tsp @@ -81,7 +81,6 @@ model RunStep { @doc("Usage statistics related to the run step.") @added(ServiceApiVersions.v2024_02_15_preview) model RunStepCompletionUsage { - @doc("Number of completion tokens used over the course of the run step.") @encodedName("application/json", "completion_tokens") completionTokens: int64; diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index 527631cc7aaf..b2dbe258fe5d 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -123,7 +123,6 @@ union IncompleteRunDetails { @doc("Usage statistics related to the run.") @added(ServiceApiVersions.v2024_02_15_preview) model RunCompletionUsage { - @doc("Number of completion tokens used over the course of the run.") @encodedName("application/json", "completion_tokens") completionTokens: int64; @@ -284,7 +283,6 @@ model SubmitToolOutputsOptions { @doc("A list of tools for which the outputs are being submitted.") toolOutputs: ToolOutput[]; - @doc(""" 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. diff --git a/specification/ai/OpenAI.Assistants/runs/routes.tsp b/specification/ai/OpenAI.Assistants/runs/routes.tsp index ffe73c3aaae4..d4ab038951b9 100644 --- a/specification/ai/OpenAI.Assistants/runs/routes.tsp +++ b/specification/ai/OpenAI.Assistants/runs/routes.tsp @@ -100,7 +100,7 @@ op updateRun( op submitToolOutputsToRun( @path threadId: string, @path runId: string, - ...SubmitToolOutputsOptions + ...SubmitToolOutputsOptions, ): ThreadRun; /** diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp index 5ae7ebe2d647..fc6c7f4be7bc 100644 --- a/specification/ai/OpenAI.Assistants/streaming/events.tsp +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -22,131 +22,140 @@ to create a message during a run, we emit a `thread.message.created event`, a We may add additional events over time, so we recommend handling unknown events gracefully in your code. """) -union AssistantStreamEvent { ThreadStreamEvent | RunStreamEvent | RunStepStreamEvent | MessageStreamEvent | ErrorEvent | DoneEvent } +union AssistantStreamEvent { + + | ThreadStreamEvent + | RunStreamEvent + | RunStepStreamEvent + | MessageStreamEvent + | ErrorEvent + | DoneEvent, +} /** Thread operation related streaming events */ union ThreadStreamEvent { - string, + string, - /** Event sent when a new thread is created. The data of this event is of type AssistantThread */ - ThreadCreated : "thread.created", + /** Event sent when a new thread is created. The data of this event is of type AssistantThread */ + ThreadCreated: "thread.created", } /** Run operation related streaming events */ @added(ServiceApiVersions.v2024_02_15_preview) union RunStreamEvent { - string, - /** Event sent when a new run is created. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunCreated: "thread.run.created", - - /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunQueued: "thread.run.queued", - - /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunInProgress: "thread.run.in_progress", - - /** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunRequiresAction: "thread.run.requires_action", - - /** Event sent when a run is completed. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunCompleted: "thread.run.completed", - - /** Event sent when a run fails. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunFailed: "thread.run.failed", - - /** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunCancelling: "thread.run.cancelling", - - /** Event sent when a run is cancelled. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunCancelled: "thread.run.cancelled", - - /** Event sent when a run is expired. The data of this event is of type ThreadRun */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunExpired: "thread.run.expired", + string, + + /** Event sent when a new run is created. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunCreated: "thread.run.created", + + /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunQueued: "thread.run.queued", + + /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunInProgress: "thread.run.in_progress", + + /** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunRequiresAction: "thread.run.requires_action", + + /** Event sent when a run is completed. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunCompleted: "thread.run.completed", + + /** Event sent when a run fails. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunFailed: "thread.run.failed", + + /** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunCancelling: "thread.run.cancelling", + + /** Event sent when a run is cancelled. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunCancelled: "thread.run.cancelled", + + /** Event sent when a run is expired. The data of this event is of type ThreadRun */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunExpired: "thread.run.expired", } /** Run step operation related streaming events */ @added(ServiceApiVersions.v2024_02_15_preview) union RunStepStreamEvent { - string, + string, - /** Event sent when a new thread run step is created. The data of this event is of type RunStep */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunStepCreated: "thread.run.step.created", + /** Event sent when a new thread run step is created. The data of this event is of type RunStep */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunStepCreated: "thread.run.step.created", - /** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunStepInProgress: "thread.run.step.in_progress", + /** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunStepInProgress: "thread.run.step.in_progress", - /** Event sent when a run stepis being streamed. The data of this event is of type RunStepDeltaChunk */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunStepDelta: "thread.run.step.delta", + /** Event sent when a run stepis being streamed. The data of this event is of type RunStepDeltaChunk */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunStepDelta: "thread.run.step.delta", - /** Event sent when a run step is completed. The data of this event is of type RunStep */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunStepCompleted: "thread.run.step.completed", + /** Event sent when a run step is completed. The data of this event is of type RunStep */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunStepCompleted: "thread.run.step.completed", - /** Event sent when a run step fails. The data of this event is of type RunStep */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunStepFailed: "thread.run.step.failed", + /** Event sent when a run step fails. The data of this event is of type RunStep */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunStepFailed: "thread.run.step.failed", - /** Event sent when a run step is cancelled. The data of this event is of type RunStep */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunStepCancelled: "thread.run.step.cancelled", + /** Event sent when a run step is cancelled. The data of this event is of type RunStep */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunStepCancelled: "thread.run.step.cancelled", - /** Event sent when a run step is expired. The data of this event is of type RunStep */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadRunStepExpired: "thread.run.step.expired", + /** Event sent when a run step is expired. The data of this event is of type RunStep */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadRunStepExpired: "thread.run.step.expired", } /** Message operation related streaming events */ @added(ServiceApiVersions.v2024_02_15_preview) union MessageStreamEvent { - string, + string, - /** Event sent when a new message is created. The data of this event is of type ThreadMessage */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadMessageCreated: "thread.message.created", + /** Event sent when a new message is created. The data of this event is of type ThreadMessage */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadMessageCreated: "thread.message.created", - /** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadMessageInProgress: "thread.message.in_progress", + /** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadMessageInProgress: "thread.message.in_progress", - /** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadMessageDelta: "thread.message.delta", + /** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadMessageDelta: "thread.message.delta", - /** Event sent when a message is completed. The data of this event is of type ThreadMessage */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadMessageCompleted: "thread.message.completed", + /** Event sent when a message is completed. The data of this event is of type ThreadMessage */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadMessageCompleted: "thread.message.completed", - /** Event sent before a message is completed. The data of this event is of type ThreadMessage */ - @added(ServiceApiVersions.v2024_02_15_preview) - ThreadMessageIncomplete: "thread.message.incomplete", + /** Event sent before a message is completed. The data of this event is of type ThreadMessage */ + @added(ServiceApiVersions.v2024_02_15_preview) + ThreadMessageIncomplete: "thread.message.incomplete", } @added(ServiceApiVersions.v2024_02_15_preview) union ErrorEvent { - string, + string, - /** Event sent when an error occurs, such as an internal server error or a timeout. */ - @added(ServiceApiVersions.v2024_02_15_preview) - Error: "error" + /** Event sent when an error occurs, such as an internal server error or a timeout. */ + @added(ServiceApiVersions.v2024_02_15_preview) + Error: "error", } @added(ServiceApiVersions.v2024_02_15_preview) union DoneEvent { - string, + string, - /** Event sent when the stream is done. */ - @added(ServiceApiVersions.v2024_02_15_preview) - Done: "done" + /** Event sent when the stream is done. */ + @added(ServiceApiVersions.v2024_02_15_preview) + Done: "done", } From 946413d377caaeaecc06f48147b8f2cfaf15fd41 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 14 May 2024 09:46:47 +0200 Subject: [PATCH 14/25] Added missing documentation --- specification/ai/OpenAI.Assistants/streaming/events.tsp | 2 ++ .../OpenApiV3/2024-02-15-preview/assistants_generated.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp index fc6c7f4be7bc..c31904d4dddb 100644 --- a/specification/ai/OpenAI.Assistants/streaming/events.tsp +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -142,6 +142,7 @@ union MessageStreamEvent { ThreadMessageIncomplete: "thread.message.incomplete", } +/** Terminal event indicating a server side error while streaming. */ @added(ServiceApiVersions.v2024_02_15_preview) union ErrorEvent { string, @@ -151,6 +152,7 @@ union ErrorEvent { Error: "error", } +/** Terminal event indicating the successful end of a stream. */ @added(ServiceApiVersions.v2024_02_15_preview) union DoneEvent { string, diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 077a8ef9b464..78605a541421 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -1438,12 +1438,14 @@ components: - type: string enum: - done + description: Terminal event indicating the successful end of a stream. ErrorEvent: anyOf: - type: string - type: string enum: - error + description: Terminal event indicating a server side error while streaming. FileDeletionStatus: type: object required: From 624f5f157881a7de267442e8402c75ba6b336318 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 14 May 2024 13:57:20 +0200 Subject: [PATCH 15/25] Reverted nullability of fileName --- specification/ai/OpenAI.Assistants/files/routes.tsp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/files/routes.tsp b/specification/ai/OpenAI.Assistants/files/routes.tsp index a5ffb7b940df..4ec51ee9327f 100644 --- a/specification/ai/OpenAI.Assistants/files/routes.tsp +++ b/specification/ai/OpenAI.Assistants/files/routes.tsp @@ -53,10 +53,8 @@ op uploadFile( * any specific data source like a file. It can be inferred in some circumstances (as when using direct * file input, like curl does) but should remain configurable when using a stream or other data source * lacking an a priori name. - * If this value is not sent to the OpenAI backend the request will result in an error, so `filename` is - * functinonally required. */ - filename: string, + filename?: string, ): OpenAIFile; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" From f395df29c7ebef86ae60c7a92f1001522fa08f2b Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 14 May 2024 14:03:19 +0200 Subject: [PATCH 16/25] re-compiled --- .../preview/2024-02-15-preview/assistants_generated.json | 2 +- .../OpenApiV3/2024-02-15-preview/assistants_generated.yaml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json index ce135555031f..baf14c039515 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json @@ -583,7 +583,7 @@ "name": "filename", "in": "formData", "description": "A filename to associate with the uploaded data.", - "required": true, + "required": false, "type": "string" } ], diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 78605a541421..440f0c7f6f27 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -340,7 +340,6 @@ paths: required: - file - purpose - - filename /files/{fileId}: delete: operationId: deleteFile From fcdb243daf79e93482ea9326614d993d8fc29816 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Wed, 15 May 2024 10:21:18 +0200 Subject: [PATCH 17/25] Removed openapi v2 and v3 files generated with the placeholder version --- .../assistants_generated.json | 3768 ----------------- .../assistants_generated.yaml | 3144 -------------- 2 files changed, 6912 deletions(-) delete mode 100644 specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json delete mode 100644 specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json deleted file mode 100644 index c7a8ceb3d5ad..000000000000 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/stable/placeholder-for-future-release/assistants_generated.json +++ /dev/null @@ -1,3768 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure OpenAI", - "version": "placeholder-for-future-release", - "description": "Azure OpenAI APIs for Assistants.", - "x-typespec-generated": [ - { - "emitter": "@azure-tools/typespec-autorest" - } - ] - }, - "schemes": [ - "https" - ], - "x-ms-parameterized-host": { - "hostTemplate": "{endpoint}", - "useSchemePrefix": false, - "parameters": [ - { - "name": "endpoint", - "in": "path", - "description": "An OpenAI endpoint supporting assistants functionality.", - "required": true, - "type": "string" - } - ] - }, - "produces": [ - "application/json" - ], - "consumes": [ - "application/json" - ], - "security": [ - { - "ApiKeyAuth": [] - }, - { - "OAuth2Auth": [ - "https://cognitiveservices.azure.com/.default" - ] - } - ], - "securityDefinitions": { - "ApiKeyAuth": { - "type": "apiKey", - "name": "api-key", - "in": "header" - }, - "OAuth2Auth": { - "type": "oauth2", - "flow": "implicit", - "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", - "scopes": { - "https://cognitiveservices.azure.com/.default": "" - } - } - }, - "tags": [], - "paths": { - "/assistants": { - "get": { - "operationId": "ListAssistants", - "description": "Gets a list of assistants that were previously created.", - "parameters": [ - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of assistants.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/Assistant" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - }, - "post": { - "operationId": "CreateAssistant", - "description": "Creates a new assistant.", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AssistantCreationOptions" - } - } - ], - "responses": { - "200": { - "description": "The new assistant instance.", - "schema": { - "$ref": "#/definitions/Assistant" - } - } - } - } - }, - "/assistants/{assistantId}": { - "get": { - "operationId": "GetAssistant", - "description": "Retrieves an existing assistant.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to retrieve.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested assistant instance.", - "schema": { - "$ref": "#/definitions/Assistant" - } - } - } - }, - "post": { - "operationId": "UpdateAssistant", - "description": "Modifies an existing assistant.", - "parameters": [ - { - "$ref": "#/parameters/UpdateAssistantOptions.assistantId" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAssistantOptions" - } - } - ], - "responses": { - "200": { - "description": "The updated assistant instance.", - "schema": { - "$ref": "#/definitions/Assistant" - } - } - } - }, - "delete": { - "operationId": "DeleteAssistant", - "description": "Deletes an assistant.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to delete.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Status information about the requested deletion operation.", - "schema": { - "$ref": "#/definitions/AssistantDeletionStatus" - } - } - } - } - }, - "/assistants/{assistantId}/files": { - "get": { - "operationId": "ListAssistantFiles", - "description": "Gets a list of files attached to a specific assistant, as used by tools that can read files.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to retrieve the list of attached files for.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of files attached to the specified assistant.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/AssistantFile" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - }, - "post": { - "operationId": "CreateAssistantFile", - "description": "Attaches a previously uploaded file to an assistant for use by tools that can read files.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to attach the file to.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the previously uploaded file to attach.", - "x-ms-client-name": "fileId" - } - }, - "required": [ - "file_id" - ] - } - } - ], - "responses": { - "200": { - "description": "Information about the attached file.", - "schema": { - "$ref": "#/definitions/AssistantFile" - } - } - } - } - }, - "/assistants/{assistantId}/files/{fileId}": { - "get": { - "operationId": "GetAssistantFile", - "description": "Retrieves a file attached to an assistant.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant associated with the attached file.", - "required": true, - "type": "string" - }, - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to retrieve.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "A representation of the attached file.", - "schema": { - "$ref": "#/definitions/AssistantFile" - } - } - } - }, - "delete": { - "operationId": "DeleteAssistantFile", - "description": "Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read\nfiles.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant from which the specified file should be unlinked.", - "required": true, - "type": "string" - }, - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to unlink from the specified assistant.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Status information about the requested file association deletion.", - "schema": { - "$ref": "#/definitions/AssistantFileDeletionStatus" - } - } - } - } - }, - "/files": { - "get": { - "operationId": "ListFiles", - "description": "Gets a list of previously uploaded files.", - "parameters": [ - { - "name": "purpose", - "in": "query", - "description": "A value that, when provided, limits list results to files matching the corresponding purpose.", - "required": false, - "type": "string", - "enum": [ - "fine-tune", - "fine-tune-results", - "assistants", - "assistants_output" - ], - "x-ms-enum": { - "name": "FilePurpose", - "modelAsString": true, - "values": [ - { - "name": "fineTune", - "value": "fine-tune", - "description": "Indicates a file is used for fine tuning input." - }, - { - "name": "fineTuneResults", - "value": "fine-tune-results", - "description": "Indicates a file is used for fine tuning results." - }, - { - "name": "assistants", - "value": "assistants", - "description": "Indicates a file is used as input to assistants." - }, - { - "name": "assistantsOutput", - "value": "assistants_output", - "description": "Indicates a file is used as output by assistants." - } - ] - } - } - ], - "responses": { - "200": { - "description": "The requested list of files.", - "schema": { - "$ref": "#/definitions/FileListResponse" - } - } - } - }, - "post": { - "operationId": "UploadFile", - "description": "Uploads a file for use by other operations.", - "consumes": [ - "multipart/form-data" - ], - "parameters": [ - { - "name": "file", - "in": "formData", - "description": "The file data (not filename) to upload.", - "required": true, - "type": "file" - }, - { - "name": "purpose", - "in": "formData", - "description": "The intended purpose of the file.", - "required": true, - "type": "string", - "enum": [ - "fine-tune", - "fine-tune-results", - "assistants", - "assistants_output" - ], - "x-ms-enum": { - "name": "FilePurpose", - "modelAsString": true, - "values": [ - { - "name": "fineTune", - "value": "fine-tune", - "description": "Indicates a file is used for fine tuning input." - }, - { - "name": "fineTuneResults", - "value": "fine-tune-results", - "description": "Indicates a file is used for fine tuning results." - }, - { - "name": "assistants", - "value": "assistants", - "description": "Indicates a file is used as input to assistants." - }, - { - "name": "assistantsOutput", - "value": "assistants_output", - "description": "Indicates a file is used as output by assistants." - } - ] - } - }, - { - "name": "filename", - "in": "formData", - "description": "A filename to associate with the uploaded data.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "A representation of the uploaded file.", - "schema": { - "$ref": "#/definitions/OpenAIFile" - } - } - } - } - }, - "/files/{fileId}": { - "get": { - "operationId": "GetFile", - "description": "Returns information about a specific file. Does not retrieve file content.", - "parameters": [ - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to retrieve.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/OpenAIFile" - } - } - } - }, - "delete": { - "operationId": "DeleteFile", - "description": "Delete a previously uploaded file.", - "parameters": [ - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to delete.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/FileDeletionStatus" - } - } - } - } - }, - "/files/{fileId}/content": { - "get": { - "operationId": "GetFileContent", - "description": "Returns information about a specific file. Does not retrieve file content.", - "parameters": [ - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to retrieve.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "type": "string", - "format": "byte" - } - } - } - } - }, - "/threads": { - "post": { - "operationId": "CreateThread", - "description": "Creates a new thread. Threads contain messages and can be run by assistants.", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AssistantThreadCreationOptions" - } - } - ], - "responses": { - "200": { - "description": "Information about the newly created thread.", - "schema": { - "$ref": "#/definitions/AssistantThread" - } - } - } - } - }, - "/threads/{threadId}": { - "get": { - "operationId": "GetThread", - "description": "Gets information about an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to retrieve information about.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Information about the requested thread.", - "schema": { - "$ref": "#/definitions/AssistantThread" - } - } - } - }, - "post": { - "operationId": "UpdateThread", - "description": "Modifies an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to modify.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - } - } - ], - "responses": { - "200": { - "description": "Information about the modified thread.", - "schema": { - "$ref": "#/definitions/AssistantThread" - } - } - } - }, - "delete": { - "operationId": "DeleteThread", - "description": "Deletes an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to delete.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Status information about the requested thread deletion operation.", - "schema": { - "$ref": "#/definitions/ThreadDeletionStatus" - } - } - } - } - }, - "/threads/{threadId}/messages": { - "get": { - "operationId": "ListMessages", - "description": "Gets a list of messages that exist on a thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to list messages from.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of messages.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/ThreadMessage" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - }, - "post": { - "operationId": "CreateMessage", - "description": "Creates a new message on a specified thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to create the new message on.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "role": { - "$ref": "#/definitions/MessageRole", - "description": "The role to associate with the new message." - }, - "content": { - "type": "string", - "description": "The textual content for the new message." - }, - "file_ids": { - "type": "array", - "description": "A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files.", - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "role", - "content" - ] - } - } - ], - "responses": { - "200": { - "description": "A representation of the new message.", - "schema": { - "$ref": "#/definitions/ThreadMessage" - } - } - } - } - }, - "/threads/{threadId}/messages/{messageId}": { - "get": { - "operationId": "GetMessage", - "description": "Gets an existing message from an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to retrieve the specified message from.", - "required": true, - "type": "string" - }, - { - "name": "messageId", - "in": "path", - "description": "The ID of the message to retrieve from the specified thread.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "A representation of the requested message.", - "schema": { - "$ref": "#/definitions/ThreadMessage" - } - } - } - }, - "post": { - "operationId": "UpdateMessage", - "description": "Modifies an existing message on an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread containing the specified message to modify.", - "required": true, - "type": "string" - }, - { - "name": "messageId", - "in": "path", - "description": "The ID of the message to modify on the specified thread.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - } - } - ], - "responses": { - "200": { - "description": "A representation of the modified message.", - "schema": { - "$ref": "#/definitions/ThreadMessage" - } - } - } - } - }, - "/threads/{threadId}/messages/{messageId}/files": { - "get": { - "operationId": "ListMessageFiles", - "description": "Gets a list of previously uploaded files associated with a message from a thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread containing the message to list files from.", - "required": true, - "type": "string" - }, - { - "name": "messageId", - "in": "path", - "description": "The ID of the message to list files from.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of files associated with the specified message.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/MessageFile" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - } - }, - "/threads/{threadId}/messages/{messageId}/files/{fileId}": { - "get": { - "operationId": "GetMessageFile", - "description": "Gets information about a file attachment to a message within a thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread containing the message to get information from.", - "required": true, - "type": "string" - }, - { - "name": "messageId", - "in": "path", - "description": "The ID of the message to get information from.", - "required": true, - "type": "string" - }, - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to get information about.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested file information.", - "schema": { - "$ref": "#/definitions/MessageFile" - } - } - } - } - }, - "/threads/{threadId}/runs": { - "get": { - "operationId": "ListRuns", - "description": "Gets a list of runs for a specified thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to list runs from.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of thread runs.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/ThreadRun" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - }, - "post": { - "operationId": "CreateRun", - "description": "Creates a new run for an assistant thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to run.", - "required": true, - "type": "string" - }, - { - "name": "createRunOptions", - "in": "body", - "description": "The details for the run to create.", - "required": true, - "schema": { - "$ref": "#/definitions/CreateRunOptions" - } - } - ], - "responses": { - "200": { - "description": "Information about the new thread run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}": { - "get": { - "operationId": "GetRun", - "description": "Gets an existing run from an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to retrieve run information from.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the thread to retrieve information about.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested information about the specified thread run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - }, - "post": { - "operationId": "UpdateRun", - "description": "Modifies an existing thread run.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread associated with the specified run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the run to modify.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - } - } - ], - "responses": { - "200": { - "description": "Information about the modified run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}/cancel": { - "post": { - "operationId": "CancelRun", - "description": "Cancels a run of an in progress thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread being run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the run to cancel.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Updated information about the cancelled run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}/steps": { - "get": { - "operationId": "ListRunSteps", - "description": "Gets a list of run steps from a thread run.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread that was run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the run to list steps from.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of run steps.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/RunStep" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}/steps/{stepId}": { - "get": { - "operationId": "GetRunStep", - "description": "Gets a single run step from a thread run.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread that was run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the specific run to retrieve the step from.", - "required": true, - "type": "string" - }, - { - "name": "stepId", - "in": "path", - "description": "The ID of the step to retrieve information about.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Information about the requested run step.", - "schema": { - "$ref": "#/definitions/RunStep" - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}/submit_tool_outputs": { - "post": { - "operationId": "SubmitToolOutputsToRun", - "description": "Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread that was run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the run that requires tool outputs.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "tool_outputs": { - "type": "array", - "description": "The list of tool outputs requested by tool calls from the specified run.", - "items": { - "$ref": "#/definitions/ToolOutput" - }, - "x-ms-client-name": "toolOutputs", - "x-ms-identifiers": [] - }, - "stream": { - "type": "boolean", - "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" - ] - } - } - ], - "responses": { - "200": { - "description": "Updated information about the run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - }, - "/threads/runs": { - "post": { - "operationId": "CreateThreadAndRun", - "description": "Creates a new assistant thread and immediately starts a run using that new thread.", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateAndRunThreadOptions" - } - } - ], - "responses": { - "200": { - "description": "Information about the newly created thread.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - } - }, - "definitions": { - "Assistant": { - "type": "object", - "description": "Represents an assistant that can call the model and use tools.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always assistant.", - "enum": [ - "assistant" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "name": { - "type": "string", - "description": "The name of the assistant.", - "x-nullable": true - }, - "description": { - "type": "string", - "description": "The description of the assistant.", - "x-nullable": true - }, - "model": { - "type": "string", - "description": "The ID of the model to use." - }, - "instructions": { - "type": "string", - "description": "The system instructions for the assistant to use.", - "x-nullable": true - }, - "tools": { - "type": "array", - "description": "The collection of tools enabled for the assistant.", - "default": [], - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "file_ids": { - "type": "array", - "description": "A list of attached file IDs, ordered by creation date in ascending order.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "created_at", - "name", - "description", - "model", - "instructions", - "tools", - "file_ids", - "metadata" - ] - }, - "AssistantCreationOptions": { - "type": "object", - "description": "The request details to use when creating a new assistant.", - "properties": { - "model": { - "type": "string", - "description": "The ID of the model to use." - }, - "name": { - "type": "string", - "description": "The name of the new assistant.", - "x-nullable": true - }, - "description": { - "type": "string", - "description": "The description of the new assistant.", - "x-nullable": true - }, - "instructions": { - "type": "string", - "description": "The system instructions for the new assistant to use.", - "x-nullable": true - }, - "tools": { - "type": "array", - "description": "The collection of tools to enable for the new assistant.", - "default": [], - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "file_ids": { - "type": "array", - "description": "A list of previously uploaded file IDs to attach to the assistant.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "model" - ] - }, - "AssistantDeletionStatus": { - "type": "object", - "description": "The status of an assistant deletion operation.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource specified for deletion." - }, - "deleted": { - "type": "boolean", - "description": "A value indicating whether deletion was successful." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'assistant.deleted'.", - "enum": [ - "assistant.deleted" - ], - "x-ms-enum": { - "modelAsString": false - } - } - }, - "required": [ - "id", - "deleted", - "object" - ] - }, - "AssistantFile": { - "type": "object", - "description": "Information about a file attached to an assistant, as used by tools that can read files.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'assistant.file'.", - "enum": [ - "assistant.file" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "assistant_id": { - "type": "string", - "description": "The assistant ID that the file is attached to.", - "x-ms-client-name": "assistantId" - } - }, - "required": [ - "id", - "object", - "created_at", - "assistant_id" - ] - }, - "AssistantFileDeletionStatus": { - "type": "object", - "description": "The status of an assistant file deletion operation.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource specified for deletion." - }, - "deleted": { - "type": "boolean", - "description": "A value indicating whether deletion was successful." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'assistant.file.deleted'.", - "enum": [ - "assistant.file.deleted" - ], - "x-ms-enum": { - "modelAsString": false - } - } - }, - "required": [ - "id", - "deleted", - "object" - ] - }, - "AssistantThread": { - "type": "object", - "description": "Information about a single thread associated with an assistant.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread'.", - "enum": [ - "thread" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "created_at", - "metadata" - ] - }, - "AssistantThreadCreationOptions": { - "type": "object", - "description": "The details used to create a new assistant thread.", - "properties": { - "messages": { - "type": "array", - "description": "The initial messages to associate with the new thread.", - "items": { - "$ref": "#/definitions/ThreadInitializationMessage" - }, - "x-ms-identifiers": [] - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - }, - "CodeInterpreterToolDefinition": { - "type": "object", - "description": "The input definition information for a code interpreter tool as used to configure an assistant.", - "allOf": [ - { - "$ref": "#/definitions/ToolDefinition" - } - ], - "x-ms-discriminator-value": "code_interpreter" - }, - "CreateAndRunThreadOptions": { - "type": "object", - "description": "The details used when creating and immediately running a new assistant thread.", - "properties": { - "assistant_id": { - "type": "string", - "description": "The ID of the assistant for which the thread should be created.", - "x-ms-client-name": "assistantId" - }, - "thread": { - "$ref": "#/definitions/AssistantThreadCreationOptions", - "description": "The details used to create the new thread." - }, - "model": { - "type": "string", - "description": "The overridden model that the assistant should use to run the thread." - }, - "instructions": { - "type": "string", - "description": "The overridden system instructions the assistant should use to run the thread." - }, - "tools": { - "type": "array", - "description": "The overridden list of enabled tools the assistant should use to run the thread.", - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "stream": { - "type": "boolean", - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "assistant_id" - ] - }, - "CreateRunOptions": { - "type": "object", - "description": "The details used when creating a new run of an assistant thread.", - "properties": { - "assistant_id": { - "type": "string", - "description": "The ID of the assistant that should run the thread.", - "x-ms-client-name": "assistantId" - }, - "model": { - "type": "string", - "description": "The overridden model name that the assistant should use to run the thread.", - "x-nullable": true - }, - "instructions": { - "type": "string", - "description": "The overridden system instructions that the assistant should use to run the thread.", - "x-nullable": true - }, - "additional_instructions": { - "type": "string", - "description": "Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior\non a per-run basis without overriding other instructions.", - "x-nullable": true, - "x-ms-client-name": "additionalInstructions" - }, - "tools": { - "type": "array", - "description": "The overridden list of enabled tools that the assistant should use to run the thread.", - "x-nullable": true, - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "stream": { - "type": "boolean", - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "assistant_id" - ] - }, - "FileDeletionStatus": { - "type": "object", - "description": "A status response from a file deletion operation.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource specified for deletion." - }, - "deleted": { - "type": "boolean", - "description": "A value indicating whether deletion was successful." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'file'.", - "enum": [ - "file" - ], - "x-ms-enum": { - "modelAsString": false - } - } - }, - "required": [ - "id", - "deleted", - "object" - ] - }, - "FileListResponse": { - "type": "object", - "description": "The response data from a file list operation.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always 'list'.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The files returned for the request.", - "items": { - "$ref": "#/definitions/OpenAIFile" - } - } - }, - "required": [ - "object", - "data" - ] - }, - "FilePurpose": { - "type": "string", - "description": "The possible values denoting the intended usage of a file.", - "enum": [ - "fine-tune", - "fine-tune-results", - "assistants", - "assistants_output" - ], - "x-ms-enum": { - "name": "FilePurpose", - "modelAsString": true, - "values": [ - { - "name": "fineTune", - "value": "fine-tune", - "description": "Indicates a file is used for fine tuning input." - }, - { - "name": "fineTuneResults", - "value": "fine-tune-results", - "description": "Indicates a file is used for fine tuning results." - }, - { - "name": "assistants", - "value": "assistants", - "description": "Indicates a file is used as input to assistants." - }, - { - "name": "assistantsOutput", - "value": "assistants_output", - "description": "Indicates a file is used as output by assistants." - } - ] - } - }, - "FunctionDefinition": { - "type": "object", - "description": "The input definition information for a function.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to be called." - }, - "description": { - "type": "string", - "description": "A description of what the function does, used by the model to choose when and how to call the function." - }, - "parameters": { - "description": "The parameters the functions accepts, described as a JSON Schema object." - } - }, - "required": [ - "name", - "parameters" - ] - }, - "FunctionToolDefinition": { - "type": "object", - "description": "The input definition information for a function tool as used to configure an assistant.", - "properties": { - "function": { - "$ref": "#/definitions/FunctionDefinition", - "description": "The definition of the concrete function that the function tool should call." - } - }, - "required": [ - "function" - ], - "allOf": [ - { - "$ref": "#/definitions/ToolDefinition" - } - ], - "x-ms-discriminator-value": "function" - }, - "MessageContent": { - "type": "object", - "description": "An abstract representation of a single item of thread message content.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "MessageFile": { - "type": "object", - "description": "Information about a file attached to an assistant thread message.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.message.file'.", - "enum": [ - "thread.message.file" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "message_id": { - "type": "string", - "description": "The ID of the message that this file is attached to.", - "x-ms-client-name": "messageId" - } - }, - "required": [ - "id", - "object", - "created_at", - "message_id" - ] - }, - "MessageImageFileContent": { - "type": "object", - "description": "A representation of image file content in a thread message.", - "properties": { - "image_file": { - "$ref": "#/definitions/MessageImageFileDetails", - "description": "The image file for this thread message content item.", - "x-ms-client-name": "imageFile" - } - }, - "required": [ - "image_file" - ], - "allOf": [ - { - "$ref": "#/definitions/MessageContent" - } - ], - "x-ms-discriminator-value": "image_file" - }, - "MessageImageFileDetails": { - "type": "object", - "description": "An image reference, as represented in thread message content.", - "properties": { - "file_id": { - "type": "string", - "description": "The ID for the file associated with this image.", - "x-ms-client-name": "fileId" - } - }, - "required": [ - "file_id" - ] - }, - "MessageIncompleteDetailsReason": { - "type": "string", - "description": "A set of reasons describing why a message is marked as incomplete.", - "enum": [ - "content_filter", - "max_tokens", - "run_cancelled", - "run_failed" - ], - "x-ms-enum": { - "name": "MessageIncompleteDetailsReason", - "modelAsString": true, - "values": [ - { - "name": "contentFilter", - "value": "content_filter", - "description": "The run generating the message was terminated due to content filter flagging." - }, - { - "name": "maxTokens", - "value": "max_tokens", - "description": "The run generating the message exhausted available tokens before completion." - }, - { - "name": "runCancelled", - "value": "run_cancelled", - "description": "The run generating the message was cancelled before completion." - }, - { - "name": "runFailed", - "value": "run_failed", - "description": "The run generating the message failed." - } - ] - } - }, - "MessageRole": { - "type": "string", - "description": "The possible values for roles attributed to messages in a thread.", - "enum": [ - "user", - "assistant" - ], - "x-ms-enum": { - "name": "MessageRole", - "modelAsString": true, - "values": [ - { - "name": "user", - "value": "user", - "description": "The role representing the end-user." - }, - { - "name": "assistant", - "value": "assistant", - "description": "The role representing the assistant." - } - ] - } - }, - "MessageStatus": { - "type": "string", - "description": "The possible execution status values for a thread message.", - "enum": [ - "in_progress", - "incomplete", - "completed" - ], - "x-ms-enum": { - "name": "MessageStatus", - "modelAsString": true, - "values": [ - { - "name": "inProgress", - "value": "in_progress", - "description": "A run is currently creating this message." - }, - { - "name": "incomplete", - "value": "incomplete", - "description": "This message is incomplete. See incomplete_details for more information." - }, - { - "name": "completed", - "value": "completed", - "description": "This message was successfully completed by a run." - } - ] - } - }, - "MessageTextAnnotation": { - "type": "object", - "description": "An abstract representation of an annotation to text thread message content.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - }, - "text": { - "type": "string", - "description": "The textual content associated with this text annotation item." - } - }, - "discriminator": "type", - "required": [ - "type", - "text" - ] - }, - "MessageTextContent": { - "type": "object", - "description": "A representation of a textual item of thread message content.", - "properties": { - "text": { - "$ref": "#/definitions/MessageTextDetails", - "description": "The text and associated annotations for this thread message content item." - } - }, - "required": [ - "text" - ], - "allOf": [ - { - "$ref": "#/definitions/MessageContent" - } - ], - "x-ms-discriminator-value": "text" - }, - "MessageTextDetails": { - "type": "object", - "description": "The text and associated annotations for a single item of assistant thread message content.", - "properties": { - "value": { - "type": "string", - "description": "The text data." - }, - "annotations": { - "type": "array", - "description": "A list of annotations associated with this text.", - "items": { - "$ref": "#/definitions/MessageTextAnnotation" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "value", - "annotations" - ] - }, - "MessageTextFileCitationAnnotation": { - "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": { - "file_citation": { - "$ref": "#/definitions/MessageTextFileCitationDetails", - "description": "A citation within the message that points to a specific quote from a specific file.\nGenerated when the assistant uses the \"retrieval\" tool to search files.", - "x-ms-client-name": "fileCitation" - }, - "start_index": { - "type": "integer", - "format": "int32", - "description": "The first text index associated with this text annotation.", - "x-ms-client-name": "startIndex" - }, - "end_index": { - "type": "integer", - "format": "int32", - "description": "The last text index associated with this text annotation.", - "x-ms-client-name": "endIndex" - } - }, - "required": [ - "file_citation" - ], - "allOf": [ - { - "$ref": "#/definitions/MessageTextAnnotation" - } - ], - "x-ms-discriminator-value": "file_citation" - }, - "MessageTextFileCitationDetails": { - "type": "object", - "description": "A representation of a file-based text citation, as used in a file-based annotation of text thread message content.", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file associated with this citation.", - "x-ms-client-name": "fileId" - }, - "quote": { - "type": "string", - "description": "The specific quote cited in the associated file." - } - }, - "required": [ - "file_id", - "quote" - ] - }, - "MessageTextFilePathAnnotation": { - "type": "object", - "description": "A citation within the message that points to a file located at a specific path.", - "properties": { - "file_path": { - "$ref": "#/definitions/MessageTextFilePathDetails", - "description": "A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.", - "x-ms-client-name": "filePath" - }, - "start_index": { - "type": "integer", - "format": "int32", - "description": "The first text index associated with this text annotation.", - "x-ms-client-name": "startIndex" - }, - "end_index": { - "type": "integer", - "format": "int32", - "description": "The last text index associated with this text annotation.", - "x-ms-client-name": "endIndex" - } - }, - "required": [ - "file_path" - ], - "allOf": [ - { - "$ref": "#/definitions/MessageTextAnnotation" - } - ], - "x-ms-discriminator-value": "file_path" - }, - "MessageTextFilePathDetails": { - "type": "object", - "description": "An encapsulation of an image file ID, as used by message image content.", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the specific file that the citation is from.", - "x-ms-client-name": "fileId" - } - }, - "required": [ - "file_id" - ] - }, - "OpenAIFile": { - "type": "object", - "description": "Represents an assistant that can call the model and use tools.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always 'file'.", - "enum": [ - "file" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "bytes": { - "type": "integer", - "format": "int32", - "description": "The size of the file, in bytes." - }, - "filename": { - "type": "string", - "description": "The name of the file." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "purpose": { - "$ref": "#/definitions/FilePurpose", - "description": "The intended purpose of a file." - } - }, - "required": [ - "object", - "id", - "bytes", - "filename", - "created_at", - "purpose" - ] - }, - "RequiredAction": { - "type": "object", - "description": "An abstract representation of a required action for an assistant thread run to continue.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "RequiredFunctionToolCall": { - "type": "object", - "description": "A representation of a requested call to a function tool, needed by the model to continue evaluation of a run.", - "properties": { - "function": { - "$ref": "#/definitions/RequiredFunctionToolCallDetails", - "description": "Detailed information about the function to be executed by the tool that includes name and arguments." - } - }, - "required": [ - "function" - ], - "allOf": [ - { - "$ref": "#/definitions/RequiredToolCall" - } - ], - "x-ms-discriminator-value": "function" - }, - "RequiredFunctionToolCallDetails": { - "type": "object", - "description": "The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." - }, - "arguments": { - "type": "string", - "description": "The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation." - } - }, - "required": [ - "name", - "arguments" - ] - }, - "RequiredToolCall": { - "type": "object", - "description": "An abstract representation a a tool invocation needed by the model to continue a run.", - "properties": { - "type": { - "type": "string", - "description": "The object type for the required tool call." - }, - "id": { - "type": "string", - "description": "The ID of the tool call. This ID must be referenced when submitting tool outputs." - } - }, - "discriminator": "type", - "required": [ - "type", - "id" - ] - }, - "RetrievalToolDefinition": { - "type": "object", - "description": "The input definition information for a retrieval tool as used to configure an assistant.", - "allOf": [ - { - "$ref": "#/definitions/ToolDefinition" - } - ], - "x-ms-discriminator-value": "retrieval" - }, - "RunCompletionUsage": { - "type": "object", - "description": "Usage statistics related to the run.", - "properties": { - "completion_tokens": { - "type": "integer", - "format": "int64", - "description": "Number of completion tokens used over the course of the run.", - "x-ms-client-name": "completionTokens" - }, - "prompt_tokens": { - "type": "integer", - "format": "int64", - "description": "Number of prompt tokens used over the course of the run.", - "x-ms-client-name": "promptTokens" - }, - "total_tokens": { - "type": "integer", - "format": "int64", - "description": "Total number of tokens used (prompt + completion).", - "x-ms-client-name": "totalTokens" - } - }, - "required": [ - "completion_tokens", - "prompt_tokens", - "total_tokens" - ] - }, - "RunError": { - "type": "object", - "description": "The details of an error as encountered by an assistant thread run.", - "properties": { - "code": { - "type": "string", - "description": "The status for the error." - }, - "message": { - "type": "string", - "description": "The human-readable text associated with the error." - } - }, - "required": [ - "code", - "message" - ] - }, - "RunStatus": { - "type": "string", - "description": "Possible values for the status of an assistant thread run.", - "enum": [ - "queued", - "in_progress", - "requires_action", - "cancelling", - "cancelled", - "failed", - "completed", - "expired" - ], - "x-ms-enum": { - "name": "RunStatus", - "modelAsString": true, - "values": [ - { - "name": "queued", - "value": "queued", - "description": "Represents a run that is queued to start." - }, - { - "name": "inProgress", - "value": "in_progress", - "description": "Represents a run that is in progress." - }, - { - "name": "requiresAction", - "value": "requires_action", - "description": "Represents a run that needs another operation, such as tool output submission, to continue." - }, - { - "name": "cancelling", - "value": "cancelling", - "description": "Represents a run that is in the process of cancellation." - }, - { - "name": "cancelled", - "value": "cancelled", - "description": "Represents a run that has been cancelled." - }, - { - "name": "failed", - "value": "failed", - "description": "Represents a run that failed." - }, - { - "name": "completed", - "value": "completed", - "description": "Represents a run that successfully completed." - }, - { - "name": "expired", - "value": "expired", - "description": "Represents a run that expired before it could otherwise finish." - } - ] - } - }, - "RunStep": { - "type": "object", - "description": "Detailed information about a single step of an assistant thread run.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.run.step'.", - "enum": [ - "thread.run.step" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "type": { - "$ref": "#/definitions/RunStepType", - "description": "The type of run step, which can be either message_creation or tool_calls." - }, - "assistant_id": { - "type": "string", - "description": "The ID of the assistant associated with the run step.", - "x-ms-client-name": "assistantId" - }, - "thread_id": { - "type": "string", - "description": "The ID of the thread that was run.", - "x-ms-client-name": "threadId" - }, - "run_id": { - "type": "string", - "description": "The ID of the run that this run step is a part of.", - "x-ms-client-name": "runId" - }, - "status": { - "$ref": "#/definitions/RunStepStatus", - "description": "The status of this run step." - }, - "step_details": { - "$ref": "#/definitions/RunStepDetails", - "description": "The details for this run step.", - "x-ms-client-name": "stepDetails" - }, - "last_error": { - "type": "object", - "description": "If applicable, information about the last error encountered by this run step.", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RunStepError" - } - ], - "x-ms-client-name": "lastError" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "expired_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this item expired.", - "x-nullable": true, - "x-ms-client-name": "expiredAt" - }, - "completed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this completed.", - "x-nullable": true, - "x-ms-client-name": "completedAt" - }, - "cancelled_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this was cancelled.", - "x-nullable": true, - "x-ms-client-name": "cancelledAt" - }, - "failed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this failed.", - "x-nullable": true, - "x-ms-client-name": "failedAt" - }, - "usage": { - "type": "object", - "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RunStepCompletionUsage" - } - ] - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "type", - "assistant_id", - "thread_id", - "run_id", - "status", - "step_details", - "last_error", - "created_at", - "expired_at", - "completed_at", - "cancelled_at", - "failed_at", - "usage", - "metadata" - ] - }, - "RunStepCodeInterpreterImageOutput": { - "type": "object", - "description": "A representation of an image output emitted by a code interpreter tool in response to a tool call by the model.", - "properties": { - "image": { - "$ref": "#/definitions/RunStepCodeInterpreterImageReference", - "description": "Referential information for the image associated with this output." - } - }, - "required": [ - "image" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" - } - ], - "x-ms-discriminator-value": "image" - }, - "RunStepCodeInterpreterImageReference": { - "type": "object", - "description": "An image reference emitted by a code interpreter tool in response to a tool call by the model.", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file associated with this image.", - "x-ms-client-name": "fileId" - } - }, - "required": [ - "file_id" - ] - }, - "RunStepCodeInterpreterLogOutput": { - "type": "object", - "description": "A representation of a log output emitted by a code interpreter tool in response to a tool call by the model.", - "properties": { - "logs": { - "type": "string", - "description": "The serialized log output emitted by the code interpreter." - } - }, - "required": [ - "logs" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" - } - ], - "x-ms-discriminator-value": "logs" - }, - "RunStepCodeInterpreterToolCall": { - "type": "object", - "description": "A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that\nrepresents inputs and outputs consumed and emitted by the code interpreter.", - "properties": { - "code_interpreter": { - "$ref": "#/definitions/RunStepCodeInterpreterToolCallDetails", - "description": "The details of the tool call to the code interpreter tool.", - "x-ms-client-name": "codeInterpreter" - } - }, - "required": [ - "code_interpreter" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepToolCall" - } - ], - "x-ms-discriminator-value": "code_interpreter" - }, - "RunStepCodeInterpreterToolCallDetails": { - "type": "object", - "description": "The detailed information about a code interpreter invocation by the model.", - "properties": { - "input": { - "type": "string", - "description": "The input provided by the model to the code interpreter tool." - }, - "outputs": { - "type": "array", - "description": "The outputs produced by the code interpreter tool back to the model in response to the tool call.", - "items": { - "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "input", - "outputs" - ] - }, - "RunStepCodeInterpreterToolCallOutput": { - "type": "object", - "description": "An abstract representation of an emitted output from a code interpreter tool.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "RunStepCompletionUsage": { - "type": "object", - "description": "Usage statistics related to the run step.", - "properties": { - "completion_tokens": { - "type": "integer", - "format": "int64", - "description": "Number of completion tokens used over the course of the run step.", - "x-ms-client-name": "completionTokens" - }, - "prompt_tokens": { - "type": "integer", - "format": "int64", - "description": "Number of prompt tokens used over the course of the run step.", - "x-ms-client-name": "promptTokens" - }, - "total_tokens": { - "type": "integer", - "format": "int64", - "description": "Total number of tokens used (prompt + completion).", - "x-ms-client-name": "totalTokens" - } - }, - "required": [ - "completion_tokens", - "prompt_tokens", - "total_tokens" - ] - }, - "RunStepDetails": { - "type": "object", - "description": "An abstract representation of the details for a run step.", - "properties": { - "type": { - "$ref": "#/definitions/RunStepType", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "RunStepError": { - "type": "object", - "description": "The error information associated with a failed run step.", - "properties": { - "code": { - "$ref": "#/definitions/RunStepErrorCode", - "description": "The error code for this error." - }, - "message": { - "type": "string", - "description": "The human-readable text associated with this error." - } - }, - "required": [ - "code", - "message" - ] - }, - "RunStepErrorCode": { - "type": "string", - "description": "Possible error code values attributable to a failed run step.", - "enum": [ - "server_error", - "rate_limit_exceeded" - ], - "x-ms-enum": { - "name": "RunStepErrorCode", - "modelAsString": true, - "values": [ - { - "name": "serverError", - "value": "server_error", - "description": "Represents a server error." - }, - { - "name": "rateLimitExceeded", - "value": "rate_limit_exceeded", - "description": "Represents an error indicating configured rate limits were exceeded." - } - ] - } - }, - "RunStepFunctionToolCall": { - "type": "object", - "description": "A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs\nand output consumed and emitted by the specified function.", - "properties": { - "function": { - "$ref": "#/definitions/RunStepFunctionToolCallDetails", - "description": "The detailed information about the function called by the model." - } - }, - "required": [ - "function" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepToolCall" - } - ], - "x-ms-discriminator-value": "function" - }, - "RunStepFunctionToolCallDetails": { - "type": "object", - "description": "The detailed information about the function called by the model.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." - }, - "arguments": { - "type": "string", - "description": "The arguments that the model requires are provided to the named function." - }, - "output": { - "type": "string", - "description": "The output of the function, only populated for function calls that have already have had their outputs submitted.", - "x-nullable": true - } - }, - "required": [ - "name", - "arguments", - "output" - ] - }, - "RunStepMessageCreationDetails": { - "type": "object", - "description": "The detailed information associated with a message creation run step.", - "properties": { - "message_creation": { - "$ref": "#/definitions/RunStepMessageCreationReference", - "description": "Information about the message creation associated with this run step.", - "x-ms-client-name": "messageCreation" - } - }, - "required": [ - "message_creation" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepDetails" - } - ], - "x-ms-discriminator-value": "message_creation" - }, - "RunStepMessageCreationReference": { - "type": "object", - "description": "The details of a message created as a part of a run step.", - "properties": { - "message_id": { - "type": "string", - "description": "The ID of the message created by this run step.", - "x-ms-client-name": "messageId" - } - }, - "required": [ - "message_id" - ] - }, - "RunStepRetrievalToolCall": { - "type": "object", - "description": "A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents\nexecuted retrieval actions.", - "properties": { - "retrieval": { - "type": "object", - "description": "The key/value pairs produced by the retrieval tool.", - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "retrieval" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepToolCall" - } - ], - "x-ms-discriminator-value": "retrieval" - }, - "RunStepStatus": { - "type": "string", - "description": "Possible values for the status of a run step.", - "enum": [ - "in_progress", - "cancelled", - "failed", - "completed", - "expired" - ], - "x-ms-enum": { - "name": "RunStepStatus", - "modelAsString": true, - "values": [ - { - "name": "inProgress", - "value": "in_progress", - "description": "Represents a run step still in progress." - }, - { - "name": "cancelled", - "value": "cancelled", - "description": "Represents a run step that was cancelled." - }, - { - "name": "failed", - "value": "failed", - "description": "Represents a run step that failed." - }, - { - "name": "completed", - "value": "completed", - "description": "Represents a run step that successfully completed." - }, - { - "name": "expired", - "value": "expired", - "description": "Represents a run step that expired before otherwise finishing." - } - ] - } - }, - "RunStepToolCall": { - "type": "object", - "description": "An abstract representation of a detailed tool call as recorded within a run step for an existing run.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - }, - "id": { - "type": "string", - "description": "The ID of the tool call. This ID must be referenced when you submit tool outputs." - } - }, - "discriminator": "type", - "required": [ - "type", - "id" - ] - }, - "RunStepToolCallDetails": { - "type": "object", - "description": "The detailed information associated with a run step calling tools.", - "properties": { - "tool_calls": { - "type": "array", - "description": "A list of tool call details for this run step.", - "items": { - "$ref": "#/definitions/RunStepToolCall" - }, - "x-ms-client-name": "toolCalls" - } - }, - "required": [ - "tool_calls" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepDetails" - } - ], - "x-ms-discriminator-value": "tool_calls" - }, - "RunStepType": { - "type": "string", - "description": "The possible types of run steps.", - "enum": [ - "message_creation", - "tool_calls" - ], - "x-ms-enum": { - "name": "RunStepType", - "modelAsString": true, - "values": [ - { - "name": "messageCreation", - "value": "message_creation", - "description": "Represents a run step to create a message." - }, - { - "name": "toolCalls", - "value": "tool_calls", - "description": "Represents a run step that calls tools." - } - ] - } - }, - "SubmitToolOutputsAction": { - "type": "object", - "description": "The details for required tool calls that must be submitted for an assistant thread run to continue.", - "properties": { - "submit_tool_outputs": { - "$ref": "#/definitions/SubmitToolOutputsDetails", - "description": "The details describing tools that should be called to submit tool outputs.", - "x-ms-client-name": "submitToolOutputs" - } - }, - "required": [ - "submit_tool_outputs" - ], - "allOf": [ - { - "$ref": "#/definitions/RequiredAction" - } - ], - "x-ms-discriminator-value": "submit_tool_outputs" - }, - "SubmitToolOutputsDetails": { - "type": "object", - "description": "The details describing tools that should be called to submit tool outputs.", - "properties": { - "tool_calls": { - "type": "array", - "description": "The list of tool calls that must be resolved for the assistant thread run to continue.", - "items": { - "$ref": "#/definitions/RequiredToolCall" - }, - "x-ms-client-name": "toolCalls" - } - }, - "required": [ - "tool_calls" - ] - }, - "ThreadDeletionStatus": { - "type": "object", - "description": "The status of a thread deletion operation.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource specified for deletion." - }, - "deleted": { - "type": "boolean", - "description": "A value indicating whether deletion was successful." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.deleted'.", - "enum": [ - "thread.deleted" - ], - "x-ms-enum": { - "modelAsString": false - } - } - }, - "required": [ - "id", - "deleted", - "object" - ] - }, - "ThreadInitializationMessage": { - "type": "object", - "description": "A single message within an assistant thread, as provided during that thread's creation for its initial state.", - "properties": { - "role": { - "$ref": "#/definitions/MessageRole", - "description": "The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread." - }, - "content": { - "type": "string", - "description": "The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API." - }, - "file_ids": { - "type": "array", - "description": "A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can\naccess files.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "role", - "content" - ] - }, - "ThreadMessage": { - "type": "object", - "description": "A single, existing message within an assistant thread.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.message'.", - "enum": [ - "thread.message" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "thread_id": { - "type": "string", - "description": "The ID of the thread that this message belongs to.", - "x-ms-client-name": "threadId" - }, - "status": { - "$ref": "#/definitions/MessageStatus", - "description": "The status of the message." - }, - "incomplete_details": { - "$ref": "#/definitions/MessageIncompleteDetailsReason", - "description": "On an incomplete message, details about why the message is incomplete.", - "x-nullable": true, - "x-ms-client-name": "incompleteDetails" - }, - "completed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the message was completed.", - "x-nullable": true, - "x-ms-client-name": "completedAt" - }, - "incomplete_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", - "x-nullable": true, - "x-ms-client-name": "incompleteAt" - }, - "role": { - "$ref": "#/definitions/MessageRole", - "description": "The role associated with the assistant thread message." - }, - "content": { - "type": "array", - "description": "The list of content items associated with the assistant thread message.", - "items": { - "$ref": "#/definitions/MessageContent" - }, - "x-ms-identifiers": [] - }, - "assistant_id": { - "type": "string", - "description": "If applicable, the ID of the assistant that authored this message.", - "x-ms-client-name": "assistantId" - }, - "run_id": { - "type": "string", - "description": "If applicable, the ID of the run associated with the authoring of this message.", - "x-ms-client-name": "runId" - }, - "file_ids": { - "type": "array", - "description": "A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can\naccess files.", - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "created_at", - "thread_id", - "status", - "incomplete_details", - "completed_at", - "incomplete_at", - "role", - "content", - "file_ids", - "metadata" - ] - }, - "ThreadRun": { - "type": "object", - "description": "Data representing a single evaluation run of an assistant thread.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.run'.", - "enum": [ - "thread.run" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "thread_id": { - "type": "string", - "description": "The ID of the thread associated with this run.", - "x-ms-client-name": "threadId" - }, - "assistant_id": { - "type": "string", - "description": "The ID of the assistant associated with the thread this run was performed against.", - "x-ms-client-name": "assistantId" - }, - "status": { - "$ref": "#/definitions/RunStatus", - "description": "The status of the assistant thread run." - }, - "required_action": { - "type": "object", - "description": "The details of the action required for the assistant thread run to continue.", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RequiredAction" - } - ], - "x-ms-client-name": "requiredAction" - }, - "last_error": { - "type": "object", - "description": "The last error, if any, encountered by this assistant thread run.", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RunError" - } - ], - "x-ms-client-name": "lastError" - }, - "model": { - "type": "string", - "description": "The ID of the model to use." - }, - "instructions": { - "type": "string", - "description": "The overridden system instructions used for this assistant thread run." - }, - "tools": { - "type": "array", - "description": "The overridden enabled tools used for this assistant thread run.", - "default": [], - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "file_ids": { - "type": "array", - "description": "A list of attached file IDs, ordered by creation date in ascending order.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this item expires.", - "x-nullable": true, - "x-ms-client-name": "expiresAt" - }, - "started_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this item was started.", - "x-nullable": true, - "x-ms-client-name": "startedAt" - }, - "completed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this completed.", - "x-nullable": true, - "x-ms-client-name": "completedAt" - }, - "cancelled_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this was cancelled.", - "x-nullable": true, - "x-ms-client-name": "cancelledAt" - }, - "failed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this failed.", - "x-nullable": true, - "x-ms-client-name": "failedAt" - }, - "usage": { - "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.).", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RunCompletionUsage" - } - ] - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "thread_id", - "assistant_id", - "status", - "last_error", - "model", - "instructions", - "tools", - "file_ids", - "created_at", - "expires_at", - "started_at", - "completed_at", - "cancelled_at", - "failed_at", - "usage", - "metadata" - ] - }, - "ToolDefinition": { - "type": "object", - "description": "An abstract representation of an input tool definition that an assistant can use.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "ToolOutput": { - "type": "object", - "description": "The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue.", - "properties": { - "tool_call_id": { - "type": "string", - "description": "The ID of the tool call being resolved, as provided in the tool calls of a required action from a run.", - "x-ms-client-name": "toolCallId" - }, - "output": { - "type": "string", - "description": "The output from the tool to be submitted." - } - } - }, - "UpdateAssistantOptions": { - "type": "object", - "description": "The request details to use when modifying an existing assistant.", - "properties": { - "model": { - "type": "string", - "description": "The ID of the model to use." - }, - "name": { - "type": "string", - "description": "The modified name for the assistant to use.", - "x-nullable": true - }, - "description": { - "type": "string", - "description": "The modified description for the assistant to use.", - "x-nullable": true - }, - "instructions": { - "type": "string", - "description": "The modified system instructions for the new assistant to use.", - "x-nullable": true - }, - "tools": { - "type": "array", - "description": "The modified collection of tools to enable for the assistant.", - "default": [], - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "file_ids": { - "type": "array", - "description": "The modified list of previously uploaded fileIDs to attach to the assistant.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - } - }, - "parameters": { - "UpdateAssistantOptions.assistantId": { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to modify.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - } - } -} diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml deleted file mode 100644 index fc87e465efff..000000000000 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/placeholder-for-future-release/assistants_generated.yaml +++ /dev/null @@ -1,3144 +0,0 @@ -openapi: 3.0.0 -info: - title: Azure OpenAI - description: Azure OpenAI APIs for Assistants. - version: placeholder-for-future-release -tags: [] -paths: - /assistants: - post: - operationId: createAssistant - description: Creates a new assistant. - parameters: [] - responses: - '200': - description: The new assistant instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Assistant' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantCreationOptions' - get: - operationId: listAssistants - description: Gets a list of assistants that were previously created. - parameters: - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of assistants. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/Assistant' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /assistants/{assistantId}: - get: - operationId: getAssistant - description: Retrieves an existing assistant. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant to retrieve. - schema: - type: string - responses: - '200': - description: The requested assistant instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Assistant' - post: - operationId: updateAssistant - description: Modifies an existing assistant. - parameters: - - $ref: '#/components/parameters/UpdateAssistantOptions.assistantId' - responses: - '200': - description: The updated assistant instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Assistant' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateAssistantOptions' - delete: - operationId: deleteAssistant - description: Deletes an assistant. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant to delete. - schema: - type: string - responses: - '200': - description: Status information about the requested deletion operation. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantDeletionStatus' - /assistants/{assistantId}/files: - post: - operationId: createAssistantFile - description: Attaches a previously uploaded file to an assistant for use by tools that can read files. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant to attach the file to. - schema: - type: string - responses: - '200': - description: Information about the attached file. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantFile' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - file_id: - type: string - description: The ID of the previously uploaded file to attach. - required: - - file_id - get: - operationId: listAssistantFiles - description: Gets a list of files attached to a specific assistant, as used by tools that can read files. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant to retrieve the list of attached files for. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of files attached to the specified assistant. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/AssistantFile' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /assistants/{assistantId}/files/{fileId}: - get: - operationId: getAssistantFile - description: Retrieves a file attached to an assistant. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant associated with the attached file. - schema: - type: string - - name: fileId - in: path - required: true - description: The ID of the file to retrieve. - schema: - type: string - responses: - '200': - description: A representation of the attached file. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantFile' - delete: - operationId: deleteAssistantFile - description: |- - Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read - files. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant from which the specified file should be unlinked. - schema: - type: string - - name: fileId - in: path - required: true - description: The ID of the file to unlink from the specified assistant. - schema: - type: string - responses: - '200': - description: Status information about the requested file association deletion. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantFileDeletionStatus' - /files: - get: - operationId: listFiles - description: Gets a list of previously uploaded files. - parameters: - - name: purpose - in: query - required: false - description: A value that, when provided, limits list results to files matching the corresponding purpose. - schema: - $ref: '#/components/schemas/FilePurpose' - responses: - '200': - description: The requested list of files. - content: - application/json: - schema: - $ref: '#/components/schemas/FileListResponse' - post: - operationId: uploadFile - description: Uploads a file for use by other operations. - parameters: [] - responses: - '200': - description: A representation of the uploaded file. - content: - application/json: - schema: - $ref: '#/components/schemas/OpenAIFile' - requestBody: - required: true - content: - multipart/form-data: - schema: - type: object - properties: - file: - type: string - format: binary - purpose: - allOf: - - $ref: '#/components/schemas/FilePurpose' - description: The intended purpose of the file. - filename: - type: string - description: A filename to associate with the uploaded data. - required: - - file - - purpose - /files/{fileId}: - delete: - operationId: deleteFile - description: Delete a previously uploaded file. - parameters: - - name: fileId - in: path - required: true - description: The ID of the file to delete. - schema: - type: string - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/FileDeletionStatus' - get: - operationId: getFile - description: Returns information about a specific file. Does not retrieve file content. - parameters: - - name: fileId - in: path - required: true - description: The ID of the file to retrieve. - schema: - type: string - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/OpenAIFile' - /files/{fileId}/content: - get: - operationId: getFileContent - description: Returns information about a specific file. Does not retrieve file content. - parameters: - - name: fileId - in: path - required: true - description: The ID of the file to retrieve. - schema: - type: string - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: string - format: byte - /threads: - post: - operationId: createThread - description: Creates a new thread. Threads contain messages and can be run by assistants. - parameters: [] - responses: - '200': - description: Information about the newly created thread. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantThread' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantThreadCreationOptions' - /threads/runs: - post: - operationId: createThreadAndRun - description: Creates a new assistant thread and immediately starts a run using that new thread. - parameters: [] - responses: - '200': - description: Information about the newly created thread. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CreateAndRunThreadOptions' - /threads/{threadId}: - get: - operationId: getThread - description: Gets information about an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to retrieve information about. - schema: - type: string - responses: - '200': - description: Information about the requested thread. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantThread' - post: - operationId: updateThread - description: Modifies an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to modify. - schema: - type: string - responses: - '200': - description: Information about the modified thread. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantThread' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - delete: - operationId: deleteThread - description: Deletes an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to delete. - schema: - type: string - responses: - '200': - description: Status information about the requested thread deletion operation. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadDeletionStatus' - /threads/{threadId}/messages: - post: - operationId: createMessage - description: Creates a new message on a specified thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to create the new message on. - schema: - type: string - responses: - '200': - description: A representation of the new message. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadMessage' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - role: - allOf: - - $ref: '#/components/schemas/MessageRole' - description: The role to associate with the new message. - content: - type: string - description: The textual content for the new message. - file_ids: - type: array - items: - type: string - description: A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - required: - - role - - content - get: - operationId: listMessages - description: Gets a list of messages that exist on a thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to list messages from. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of messages. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/ThreadMessage' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /threads/{threadId}/messages/{messageId}: - get: - operationId: getMessage - description: Gets an existing message from an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to retrieve the specified message from. - schema: - type: string - - name: messageId - in: path - required: true - description: The ID of the message to retrieve from the specified thread. - schema: - type: string - responses: - '200': - description: A representation of the requested message. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadMessage' - post: - operationId: updateMessage - description: Modifies an existing message on an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread containing the specified message to modify. - schema: - type: string - - name: messageId - in: path - required: true - description: The ID of the message to modify on the specified thread. - schema: - type: string - responses: - '200': - description: A representation of the modified message. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadMessage' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /threads/{threadId}/messages/{messageId}/files: - get: - operationId: listMessageFiles - description: Gets a list of previously uploaded files associated with a message from a thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread containing the message to list files from. - schema: - type: string - - name: messageId - in: path - required: true - description: The ID of the message to list files from. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of files associated with the specified message. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/MessageFile' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /threads/{threadId}/messages/{messageId}/files/{fileId}: - get: - operationId: getMessageFile - description: Gets information about a file attachment to a message within a thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread containing the message to get information from. - schema: - type: string - - name: messageId - in: path - required: true - description: The ID of the message to get information from. - schema: - type: string - - name: fileId - in: path - required: true - description: The ID of the file to get information about. - schema: - type: string - responses: - '200': - description: The requested file information. - content: - application/json: - schema: - $ref: '#/components/schemas/MessageFile' - /threads/{threadId}/runs: - post: - operationId: createRun - description: Creates a new run for an assistant thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to run. - schema: - type: string - responses: - '200': - description: Information about the new thread run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - requestBody: - description: The details for the run to create. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CreateRunOptions' - get: - operationId: listRuns - description: Gets a list of runs for a specified thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to list runs from. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of thread runs. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/ThreadRun' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /threads/{threadId}/runs/{runId}: - get: - operationId: getRun - description: Gets an existing run from an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to retrieve run information from. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the thread to retrieve information about. - schema: - type: string - responses: - '200': - description: The requested information about the specified thread run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - post: - operationId: updateRun - description: Modifies an existing thread run. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread associated with the specified run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the run to modify. - schema: - type: string - responses: - '200': - description: Information about the modified run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /threads/{threadId}/runs/{runId}/cancel: - post: - operationId: cancelRun - description: Cancels a run of an in progress thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread being run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the run to cancel. - schema: - type: string - responses: - '200': - description: Updated information about the cancelled run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - /threads/{threadId}/runs/{runId}/steps: - get: - operationId: listRunSteps - description: Gets a list of run steps from a thread run. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread that was run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the run to list steps from. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of run steps. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/RunStep' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /threads/{threadId}/runs/{runId}/steps/{stepId}: - get: - operationId: getRunStep - description: Gets a single run step from a thread run. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread that was run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the specific run to retrieve the step from. - schema: - type: string - - name: stepId - in: path - required: true - description: The ID of the step to retrieve information about. - schema: - type: string - responses: - '200': - description: Information about the requested run step. - content: - application/json: - schema: - $ref: '#/components/schemas/RunStep' - /threads/{threadId}/runs/{runId}/submit_tool_outputs: - post: - operationId: submitToolOutputsToRun - description: Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread that was run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the run that requires tool outputs. - schema: - type: string - responses: - '200': - description: Updated information about the run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - tool_outputs: - type: array - items: - $ref: '#/components/schemas/ToolOutput' - description: The list of tool outputs requested by tool calls from the specified run. - stream: - type: boolean - 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 -security: - - ApiKeyAuth: [] - - OAuth2Auth: - - https://cognitiveservices.azure.com/.default -components: - parameters: - UpdateAssistantOptions.assistantId: - name: assistantId - in: path - required: true - description: The ID of the assistant to modify. - schema: - type: string - schemas: - Assistant: - type: object - required: - - id - - object - - created_at - - name - - description - - model - - instructions - - tools - - file_ids - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - assistant - description: The object type, which is always assistant. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - name: - type: string - nullable: true - description: The name of the assistant. - description: - type: string - nullable: true - description: The description of the assistant. - model: - type: string - description: The ID of the model to use. - instructions: - type: string - nullable: true - description: The system instructions for the assistant to use. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The collection of tools enabled for the assistant. - default: [] - file_ids: - type: array - items: - type: string - description: A list of attached file IDs, ordered by creation date in ascending order. - default: [] - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: Represents an assistant that can call the model and use tools. - AssistantCreationOptions: - type: object - required: - - model - properties: - model: - type: string - description: The ID of the model to use. - name: - type: string - nullable: true - description: The name of the new assistant. - description: - type: string - nullable: true - description: The description of the new assistant. - instructions: - type: string - nullable: true - description: The system instructions for the new assistant to use. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The collection of tools to enable for the new assistant. - default: [] - file_ids: - type: array - items: - type: string - description: A list of previously uploaded file IDs to attach to the assistant. - default: [] - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The request details to use when creating a new assistant. - AssistantDeletionStatus: - type: object - required: - - id - - deleted - - object - properties: - id: - type: string - description: The ID of the resource specified for deletion. - deleted: - type: boolean - description: A value indicating whether deletion was successful. - object: - type: string - enum: - - assistant.deleted - description: The object type, which is always 'assistant.deleted'. - description: The status of an assistant deletion operation. - AssistantFile: - type: object - required: - - id - - object - - created_at - - assistant_id - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - assistant.file - description: The object type, which is always 'assistant.file'. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - assistant_id: - type: string - description: The assistant ID that the file is attached to. - description: Information about a file attached to an assistant, as used by tools that can read files. - AssistantFileDeletionStatus: - type: object - required: - - id - - deleted - - object - properties: - id: - type: string - description: The ID of the resource specified for deletion. - deleted: - type: boolean - description: A value indicating whether deletion was successful. - object: - type: string - enum: - - assistant.file.deleted - description: The object type, which is always 'assistant.file.deleted'. - description: The status of an assistant file deletion operation. - AssistantStreamEvent: - anyOf: - - $ref: '#/components/schemas/ThreadStreamEvent' - - $ref: '#/components/schemas/RunStreamEvent' - - $ref: '#/components/schemas/RunStepStreamEvent' - - $ref: '#/components/schemas/MessageStreamEvent' - - $ref: '#/components/schemas/ErrorEvent' - - $ref: '#/components/schemas/DoneEvent' - AssistantThread: - type: object - required: - - id - - object - - created_at - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread - description: The object type, which is always 'thread'. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: Information about a single thread associated with an assistant. - AssistantThreadCreationOptions: - type: object - properties: - messages: - type: array - items: - $ref: '#/components/schemas/ThreadInitializationMessage' - description: The initial messages to associate with the new thread. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The details used to create a new assistant thread. - CodeInterpreterToolDefinition: - type: object - required: - - type - properties: - type: - type: string - enum: - - code_interpreter - description: The object type, which is always 'code_interpreter'. - allOf: - - $ref: '#/components/schemas/ToolDefinition' - description: The input definition information for a code interpreter tool as used to configure an assistant. - CreateAndRunThreadOptions: - type: object - required: - - assistant_id - properties: - assistant_id: - type: string - description: The ID of the assistant for which the thread should be created. - thread: - allOf: - - $ref: '#/components/schemas/AssistantThreadCreationOptions' - description: The details used to create the new thread. - model: - type: string - description: The overridden model that the assistant should use to run the thread. - instructions: - type: string - description: The overridden system instructions the assistant should use to run the thread. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The overridden list of enabled tools the assistant should use to run the thread. - stream: - type: boolean - 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. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The details used when creating and immediately running a new assistant thread. - CreateRunOptions: - type: object - required: - - assistant_id - properties: - assistant_id: - type: string - description: The ID of the assistant that should run the thread. - model: - type: string - nullable: true - description: The overridden model name that the assistant should use to run the thread. - instructions: - type: string - nullable: true - description: The overridden system instructions that the assistant should use to run the thread. - additional_instructions: - type: string - nullable: true - description: |- - Additional instructions to append 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. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - nullable: true - description: The overridden list of enabled tools that the assistant should use to run the thread. - stream: - type: boolean - 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. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The details used when creating a new run of an assistant thread. - DoneEvent: - anyOf: - - type: string - - type: string - enum: - - done - ErrorEvent: - anyOf: - - type: string - - type: string - enum: - - error - FileDeletionStatus: - type: object - required: - - id - - deleted - - object - properties: - id: - type: string - description: The ID of the resource specified for deletion. - deleted: - type: boolean - description: A value indicating whether deletion was successful. - object: - type: string - enum: - - file - description: The object type, which is always 'file'. - description: A status response from a file deletion operation. - FileListResponse: - type: object - required: - - object - - data - properties: - object: - type: string - enum: - - list - description: The object type, which is always 'list'. - data: - type: array - items: - $ref: '#/components/schemas/OpenAIFile' - description: The files returned for the request. - description: The response data from a file list operation. - FilePurpose: - anyOf: - - type: string - - type: string - enum: - - fine-tune - - fine-tune-results - - assistants - - assistants_output - description: The possible values denoting the intended usage of a file. - FunctionDefinition: - type: object - required: - - name - - parameters - properties: - name: - type: string - description: The name of the function to be called. - description: - type: string - description: A description of what the function does, used by the model to choose when and how to call the function. - parameters: - description: The parameters the functions accepts, described as a JSON Schema object. - description: The input definition information for a function. - FunctionToolDefinition: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - description: The object type, which is always 'function'. - function: - allOf: - - $ref: '#/components/schemas/FunctionDefinition' - description: The definition of the concrete function that the function tool should call. - allOf: - - $ref: '#/components/schemas/ToolDefinition' - description: The input definition information for a function tool as used to configure an assistant. - ListSortOrder: - anyOf: - - type: string - - type: string - enum: - - asc - - desc - description: The available sorting options when requesting a list of response objects. - MessageContent: - type: object - required: - - type - properties: - type: - type: string - description: The object type. - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/MessageTextContent' - image_file: '#/components/schemas/MessageImageFileContent' - description: An abstract representation of a single item of thread message content. - MessageDelta: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/MessageRole' - description: The entity that produced the message. - content: - type: array - items: - $ref: '#/components/schemas/MessageDeltaContent' - description: The content of the message as an array of text and/or images. - file_ids: - type: array - items: - type: string - description: A list of file IDs that the assistant can use. - default: [] - description: Represents the typed 'delta' payload within a streaming message delta chunk. - MessageDeltaChunk: - type: object - required: - - id - - object - - delta - properties: - id: - type: string - description: The identifier of the message, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.message.delta - description: The object type, which is always `thread.message.delta`. - delta: - allOf: - - $ref: '#/components/schemas/MessageDelta' - description: The delta containing the fields that have changed on the Message. - description: Represents a message delta i.e. any changed fields on a message during streaming. - MessageDeltaContent: - type: object - required: - - index - - type - properties: - index: - type: integer - format: int32 - description: The index of the content part of the message. - type: - type: string - description: The type of content for this content part. - discriminator: - propertyName: type - mapping: - image_file: '#/components/schemas/MessageDeltaImageFileContent' - text: '#/components/schemas/MessageDeltaTextContentObject' - description: The abstract base representation of a partial streamed message content payload. - MessageDeltaImageFileContent: - type: object - required: - - type - properties: - type: - type: string - enum: - - image_file - description: The type of content for this content part, which is always "image_file." - image_file: - allOf: - - $ref: '#/components/schemas/MessageDeltaImageFileContentObject' - description: The image_file data. - allOf: - - $ref: '#/components/schemas/MessageDeltaContent' - description: Represents a streamed image file content part within a streaming message delta chunk. - MessageDeltaImageFileContentObject: - type: object - properties: - file_id: - type: string - description: The file ID of the image in the message content. - description: Represents the 'image_file' payload within streaming image file content. - MessageDeltaTextAnnotation: - type: object - required: - - index - - type - properties: - index: - type: integer - format: int32 - description: The index of the annotation within a text content part. - type: - type: string - description: The type of the text content annotation. - discriminator: - propertyName: type - mapping: - file_citation: '#/components/schemas/MessageDeltaTextFileCitationAnnotationObject' - file_path: '#/components/schemas/MessageDeltaTextFilePathAnnotationObject' - description: The abstract base representation of a streamed text content part's text annotation. - MessageDeltaTextContent: - type: object - properties: - value: - type: string - description: The data that makes up the text. - annotations: - type: array - items: - $ref: '#/components/schemas/MessageDeltaTextAnnotation' - description: Annotations for the text. - description: Represents the data of a streamed text content part within a streaming message delta chunk. - MessageDeltaTextContentObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - text - description: The type of content for this content part, which is always "text." - text: - allOf: - - $ref: '#/components/schemas/MessageDeltaTextContent' - description: The text content details. - allOf: - - $ref: '#/components/schemas/MessageDeltaContent' - description: Represents a streamed text content part within a streaming message delta chunk. - MessageDeltaTextFileCitationAnnotation: - type: object - properties: - file_id: - type: string - description: The ID of the specific file the citation is from. - quote: - type: string - description: The specific quote in the cited file. - description: Represents the data of a streamed file citation as applied to a streaming text content part. - MessageDeltaTextFileCitationAnnotationObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - file_citation - description: The type of the text content annotation, which is always "file_citation." - file_citation: - allOf: - - $ref: '#/components/schemas/MessageDeltaTextFileCitationAnnotation' - description: The file citation information. - start_index: - type: integer - format: int32 - description: The start index of this annotation in the content text. - end_index: - type: integer - format: int32 - description: The end index of this annotation in the content text. - allOf: - - $ref: '#/components/schemas/MessageDeltaTextAnnotation' - description: Represents a streamed file citation applied to a streaming text content part. - MessageDeltaTextFilePathAnnotation: - type: object - properties: - file_id: - type: string - description: The file ID for the annotation. - description: Represents the data of a streamed file path annotation as applied to a streaming text content part. - MessageDeltaTextFilePathAnnotationObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - file_path - description: The type of the text content annotation, which is always "file_path." - file_path: - allOf: - - $ref: '#/components/schemas/MessageDeltaTextFilePathAnnotation' - description: The file path information. - start_index: - type: integer - format: int32 - description: The start index of this annotation in the content text. - end_index: - type: integer - format: int32 - description: The end index of this annotation in the content text. - allOf: - - $ref: '#/components/schemas/MessageDeltaTextAnnotation' - description: Represents a streamed file path annotation applied to a streaming text content part. - MessageFile: - type: object - required: - - id - - object - - created_at - - message_id - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.message.file - description: The object type, which is always 'thread.message.file'. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - message_id: - type: string - description: The ID of the message that this file is attached to. - description: Information about a file attached to an assistant thread message. - MessageImageFileContent: - type: object - required: - - type - - image_file - properties: - type: - type: string - enum: - - image_file - description: The object type, which is always 'image_file'. - image_file: - allOf: - - $ref: '#/components/schemas/MessageImageFileDetails' - description: The image file for this thread message content item. - allOf: - - $ref: '#/components/schemas/MessageContent' - description: A representation of image file content in a thread message. - MessageImageFileDetails: - type: object - required: - - file_id - properties: - file_id: - type: string - description: The ID for the file associated with this image. - description: An image reference, as represented in thread message content. - MessageIncompleteDetails: - type: object - required: - - reason - properties: - reason: - allOf: - - $ref: '#/components/schemas/MessageIncompleteDetailsReason' - description: The provided reason describing why the message was marked as incomplete. - description: Information providing additional detail about a message entering an incomplete status. - MessageIncompleteDetailsReason: - anyOf: - - type: string - - type: string - enum: - - content_filter - - max_tokens - - run_cancelled - - run_failed - description: A set of reasons describing why a message is marked as incomplete. - MessageRole: - anyOf: - - type: string - - type: string - enum: - - user - - assistant - description: The possible values for roles attributed to messages in a thread. - MessageStatus: - anyOf: - - type: string - - type: string - enum: - - in_progress - - incomplete - - completed - description: The possible execution status values for a thread message. - MessageStreamEvent: - anyOf: - - type: string - - type: string - enum: - - thread.message.created - - thread.message.in_progress - - thread.message.delta - - thread.message.completed - - thread.message.incomplete - description: Message operation related streaming events - MessageTextAnnotation: - type: object - required: - - type - - text - properties: - type: - type: string - description: The object type. - text: - type: string - description: The textual content associated with this text annotation item. - discriminator: - propertyName: type - mapping: - file_citation: '#/components/schemas/MessageTextFileCitationAnnotation' - file_path: '#/components/schemas/MessageTextFilePathAnnotation' - description: An abstract representation of an annotation to text thread message content. - MessageTextContent: - type: object - required: - - type - - text - properties: - type: - type: string - enum: - - text - description: The object type, which is always 'text'. - text: - allOf: - - $ref: '#/components/schemas/MessageTextDetails' - description: The text and associated annotations for this thread message content item. - allOf: - - $ref: '#/components/schemas/MessageContent' - description: A representation of a textual item of thread message content. - MessageTextDetails: - type: object - required: - - value - - annotations - properties: - value: - type: string - description: The text data. - annotations: - type: array - items: - $ref: '#/components/schemas/MessageTextAnnotation' - description: A list of annotations associated with this text. - description: The text and associated annotations for a single item of assistant thread message content. - MessageTextFileCitationAnnotation: - type: object - required: - - type - - file_citation - properties: - type: - type: string - enum: - - file_citation - description: The object type, which is always 'file_citation'. - file_citation: - allOf: - - $ref: '#/components/schemas/MessageTextFileCitationDetails' - description: |- - A citation within the message that points to a specific quote from a specific file. - Generated when the assistant uses the "retrieval" tool to search files. - start_index: - type: integer - format: int32 - description: The first text index associated with this text annotation. - end_index: - type: integer - format: int32 - description: The last text index associated with this text annotation. - allOf: - - $ref: '#/components/schemas/MessageTextAnnotation' - 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. - MessageTextFileCitationDetails: - type: object - required: - - file_id - - quote - properties: - file_id: - type: string - description: The ID of the file associated with this citation. - quote: - type: string - description: The specific quote cited in the associated file. - description: A representation of a file-based text citation, as used in a file-based annotation of text thread message content. - MessageTextFilePathAnnotation: - type: object - required: - - type - - file_path - properties: - type: - type: string - enum: - - file_path - description: The object type, which is always 'file_path'. - file_path: - allOf: - - $ref: '#/components/schemas/MessageTextFilePathDetails' - description: A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. - start_index: - type: integer - format: int32 - description: The first text index associated with this text annotation. - end_index: - type: integer - format: int32 - description: The last text index associated with this text annotation. - allOf: - - $ref: '#/components/schemas/MessageTextAnnotation' - description: A citation within the message that points to a file located at a specific path. - MessageTextFilePathDetails: - type: object - required: - - file_id - properties: - file_id: - type: string - description: The ID of the specific file that the citation is from. - description: An encapsulation of an image file ID, as used by message image content. - OpenAIFile: - type: object - required: - - object - - id - - bytes - - filename - - created_at - - purpose - properties: - object: - type: string - enum: - - file - description: The object type, which is always 'file'. - id: - type: string - description: The identifier, which can be referenced in API endpoints. - bytes: - type: integer - format: int32 - description: The size of the file, in bytes. - filename: - type: string - description: The name of the file. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - purpose: - allOf: - - $ref: '#/components/schemas/FilePurpose' - description: The intended purpose of a file. - description: Represents an assistant that can call the model and use tools. - RequiredAction: - type: object - required: - - type - properties: - type: - type: string - description: The object type. - discriminator: - propertyName: type - mapping: - submit_tool_outputs: '#/components/schemas/SubmitToolOutputsAction' - description: An abstract representation of a required action for an assistant thread run to continue. - RequiredFunctionToolCall: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - description: The object type of the required tool call. Always 'function' for function tools. - function: - allOf: - - $ref: '#/components/schemas/RequiredFunctionToolCallDetails' - description: Detailed information about the function to be executed by the tool that includes name and arguments. - allOf: - - $ref: '#/components/schemas/RequiredToolCall' - description: A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. - RequiredFunctionToolCallDetails: - type: object - required: - - name - - arguments - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. - description: The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function. - RequiredToolCall: - type: object - required: - - type - - id - properties: - type: - type: string - description: The object type for the required tool call. - id: - type: string - description: The ID of the tool call. This ID must be referenced when submitting tool outputs. - discriminator: - propertyName: type - mapping: - function: '#/components/schemas/RequiredFunctionToolCall' - description: An abstract representation a a tool invocation needed by the model to continue a run. - RetrievalToolDefinition: - type: object - required: - - type - properties: - type: - type: string - enum: - - retrieval - description: The object type, which is always 'retrieval'. - allOf: - - $ref: '#/components/schemas/ToolDefinition' - description: The input definition information for a retrieval tool as used to configure an assistant. - RunCompletionUsage: - type: object - required: - - completion_tokens - - prompt_tokens - - total_tokens - properties: - completion_tokens: - type: integer - format: int64 - description: Number of completion tokens used over the course of the run. - prompt_tokens: - type: integer - format: int64 - description: Number of prompt tokens used over the course of the run. - total_tokens: - type: integer - format: int64 - description: Total number of tokens used (prompt + completion). - description: Usage statistics related to the run. - RunError: - type: object - required: - - code - - message - properties: - code: - type: string - description: The status for the error. - message: - type: string - description: The human-readable text associated with the error. - description: The details of an error as encountered by an assistant thread run. - RunStatus: - anyOf: - - type: string - - type: string - enum: - - queued - - in_progress - - requires_action - - cancelling - - cancelled - - failed - - completed - - expired - description: Possible values for the status of an assistant thread run. - RunStep: - type: object - required: - - id - - object - - type - - assistant_id - - thread_id - - run_id - - status - - step_details - - last_error - - created_at - - expired_at - - completed_at - - cancelled_at - - failed_at - - usage - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.run.step - description: The object type, which is always 'thread.run.step'. - type: - allOf: - - $ref: '#/components/schemas/RunStepType' - description: The type of run step, which can be either message_creation or tool_calls. - assistant_id: - type: string - description: The ID of the assistant associated with the run step. - thread_id: - type: string - description: The ID of the thread that was run. - run_id: - type: string - description: The ID of the run that this run step is a part of. - status: - allOf: - - $ref: '#/components/schemas/RunStepStatus' - description: The status of this run step. - step_details: - allOf: - - $ref: '#/components/schemas/RunStepDetails' - description: The details for this run step. - last_error: - type: object - allOf: - - $ref: '#/components/schemas/RunStepError' - nullable: true - description: If applicable, information about the last error encountered by this run step. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - expired_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this item expired. - completed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this completed. - cancelled_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this was cancelled. - failed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this failed. - usage: - type: object - allOf: - - $ref: '#/components/schemas/RunStepCompletionUsage' - nullable: true - description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: Detailed information about a single step of an assistant thread run. - RunStepCodeInterpreterImageOutput: - type: object - required: - - type - - image - properties: - type: - type: string - enum: - - image - description: The object type, which is always 'image'. - image: - allOf: - - $ref: '#/components/schemas/RunStepCodeInterpreterImageReference' - description: Referential information for the image associated with this output. - allOf: - - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' - description: A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. - RunStepCodeInterpreterImageReference: - type: object - required: - - file_id - properties: - file_id: - type: string - description: The ID of the file associated with this image. - description: An image reference emitted by a code interpreter tool in response to a tool call by the model. - RunStepCodeInterpreterLogOutput: - type: object - required: - - type - - logs - properties: - type: - type: string - enum: - - logs - description: The object type, which is always 'logs'. - logs: - type: string - description: The serialized log output emitted by the code interpreter. - allOf: - - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' - description: A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. - RunStepCodeInterpreterToolCall: - type: object - required: - - type - - code_interpreter - properties: - type: - type: string - enum: - - code_interpreter - description: The object type, which is always 'code_interpreter'. - code_interpreter: - allOf: - - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallDetails' - description: The details of the tool call to the code interpreter tool. - allOf: - - $ref: '#/components/schemas/RunStepToolCall' - description: |- - A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that - represents inputs and outputs consumed and emitted by the code interpreter. - RunStepCodeInterpreterToolCallDetails: - type: object - required: - - input - - outputs - properties: - input: - type: string - description: The input provided by the model to the code interpreter tool. - outputs: - type: array - items: - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' - description: The outputs produced by the code interpreter tool back to the model in response to the tool call. - description: The detailed information about a code interpreter invocation by the model. - RunStepCodeInterpreterToolCallOutput: - type: object - required: - - type - properties: - type: - type: string - description: The object type. - discriminator: - propertyName: type - mapping: - logs: '#/components/schemas/RunStepCodeInterpreterLogOutput' - image: '#/components/schemas/RunStepCodeInterpreterImageOutput' - description: An abstract representation of an emitted output from a code interpreter tool. - RunStepCompletionUsage: - type: object - required: - - completion_tokens - - prompt_tokens - - total_tokens - properties: - completion_tokens: - type: integer - format: int64 - description: Number of completion tokens used over the course of the run step. - prompt_tokens: - type: integer - format: int64 - description: Number of prompt tokens used over the course of the run step. - total_tokens: - type: integer - format: int64 - description: Total number of tokens used (prompt + completion). - description: Usage statistics related to the run step. - RunStepDelta: - type: object - properties: - step_details: - allOf: - - $ref: '#/components/schemas/RunStepDeltaDetail' - description: The details of the run step. - description: Represents the delta payload in a streaming run step delta chunk. - RunStepDeltaChunk: - type: object - required: - - id - - object - - delta - properties: - id: - type: string - description: The identifier of the run step, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.run.step.delta - description: The object type, which is always `thread.run.step.delta`. - delta: - allOf: - - $ref: '#/components/schemas/RunStepDelta' - description: The delta containing the fields that have changed on the run step. - description: Represents a run step delta i.e. any changed fields on a run step during streaming. - RunStepDeltaCodeInterpreterDetailItemObject: - type: object - properties: - input: - type: string - description: The input into the Code Interpreter tool call. - outputs: - type: array - items: - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' - 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. - description: Represents the Code Interpreter tool call data in a streaming run step's tool calls. - RunStepDeltaCodeInterpreterImageOutput: - type: object - required: - - type - properties: - type: - type: string - enum: - - image - description: The object type, which is always "image." - image: - allOf: - - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutputObject' - description: The image data for the Code Interpreter tool call output. - allOf: - - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' - description: Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. - RunStepDeltaCodeInterpreterImageOutputObject: - type: object - properties: - file_id: - type: string - description: The file ID for the image. - description: Represents the data for a streaming run step's Code Interpreter tool call image output. - RunStepDeltaCodeInterpreterLogOutput: - type: object - required: - - type - properties: - type: - type: string - enum: - - logs - description: The type of the object, which is always "logs." - logs: - type: string - description: The text output from the Code Interpreter tool call. - allOf: - - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' - description: Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. - RunStepDeltaCodeInterpreterOutput: - type: object - required: - - index - - type - properties: - index: - type: integer - format: int32 - description: The index of the output in the streaming run step tool call's Code Interpreter outputs array. - type: - type: string - description: The type of the streaming run step tool call's Code Interpreter output. - discriminator: - propertyName: type - mapping: - logs: '#/components/schemas/RunStepDeltaCodeInterpreterLogOutput' - image: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutput' - description: The abstract base representation of a streaming run step tool call's Code Interpreter tool output. - RunStepDeltaCodeInterpreterToolCall: - type: object - required: - - type - properties: - type: - type: string - enum: - - code_interpreter - description: The object type, which is always "code_interpreter." - code_interpreter: - allOf: - - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterDetailItemObject' - description: The Code Interpreter data for the tool call. - allOf: - - $ref: '#/components/schemas/RunStepDeltaToolCall' - description: Represents a Code Interpreter tool call within a streaming run step's tool call details. - RunStepDeltaDetail: - type: object - required: - - type - properties: - type: - type: string - description: The object type for the run step detail object. - discriminator: - propertyName: type - mapping: - message_creation: '#/components/schemas/RunStepDeltaMessageCreation' - tool_calls: '#/components/schemas/RunStepDeltaToolCallObject' - description: Represents a single run step detail item in a streaming run step's delta payload. - RunStepDeltaFunction: - type: object - required: - - name - - arguments - - output - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments passed to the function as input. - output: - type: string - nullable: true - description: The output of the function, null if outputs have not yet been submitted. - description: Represents the function data in a streaming run step delta's function tool call. - RunStepDeltaFunctionToolCall: - type: object - required: - - type - properties: - type: - type: string - enum: - - function - description: The object type, which is always "function." - function: - allOf: - - $ref: '#/components/schemas/RunStepDeltaFunction' - description: The function data for the tool call. - allOf: - - $ref: '#/components/schemas/RunStepDeltaToolCall' - description: Represents a function tool call within a streaming run step's tool call details. - RunStepDeltaMessageCreation: - type: object - required: - - type - properties: - type: - type: string - enum: - - message_creation - description: The object type, which is always "message_creation." - message_creation: - allOf: - - $ref: '#/components/schemas/RunStepDeltaMessageCreationObject' - description: The message creation data. - allOf: - - $ref: '#/components/schemas/RunStepDeltaDetail' - description: Represents a message creation within a streaming run step delta. - RunStepDeltaMessageCreationObject: - type: object - properties: - message_id: - type: string - description: The ID of the newly-created message. - description: Represents the data within a streaming run step message creation response object. - RunStepDeltaRetrievalToolCall: - type: object - required: - - type - properties: - type: - type: string - enum: - - retrieval - description: The object type, which is always "retrieval." - retrieval: - type: object - additionalProperties: - type: string - description: Reserved for future use. - allOf: - - $ref: '#/components/schemas/RunStepDeltaToolCall' - description: Represents a retrieval tool call within a streaming run step's tool call details. - RunStepDeltaToolCall: - type: object - required: - - index - - id - - type - properties: - index: - type: integer - format: int32 - description: The index of the tool call detail in the run step's tool_calls array. - id: - type: string - description: The ID of the tool call, used when submitting outputs to the run. - type: - type: string - description: The type of the tool call detail item in a streaming run step's details. - discriminator: - propertyName: type - mapping: - function: '#/components/schemas/RunStepDeltaFunctionToolCall' - retrieval: '#/components/schemas/RunStepDeltaRetrievalToolCall' - code_interpreter: '#/components/schemas/RunStepDeltaCodeInterpreterToolCall' - description: The abstract base representation of a single tool call within a streaming run step's delta tool call details. - RunStepDeltaToolCallObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - tool_calls - description: The object type, which is always "tool_calls." - tool_calls: - type: array - items: - $ref: '#/components/schemas/RunStepDeltaToolCall' - description: The collection of tool calls for the tool call detail item. - allOf: - - $ref: '#/components/schemas/RunStepDeltaDetail' - description: Represents an invocation of tool calls as part of a streaming run step. - RunStepDetails: - type: object - required: - - type - properties: - type: - allOf: - - $ref: '#/components/schemas/RunStepType' - description: The object type. - discriminator: - propertyName: type - mapping: - message_creation: '#/components/schemas/RunStepMessageCreationDetails' - tool_calls: '#/components/schemas/RunStepToolCallDetails' - description: An abstract representation of the details for a run step. - RunStepError: - type: object - required: - - code - - message - properties: - code: - allOf: - - $ref: '#/components/schemas/RunStepErrorCode' - description: The error code for this error. - message: - type: string - description: The human-readable text associated with this error. - description: The error information associated with a failed run step. - RunStepErrorCode: - anyOf: - - type: string - - type: string - enum: - - server_error - - rate_limit_exceeded - description: Possible error code values attributable to a failed run step. - RunStepFunctionToolCall: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - description: The object type, which is always 'function'. - function: - allOf: - - $ref: '#/components/schemas/RunStepFunctionToolCallDetails' - description: The detailed information about the function called by the model. - allOf: - - $ref: '#/components/schemas/RunStepToolCall' - description: |- - A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs - and output consumed and emitted by the specified function. - RunStepFunctionToolCallDetails: - type: object - required: - - name - - arguments - - output - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments that the model requires are provided to the named function. - output: - type: string - nullable: true - description: The output of the function, only populated for function calls that have already have had their outputs submitted. - description: The detailed information about the function called by the model. - RunStepMessageCreationDetails: - type: object - required: - - type - - message_creation - properties: - type: - type: string - enum: - - message_creation - description: The object type, which is always 'message_creation'. - message_creation: - allOf: - - $ref: '#/components/schemas/RunStepMessageCreationReference' - description: Information about the message creation associated with this run step. - allOf: - - $ref: '#/components/schemas/RunStepDetails' - description: The detailed information associated with a message creation run step. - RunStepMessageCreationReference: - type: object - required: - - message_id - properties: - message_id: - type: string - description: The ID of the message created by this run step. - description: The details of a message created as a part of a run step. - RunStepRetrievalToolCall: - type: object - required: - - type - - retrieval - properties: - type: - type: string - enum: - - retrieval - description: The object type, which is always 'retrieval'. - retrieval: - type: object - additionalProperties: - type: string - description: The key/value pairs produced by the retrieval tool. - allOf: - - $ref: '#/components/schemas/RunStepToolCall' - description: |- - A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents - executed retrieval actions. - RunStepStatus: - anyOf: - - type: string - - type: string - enum: - - in_progress - - cancelled - - failed - - completed - - expired - description: Possible values for the status of a run step. - RunStepStreamEvent: - anyOf: - - type: string - - type: string - enum: - - thread.run.step.created - - thread.run.step.in_progress - - thread.run.step.delta - - thread.run.step.completed - - thread.run.step.failed - - thread.run.step.cancelled - - thread.run.step.expired - description: Run step operation related streaming events - RunStepToolCall: - type: object - required: - - type - - id - properties: - type: - type: string - description: The object type. - id: - type: string - description: The ID of the tool call. This ID must be referenced when you submit tool outputs. - discriminator: - propertyName: type - mapping: - code_interpreter: '#/components/schemas/RunStepCodeInterpreterToolCall' - retrieval: '#/components/schemas/RunStepRetrievalToolCall' - function: '#/components/schemas/RunStepFunctionToolCall' - description: An abstract representation of a detailed tool call as recorded within a run step for an existing run. - RunStepToolCallDetails: - type: object - required: - - type - - tool_calls - properties: - type: - type: string - enum: - - tool_calls - description: The object type, which is always 'tool_calls'. - tool_calls: - type: array - items: - $ref: '#/components/schemas/RunStepToolCall' - description: A list of tool call details for this run step. - allOf: - - $ref: '#/components/schemas/RunStepDetails' - description: The detailed information associated with a run step calling tools. - RunStepType: - anyOf: - - type: string - - type: string - enum: - - message_creation - - tool_calls - description: The possible types of run steps. - RunStreamEvent: - anyOf: - - type: string - - type: string - enum: - - thread.run.created - - thread.run.queued - - thread.run.in_progress - - thread.run.requires_action - - thread.run.completed - - thread.run.failed - - thread.run.cancelling - - thread.run.cancelled - - thread.run.expired - description: Run operation related streaming events - ServiceApiVersions: - type: string - enum: - - 2024-02-15-preview - - placeholder-for-future-release - description: The known set of supported API versions. - SubmitToolOutputsAction: - type: object - required: - - type - - submit_tool_outputs - properties: - type: - type: string - enum: - - submit_tool_outputs - description: The object type, which is always 'submit_tool_outputs'. - submit_tool_outputs: - allOf: - - $ref: '#/components/schemas/SubmitToolOutputsDetails' - description: The details describing tools that should be called to submit tool outputs. - allOf: - - $ref: '#/components/schemas/RequiredAction' - description: The details for required tool calls that must be submitted for an assistant thread run to continue. - SubmitToolOutputsDetails: - type: object - required: - - tool_calls - properties: - tool_calls: - type: array - items: - $ref: '#/components/schemas/RequiredToolCall' - description: The list of tool calls that must be resolved for the assistant thread run to continue. - description: The details describing tools that should be called to submit tool outputs. - ThreadDeletionStatus: - type: object - required: - - id - - deleted - - object - properties: - id: - type: string - description: The ID of the resource specified for deletion. - deleted: - type: boolean - description: A value indicating whether deletion was successful. - object: - type: string - enum: - - thread.deleted - description: The object type, which is always 'thread.deleted'. - description: The status of a thread deletion operation. - ThreadInitializationMessage: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/MessageRole' - description: The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread. - content: - type: string - description: The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API. - file_ids: - type: array - items: - type: string - description: |- - A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can - access files. - default: [] - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: A single message within an assistant thread, as provided during that thread's creation for its initial state. - ThreadMessage: - type: object - required: - - id - - object - - created_at - - thread_id - - status - - incomplete_details - - completed_at - - incomplete_at - - role - - content - - file_ids - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.message - description: The object type, which is always 'thread.message'. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - thread_id: - type: string - description: The ID of the thread that this message belongs to. - status: - allOf: - - $ref: '#/components/schemas/MessageStatus' - description: The status of the message. - incomplete_details: - oneOf: - - $ref: '#/components/schemas/MessageIncompleteDetailsReason' - nullable: true - description: On an incomplete message, details about why the message is incomplete. - completed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp (in seconds) for when the message was completed. - incomplete_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp (in seconds) for when the message was marked as incomplete. - role: - allOf: - - $ref: '#/components/schemas/MessageRole' - description: The role associated with the assistant thread message. - content: - type: array - items: - $ref: '#/components/schemas/MessageContent' - description: The list of content items associated with the assistant thread message. - assistant_id: - type: string - description: If applicable, the ID of the assistant that authored this message. - run_id: - type: string - description: If applicable, the ID of the run associated with the authoring of this message. - file_ids: - type: array - items: - type: string - description: |- - A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can - access files. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: A single, existing message within an assistant thread. - ThreadRun: - type: object - required: - - id - - object - - thread_id - - assistant_id - - status - - last_error - - model - - instructions - - tools - - file_ids - - created_at - - expires_at - - started_at - - completed_at - - cancelled_at - - failed_at - - usage - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.run - description: The object type, which is always 'thread.run'. - thread_id: - type: string - description: The ID of the thread associated with this run. - assistant_id: - type: string - description: The ID of the assistant associated with the thread this run was performed against. - status: - allOf: - - $ref: '#/components/schemas/RunStatus' - description: The status of the assistant thread run. - required_action: - type: object - allOf: - - $ref: '#/components/schemas/RequiredAction' - nullable: true - description: The details of the action required for the assistant thread run to continue. - last_error: - type: object - allOf: - - $ref: '#/components/schemas/RunError' - nullable: true - description: The last error, if any, encountered by this assistant thread run. - model: - type: string - description: The ID of the model to use. - instructions: - type: string - description: The overridden system instructions used for this assistant thread run. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The overridden enabled tools used for this assistant thread run. - default: [] - file_ids: - type: array - items: - type: string - description: A list of attached file IDs, ordered by creation date in ascending order. - default: [] - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - expires_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this item expires. - started_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this item was started. - completed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this completed. - cancelled_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this was cancelled. - failed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this failed. - usage: - type: object - allOf: - - $ref: '#/components/schemas/RunCompletionUsage' - nullable: true - 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.). - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: Data representing a single evaluation run of an assistant thread. - ThreadStreamEvent: - anyOf: - - type: string - - type: string - enum: - - thread.created - description: Thread operation related streaming events - ToolDefinition: - type: object - required: - - type - properties: - type: - type: string - description: The object type. - discriminator: - propertyName: type - mapping: - code_interpreter: '#/components/schemas/CodeInterpreterToolDefinition' - retrieval: '#/components/schemas/RetrievalToolDefinition' - function: '#/components/schemas/FunctionToolDefinition' - description: An abstract representation of an input tool definition that an assistant can use. - ToolOutput: - type: object - properties: - tool_call_id: - type: string - description: The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. - output: - type: string - description: The output from the tool to be submitted. - description: The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. - UpdateAssistantOptions: - type: object - properties: - model: - type: string - description: The ID of the model to use. - name: - type: string - nullable: true - description: The modified name for the assistant to use. - description: - type: string - nullable: true - description: The modified description for the assistant to use. - instructions: - type: string - nullable: true - description: The modified system instructions for the new assistant to use. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The modified collection of tools to enable for the assistant. - default: [] - file_ids: - type: array - items: - type: string - description: The modified list of previously uploaded fileIDs to attach to the assistant. - default: [] - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The request details to use when modifying an existing assistant. - securitySchemes: - ApiKeyAuth: - type: apiKey - in: header - name: api-key - OAuth2Auth: - type: oauth2 - flows: - implicit: - authorizationUrl: https://login.microsoftonline.com/common/oauth2/v2.0/authorize - scopes: - https://cognitiveservices.azure.com/.default: '' -servers: - - url: '{endpoint}' - description: Azure OpenAI APIs for Assistants. - variables: - endpoint: - default: '' - description: An OpenAI endpoint supporting assistants functionality. From 045d2e20043044d5b09d7dc8fb3c7c496f561b2c Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Wed, 15 May 2024 10:33:48 +0200 Subject: [PATCH 18/25] reformating --- specification/ai/OpenAI.Assistants/client.tsp | 2 +- specification/ai/OpenAI.Assistants/streaming/events.tsp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/client.tsp b/specification/ai/OpenAI.Assistants/client.tsp index a62b1a743735..66a025e89dbe 100644 --- a/specification/ai/OpenAI.Assistants/client.tsp +++ b/specification/ai/OpenAI.Assistants/client.tsp @@ -211,7 +211,7 @@ namespace Azure.AI.OpenAI.Assistants { @@usage(DoneEvent, Usage.output); @@access(DoneEvent, Access.internal); -// Ensure some shared types remain public despite interaction with previously internalized details + // Ensure some shared types remain public despite interaction with previously internalized details @@access(MessageTextFilePathAnnotation, Access.public); @@access(MessageTextFileCitationAnnotation, Access.public); @@access(ListSortOrder, Access.public); diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp index c31904d4dddb..1f25f45f78f0 100644 --- a/specification/ai/OpenAI.Assistants/streaming/events.tsp +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -142,7 +142,7 @@ union MessageStreamEvent { ThreadMessageIncomplete: "thread.message.incomplete", } -/** Terminal event indicating a server side error while streaming. */ +/** Terminal event indicating a server side error while streaming. */ @added(ServiceApiVersions.v2024_02_15_preview) union ErrorEvent { string, @@ -152,7 +152,7 @@ union ErrorEvent { Error: "error", } -/** Terminal event indicating the successful end of a stream. */ +/** Terminal event indicating the successful end of a stream. */ @added(ServiceApiVersions.v2024_02_15_preview) union DoneEvent { string, From 62237489e4ef38441f054b09d76f5327b02d6e57 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Thu, 16 May 2024 17:40:56 +0200 Subject: [PATCH 19/25] Maded the stream events public to expose types and docs to users --- specification/ai/OpenAI.Assistants/client.tsp | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/client.tsp b/specification/ai/OpenAI.Assistants/client.tsp index 66a025e89dbe..ed34c25166f5 100644 --- a/specification/ai/OpenAI.Assistants/client.tsp +++ b/specification/ai/OpenAI.Assistants/client.tsp @@ -188,29 +188,6 @@ namespace Azure.AI.OpenAI.Assistants { @@usage(MessageDeltaChunk, Usage.output); @@access(MessageDeltaChunk, Access.public); - // // Stream events - - @@usage(AssistantStreamEvent, Usage.output); - @@access(AssistantStreamEvent, Access.internal); - - @@usage(ThreadStreamEvent, Usage.output); - @@access(ThreadStreamEvent, Access.internal); - - @@usage(RunStreamEvent, Usage.output); - @@access(RunStreamEvent, Access.internal); - - @@usage(RunStepStreamEvent, Usage.output); - @@access(RunStepStreamEvent, Access.internal); - - @@usage(MessageStreamEvent, Usage.output); - @@access(MessageStreamEvent, Access.internal); - - @@usage(ErrorEvent, Usage.output); - @@access(ErrorEvent, Access.internal); - - @@usage(DoneEvent, Usage.output); - @@access(DoneEvent, Access.internal); - // Ensure some shared types remain public despite interaction with previously internalized details @@access(MessageTextFilePathAnnotation, Access.public); @@access(MessageTextFileCitationAnnotation, Access.public); From bbd71d72977a47ab7f3e44a6f2c4706dc745f850 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Thu, 16 May 2024 17:48:47 +0200 Subject: [PATCH 20/25] Made stream events publics --- specification/ai/OpenAI.Assistants/client.tsp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/specification/ai/OpenAI.Assistants/client.tsp b/specification/ai/OpenAI.Assistants/client.tsp index ed34c25166f5..a2ef9ea62da6 100644 --- a/specification/ai/OpenAI.Assistants/client.tsp +++ b/specification/ai/OpenAI.Assistants/client.tsp @@ -188,6 +188,29 @@ namespace Azure.AI.OpenAI.Assistants { @@usage(MessageDeltaChunk, Usage.output); @@access(MessageDeltaChunk, Access.public); + // Stream events : made public to expose documentation and make class casting for strongly typed languages easier + + @@usage(AssistantStreamEvent, Usage.output); + @@access(AssistantStreamEvent, Access.public); + + @@usage(ThreadStreamEvent, Usage.output); + @@access(ThreadStreamEvent, Access.public); + + @@usage(RunStreamEvent, Usage.output); + @@access(RunStreamEvent, Access.public); + + @@usage(RunStepStreamEvent, Usage.output); + @@access(RunStepStreamEvent, Access.public); + + @@usage(MessageStreamEvent, Usage.output); + @@access(MessageStreamEvent, Access.public); + + @@usage(ErrorEvent, Usage.output); + @@access(ErrorEvent, Access.public); + + @@usage(DoneEvent, Usage.output); + @@access(DoneEvent, Access.public); + // Ensure some shared types remain public despite interaction with previously internalized details @@access(MessageTextFilePathAnnotation, Access.public); @@access(MessageTextFileCitationAnnotation, Access.public); From c37212fab390bd5df0a6ea4a6c4862d29a50425f Mon Sep 17 00:00:00 2001 From: Travis Wilson Date: Thu, 16 May 2024 16:17:33 -0700 Subject: [PATCH 21/25] remove single-use options model, merge into route params directly --- .../ai/OpenAI.Assistants/runs/models.tsp | 15 --------------- .../ai/OpenAI.Assistants/runs/routes.tsp | 9 ++++++++- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index b2dbe258fe5d..32f328e86fb2 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -274,18 +274,3 @@ model CreateAndRunThreadOptions { ...OptionalNullableMetadata; } - -#suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" -@doc("Submit the results for the requested tool calls from the service.") -@added(ServiceApiVersions.v2024_02_15_preview) -model SubmitToolOutputsOptions { - @encodedName("application/json", "tool_outputs") - @doc("A list of tools for which the outputs are being submitted.") - toolOutputs: ToolOutput[]; - - @doc(""" - 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. - """) - stream?: boolean | null; -} diff --git a/specification/ai/OpenAI.Assistants/runs/routes.tsp b/specification/ai/OpenAI.Assistants/runs/routes.tsp index 8f90bacc1b9e..d1387e794cfd 100644 --- a/specification/ai/OpenAI.Assistants/runs/routes.tsp +++ b/specification/ai/OpenAI.Assistants/runs/routes.tsp @@ -89,6 +89,8 @@ op updateRun( * * @param threadId The ID of the thread that was run. * @param runId The ID of the run that requires tool outputs. + * @param toolOutputs A list of tools for which the outputs are being submitted. + * @param stream 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. * @returns Updated information about the run. */ #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" @@ -100,7 +102,12 @@ op updateRun( op submitToolOutputsToRun( @path threadId: string, @path runId: string, - ...SubmitToolOutputsOptions, + + @encodedName("application/json", "tool_outputs") + toolOutputs: ToolOutput[], + + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + stream?: boolean | null, ): ThreadRun; /** From a38fc18ed517f0aacfdd91f559f651ceabb0fe6b Mon Sep 17 00:00:00 2001 From: Travis Wilson Date: Thu, 16 May 2024 16:21:01 -0700 Subject: [PATCH 22/25] proactively add 2024-05-01-preview label --- .../create_assistant.json | 0 specification/ai/OpenAI.Assistants/main.tsp | 3 + .../assistants_generated.json | 44 +- .../assistants_generated.json | 3808 +++++++++++++++++ .../assistants_generated.yaml | 32 +- .../assistants_generated.yaml | 3177 ++++++++++++++ 6 files changed, 7022 insertions(+), 42 deletions(-) rename specification/ai/OpenAI.Assistants/examples/{placeholder-for-future-release => 2024-05-01-preview}/create_assistant.json (100%) create mode 100644 specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json create mode 100644 specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml diff --git a/specification/ai/OpenAI.Assistants/examples/placeholder-for-future-release/create_assistant.json b/specification/ai/OpenAI.Assistants/examples/2024-05-01-preview/create_assistant.json similarity index 100% rename from specification/ai/OpenAI.Assistants/examples/placeholder-for-future-release/create_assistant.json rename to specification/ai/OpenAI.Assistants/examples/2024-05-01-preview/create_assistant.json diff --git a/specification/ai/OpenAI.Assistants/main.tsp b/specification/ai/OpenAI.Assistants/main.tsp index 462d1028e419..79c4794e5382 100644 --- a/specification/ai/OpenAI.Assistants/main.tsp +++ b/specification/ai/OpenAI.Assistants/main.tsp @@ -52,5 +52,8 @@ namespace Azure.AI.OpenAI.Assistants { @useDependency(Azure.Core.Versions.v1_0_Preview_2) @doc("The initial version of Azure OpenAI Assistants that corresponds to functionality in OpenAI's first beta release.") v2024_02_15_preview: "2024-02-15-preview", + + @doc("The May 2024 preview release for Azure OpenAI, including the first availability of assistants V2.") + v2024_05_01_preview: "2024-05-01-preview", } } diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json index baf14c039515..f9ebf70421c8 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-02-15-preview/assistants_generated.json @@ -1619,7 +1619,26 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/SubmitToolOutputsOptions" + "type": "object", + "properties": { + "tool_outputs": { + "type": "array", + "description": "A list of tools for which the outputs are being submitted.", + "items": { + "$ref": "#/definitions/ToolOutput" + }, + "x-ms-client-name": "toolOutputs", + "x-ms-identifiers": [] + }, + "stream": { + "type": "boolean", + "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.", + "x-nullable": true + } + }, + "required": [ + "tool_outputs" + ] } } ], @@ -3356,29 +3375,6 @@ "tool_calls" ] }, - "SubmitToolOutputsOptions": { - "type": "object", - "description": "Submit the results for the requested tool calls from the service.", - "properties": { - "tool_outputs": { - "type": "array", - "description": "A list of tools for which the outputs are being submitted.", - "items": { - "$ref": "#/definitions/ToolOutput" - }, - "x-ms-client-name": "toolOutputs", - "x-ms-identifiers": [] - }, - "stream": { - "type": "boolean", - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events, \nterminating when the Run enters a terminal state with a `data: [DONE]` message.", - "x-nullable": true - } - }, - "required": [ - "tool_outputs" - ] - }, "ThreadDeletionStatus": { "type": "object", "description": "The status of a thread deletion operation.", diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json new file mode 100644 index 000000000000..a045a4f72ac6 --- /dev/null +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json @@ -0,0 +1,3808 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure OpenAI", + "version": "2024-05-01-preview", + "description": "Azure OpenAI APIs for Assistants.", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "name": "endpoint", + "in": "path", + "description": "An OpenAI endpoint supporting assistants functionality.", + "required": true, + "type": "string" + } + ] + }, + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "security": [ + { + "ApiKeyAuth": [] + }, + { + "OAuth2Auth": [ + "https://cognitiveservices.azure.com/.default" + ] + } + ], + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "api-key", + "in": "header" + }, + "OAuth2Auth": { + "type": "oauth2", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + "scopes": { + "https://cognitiveservices.azure.com/.default": "" + } + } + }, + "tags": [], + "paths": { + "/assistants": { + "get": { + "operationId": "ListAssistants", + "description": "Gets a list of assistants that were previously created.", + "parameters": [ + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of assistants.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/Assistant" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + }, + "post": { + "operationId": "CreateAssistant", + "description": "Creates a new assistant.", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AssistantCreationOptions" + } + } + ], + "responses": { + "200": { + "description": "The new assistant instance.", + "schema": { + "$ref": "#/definitions/Assistant" + } + } + } + } + }, + "/assistants/{assistantId}": { + "get": { + "operationId": "GetAssistant", + "description": "Retrieves an existing assistant.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested assistant instance.", + "schema": { + "$ref": "#/definitions/Assistant" + } + } + } + }, + "post": { + "operationId": "UpdateAssistant", + "description": "Modifies an existing assistant.", + "parameters": [ + { + "$ref": "#/parameters/UpdateAssistantOptions.assistantId" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAssistantOptions" + } + } + ], + "responses": { + "200": { + "description": "The updated assistant instance.", + "schema": { + "$ref": "#/definitions/Assistant" + } + } + } + }, + "delete": { + "operationId": "DeleteAssistant", + "description": "Deletes an assistant.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to delete.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Status information about the requested deletion operation.", + "schema": { + "$ref": "#/definitions/AssistantDeletionStatus" + } + } + } + } + }, + "/assistants/{assistantId}/files": { + "get": { + "operationId": "ListAssistantFiles", + "description": "Gets a list of files attached to a specific assistant, as used by tools that can read files.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to retrieve the list of attached files for.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of files attached to the specified assistant.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/AssistantFile" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + }, + "post": { + "operationId": "CreateAssistantFile", + "description": "Attaches a previously uploaded file to an assistant for use by tools that can read files.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to attach the file to.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the previously uploaded file to attach.", + "x-ms-client-name": "fileId" + } + }, + "required": [ + "file_id" + ] + } + } + ], + "responses": { + "200": { + "description": "Information about the attached file.", + "schema": { + "$ref": "#/definitions/AssistantFile" + } + } + } + } + }, + "/assistants/{assistantId}/files/{fileId}": { + "get": { + "operationId": "GetAssistantFile", + "description": "Retrieves a file attached to an assistant.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant associated with the attached file.", + "required": true, + "type": "string" + }, + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "A representation of the attached file.", + "schema": { + "$ref": "#/definitions/AssistantFile" + } + } + } + }, + "delete": { + "operationId": "DeleteAssistantFile", + "description": "Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read\nfiles.", + "parameters": [ + { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant from which the specified file should be unlinked.", + "required": true, + "type": "string" + }, + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to unlink from the specified assistant.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Status information about the requested file association deletion.", + "schema": { + "$ref": "#/definitions/AssistantFileDeletionStatus" + } + } + } + } + }, + "/files": { + "get": { + "operationId": "ListFiles", + "description": "Gets a list of previously uploaded files.", + "parameters": [ + { + "name": "purpose", + "in": "query", + "description": "A value that, when provided, limits list results to files matching the corresponding purpose.", + "required": false, + "type": "string", + "enum": [ + "fine-tune", + "fine-tune-results", + "assistants", + "assistants_output" + ], + "x-ms-enum": { + "name": "FilePurpose", + "modelAsString": true, + "values": [ + { + "name": "fineTune", + "value": "fine-tune", + "description": "Indicates a file is used for fine tuning input." + }, + { + "name": "fineTuneResults", + "value": "fine-tune-results", + "description": "Indicates a file is used for fine tuning results." + }, + { + "name": "assistants", + "value": "assistants", + "description": "Indicates a file is used as input to assistants." + }, + { + "name": "assistantsOutput", + "value": "assistants_output", + "description": "Indicates a file is used as output by assistants." + } + ] + } + } + ], + "responses": { + "200": { + "description": "The requested list of files.", + "schema": { + "$ref": "#/definitions/FileListResponse" + } + } + } + }, + "post": { + "operationId": "UploadFile", + "description": "Uploads a file for use by other operations.", + "consumes": [ + "multipart/form-data" + ], + "parameters": [ + { + "name": "file", + "in": "formData", + "description": "The file data (not filename) to upload.", + "required": true, + "type": "file" + }, + { + "name": "purpose", + "in": "formData", + "description": "The intended purpose of the file.", + "required": true, + "type": "string", + "enum": [ + "fine-tune", + "fine-tune-results", + "assistants", + "assistants_output" + ], + "x-ms-enum": { + "name": "FilePurpose", + "modelAsString": true, + "values": [ + { + "name": "fineTune", + "value": "fine-tune", + "description": "Indicates a file is used for fine tuning input." + }, + { + "name": "fineTuneResults", + "value": "fine-tune-results", + "description": "Indicates a file is used for fine tuning results." + }, + { + "name": "assistants", + "value": "assistants", + "description": "Indicates a file is used as input to assistants." + }, + { + "name": "assistantsOutput", + "value": "assistants_output", + "description": "Indicates a file is used as output by assistants." + } + ] + } + }, + { + "name": "filename", + "in": "formData", + "description": "A filename to associate with the uploaded data.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "A representation of the uploaded file.", + "schema": { + "$ref": "#/definitions/OpenAIFile" + } + } + } + } + }, + "/files/{fileId}": { + "get": { + "operationId": "GetFile", + "description": "Returns information about a specific file. Does not retrieve file content.", + "parameters": [ + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/OpenAIFile" + } + } + } + }, + "delete": { + "operationId": "DeleteFile", + "description": "Delete a previously uploaded file.", + "parameters": [ + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to delete.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/FileDeletionStatus" + } + } + } + } + }, + "/files/{fileId}/content": { + "get": { + "operationId": "GetFileContent", + "description": "Returns information about a specific file. Does not retrieve file content.", + "parameters": [ + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "type": "string", + "format": "byte" + } + } + } + } + }, + "/threads": { + "post": { + "operationId": "CreateThread", + "description": "Creates a new thread. Threads contain messages and can be run by assistants.", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AssistantThreadCreationOptions" + } + } + ], + "responses": { + "200": { + "description": "Information about the newly created thread.", + "schema": { + "$ref": "#/definitions/AssistantThread" + } + } + } + } + }, + "/threads/{threadId}": { + "get": { + "operationId": "GetThread", + "description": "Gets information about an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to retrieve information about.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Information about the requested thread.", + "schema": { + "$ref": "#/definitions/AssistantThread" + } + } + } + }, + "post": { + "operationId": "UpdateThread", + "description": "Modifies an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to modify.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + } + } + ], + "responses": { + "200": { + "description": "Information about the modified thread.", + "schema": { + "$ref": "#/definitions/AssistantThread" + } + } + } + }, + "delete": { + "operationId": "DeleteThread", + "description": "Deletes an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to delete.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Status information about the requested thread deletion operation.", + "schema": { + "$ref": "#/definitions/ThreadDeletionStatus" + } + } + } + } + }, + "/threads/{threadId}/messages": { + "get": { + "operationId": "ListMessages", + "description": "Gets a list of messages that exist on a thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to list messages from.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of messages.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/ThreadMessage" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + }, + "post": { + "operationId": "CreateMessage", + "description": "Creates a new message on a specified thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to create the new message on.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "role": { + "$ref": "#/definitions/MessageRole", + "description": "The role to associate with the new message." + }, + "content": { + "type": "string", + "description": "The textual content for the new message." + }, + "file_ids": { + "type": "array", + "description": "A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files.", + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "role", + "content" + ] + } + } + ], + "responses": { + "200": { + "description": "A representation of the new message.", + "schema": { + "$ref": "#/definitions/ThreadMessage" + } + } + } + } + }, + "/threads/{threadId}/messages/{messageId}": { + "get": { + "operationId": "GetMessage", + "description": "Gets an existing message from an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to retrieve the specified message from.", + "required": true, + "type": "string" + }, + { + "name": "messageId", + "in": "path", + "description": "The ID of the message to retrieve from the specified thread.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "A representation of the requested message.", + "schema": { + "$ref": "#/definitions/ThreadMessage" + } + } + } + }, + "post": { + "operationId": "UpdateMessage", + "description": "Modifies an existing message on an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread containing the specified message to modify.", + "required": true, + "type": "string" + }, + { + "name": "messageId", + "in": "path", + "description": "The ID of the message to modify on the specified thread.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + } + } + ], + "responses": { + "200": { + "description": "A representation of the modified message.", + "schema": { + "$ref": "#/definitions/ThreadMessage" + } + } + } + } + }, + "/threads/{threadId}/messages/{messageId}/files": { + "get": { + "operationId": "ListMessageFiles", + "description": "Gets a list of previously uploaded files associated with a message from a thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread containing the message to list files from.", + "required": true, + "type": "string" + }, + { + "name": "messageId", + "in": "path", + "description": "The ID of the message to list files from.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of files associated with the specified message.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/MessageFile" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + } + }, + "/threads/{threadId}/messages/{messageId}/files/{fileId}": { + "get": { + "operationId": "GetMessageFile", + "description": "Gets information about a file attachment to a message within a thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread containing the message to get information from.", + "required": true, + "type": "string" + }, + { + "name": "messageId", + "in": "path", + "description": "The ID of the message to get information from.", + "required": true, + "type": "string" + }, + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to get information about.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested file information.", + "schema": { + "$ref": "#/definitions/MessageFile" + } + } + } + } + }, + "/threads/{threadId}/runs": { + "get": { + "operationId": "ListRuns", + "description": "Gets a list of runs for a specified thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to list runs from.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of thread runs.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/ThreadRun" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + }, + "post": { + "operationId": "CreateRun", + "description": "Creates a new run for an assistant thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to run.", + "required": true, + "type": "string" + }, + { + "name": "createRunOptions", + "in": "body", + "description": "The details for the run to create.", + "required": true, + "schema": { + "$ref": "#/definitions/CreateRunOptions" + } + } + ], + "responses": { + "200": { + "description": "Information about the new thread run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}": { + "get": { + "operationId": "GetRun", + "description": "Gets an existing run from an existing thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to retrieve run information from.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the thread to retrieve information about.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested information about the specified thread run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + }, + "post": { + "operationId": "UpdateRun", + "description": "Modifies an existing thread run.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread associated with the specified run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the run to modify.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + } + } + ], + "responses": { + "200": { + "description": "Information about the modified run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}/cancel": { + "post": { + "operationId": "CancelRun", + "description": "Cancels a run of an in progress thread.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread being run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the run to cancel.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Updated information about the cancelled run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}/steps": { + "get": { + "operationId": "ListRunSteps", + "description": "Gets a list of run steps from a thread run.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread that was run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the run to list steps from.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "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, + "type": "integer", + "format": "int32", + "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.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "asc", + "desc" + ], + "x-ms-enum": { + "name": "ListSortOrder", + "modelAsString": true, + "values": [ + { + "name": "ascending", + "value": "asc", + "description": "Specifies an ascending sort order." + }, + { + "name": "descending", + "value": "desc", + "description": "Specifies a descending sort 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.", + "required": false, + "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.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The requested list of run steps.", + "schema": { + "type": "object", + "description": "The response data for a requested list of items.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always list.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The requested list of items.", + "items": { + "$ref": "#/definitions/RunStep" + } + }, + "first_id": { + "type": "string", + "description": "The first ID represented in this list.", + "x-ms-client-name": "firstId" + }, + "last_id": { + "type": "string", + "description": "The last ID represented in this list.", + "x-ms-client-name": "lastId" + }, + "has_more": { + "type": "boolean", + "description": "A value indicating whether there are additional values available not captured in this list.", + "x-ms-client-name": "hasMore" + } + }, + "required": [ + "object", + "data", + "first_id", + "last_id", + "has_more" + ] + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}/steps/{stepId}": { + "get": { + "operationId": "GetRunStep", + "description": "Gets a single run step from a thread run.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread that was run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the specific run to retrieve the step from.", + "required": true, + "type": "string" + }, + { + "name": "stepId", + "in": "path", + "description": "The ID of the step to retrieve information about.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Information about the requested run step.", + "schema": { + "$ref": "#/definitions/RunStep" + } + } + } + } + }, + "/threads/{threadId}/runs/{runId}/submit_tool_outputs": { + "post": { + "operationId": "SubmitToolOutputsToRun", + "description": "Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.", + "parameters": [ + { + "name": "threadId", + "in": "path", + "description": "The ID of the thread that was run.", + "required": true, + "type": "string" + }, + { + "name": "runId", + "in": "path", + "description": "The ID of the run that requires tool outputs.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "tool_outputs": { + "type": "array", + "description": "A list of tools for which the outputs are being submitted.", + "items": { + "$ref": "#/definitions/ToolOutput" + }, + "x-ms-client-name": "toolOutputs", + "x-ms-identifiers": [] + }, + "stream": { + "type": "boolean", + "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.", + "x-nullable": true + } + }, + "required": [ + "tool_outputs" + ] + } + } + ], + "responses": { + "200": { + "description": "Updated information about the run.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + }, + "/threads/runs": { + "post": { + "operationId": "CreateThreadAndRun", + "description": "Creates a new assistant thread and immediately starts a run using that new thread.", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateAndRunThreadOptions" + } + } + ], + "responses": { + "200": { + "description": "Information about the newly created thread.", + "schema": { + "$ref": "#/definitions/ThreadRun" + } + } + } + } + } + }, + "definitions": { + "Assistant": { + "type": "object", + "description": "Represents an assistant that can call the model and use tools.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always assistant.", + "enum": [ + "assistant" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "name": { + "type": "string", + "description": "The name of the assistant.", + "x-nullable": true + }, + "description": { + "type": "string", + "description": "The description of the assistant.", + "x-nullable": true + }, + "model": { + "type": "string", + "description": "The ID of the model to use." + }, + "instructions": { + "type": "string", + "description": "The system instructions for the assistant to use.", + "x-nullable": true + }, + "tools": { + "type": "array", + "description": "The collection of tools enabled for the assistant.", + "default": [], + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "file_ids": { + "type": "array", + "description": "A list of attached file IDs, ordered by creation date in ascending order.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "created_at", + "name", + "description", + "model", + "instructions", + "tools", + "file_ids", + "metadata" + ] + }, + "AssistantCreationOptions": { + "type": "object", + "description": "The request details to use when creating a new assistant.", + "properties": { + "model": { + "type": "string", + "description": "The ID of the model to use." + }, + "name": { + "type": "string", + "description": "The name of the new assistant.", + "x-nullable": true + }, + "description": { + "type": "string", + "description": "The description of the new assistant.", + "x-nullable": true + }, + "instructions": { + "type": "string", + "description": "The system instructions for the new assistant to use.", + "x-nullable": true + }, + "tools": { + "type": "array", + "description": "The collection of tools to enable for the new assistant.", + "default": [], + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "file_ids": { + "type": "array", + "description": "A list of previously uploaded file IDs to attach to the assistant.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "model" + ] + }, + "AssistantDeletionStatus": { + "type": "object", + "description": "The status of an assistant deletion operation.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource specified for deletion." + }, + "deleted": { + "type": "boolean", + "description": "A value indicating whether deletion was successful." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'assistant.deleted'.", + "enum": [ + "assistant.deleted" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "AssistantFile": { + "type": "object", + "description": "Information about a file attached to an assistant, as used by tools that can read files.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'assistant.file'.", + "enum": [ + "assistant.file" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "assistant_id": { + "type": "string", + "description": "The assistant ID that the file is attached to.", + "x-ms-client-name": "assistantId" + } + }, + "required": [ + "id", + "object", + "created_at", + "assistant_id" + ] + }, + "AssistantFileDeletionStatus": { + "type": "object", + "description": "The status of an assistant file deletion operation.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource specified for deletion." + }, + "deleted": { + "type": "boolean", + "description": "A value indicating whether deletion was successful." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'assistant.file.deleted'.", + "enum": [ + "assistant.file.deleted" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "AssistantThread": { + "type": "object", + "description": "Information about a single thread associated with an assistant.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread'.", + "enum": [ + "thread" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "created_at", + "metadata" + ] + }, + "AssistantThreadCreationOptions": { + "type": "object", + "description": "The details used to create a new assistant thread.", + "properties": { + "messages": { + "type": "array", + "description": "The initial messages to associate with the new thread.", + "items": { + "$ref": "#/definitions/ThreadInitializationMessage" + }, + "x-ms-identifiers": [] + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + }, + "CodeInterpreterToolDefinition": { + "type": "object", + "description": "The input definition information for a code interpreter tool as used to configure an assistant.", + "allOf": [ + { + "$ref": "#/definitions/ToolDefinition" + } + ], + "x-ms-discriminator-value": "code_interpreter" + }, + "CreateAndRunThreadOptions": { + "type": "object", + "description": "The details used when creating and immediately running a new assistant thread.", + "properties": { + "assistant_id": { + "type": "string", + "description": "The ID of the assistant for which the thread should be created.", + "x-ms-client-name": "assistantId" + }, + "thread": { + "$ref": "#/definitions/AssistantThreadCreationOptions", + "description": "The details used to create the new thread. If no thread is provided, an empty one will be created." + }, + "model": { + "type": "string", + "description": "The overridden model that the assistant should use to run the thread.", + "x-nullable": true + }, + "instructions": { + "type": "string", + "description": "The overridden system instructions the assistant should use to run the thread.", + "x-nullable": true + }, + "tools": { + "type": "array", + "description": "The overridden list of enabled tools the assistant should use to run the thread.", + "x-nullable": true, + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "stream": { + "type": "boolean", + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "assistant_id" + ] + }, + "CreateRunOptions": { + "type": "object", + "description": "The details used when creating a new run of an assistant thread.", + "properties": { + "assistant_id": { + "type": "string", + "description": "The ID of the assistant that should run the thread.", + "x-ms-client-name": "assistantId" + }, + "model": { + "type": "string", + "description": "The overridden model name that the assistant should use to run the thread.", + "x-nullable": true + }, + "instructions": { + "type": "string", + "description": "The overridden system instructions that the assistant should use to run the thread.", + "x-nullable": true + }, + "additional_instructions": { + "type": "string", + "description": "Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior\non a per-run basis without overriding other instructions.", + "x-nullable": true, + "x-ms-client-name": "additionalInstructions" + }, + "tools": { + "type": "array", + "description": "The overridden list of enabled tools that the assistant should use to run the thread.", + "x-nullable": true, + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "stream": { + "type": "boolean", + "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "assistant_id" + ] + }, + "FileDeletionStatus": { + "type": "object", + "description": "A status response from a file deletion operation.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource specified for deletion." + }, + "deleted": { + "type": "boolean", + "description": "A value indicating whether deletion was successful." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'file'.", + "enum": [ + "file" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "FileListResponse": { + "type": "object", + "description": "The response data from a file list operation.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always 'list'.", + "enum": [ + "list" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "data": { + "type": "array", + "description": "The files returned for the request.", + "items": { + "$ref": "#/definitions/OpenAIFile" + } + } + }, + "required": [ + "object", + "data" + ] + }, + "FilePurpose": { + "type": "string", + "description": "The possible values denoting the intended usage of a file.", + "enum": [ + "fine-tune", + "fine-tune-results", + "assistants", + "assistants_output" + ], + "x-ms-enum": { + "name": "FilePurpose", + "modelAsString": true, + "values": [ + { + "name": "fineTune", + "value": "fine-tune", + "description": "Indicates a file is used for fine tuning input." + }, + { + "name": "fineTuneResults", + "value": "fine-tune-results", + "description": "Indicates a file is used for fine tuning results." + }, + { + "name": "assistants", + "value": "assistants", + "description": "Indicates a file is used as input to assistants." + }, + { + "name": "assistantsOutput", + "value": "assistants_output", + "description": "Indicates a file is used as output by assistants." + } + ] + } + }, + "FunctionDefinition": { + "type": "object", + "description": "The input definition information for a function.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to be called." + }, + "description": { + "type": "string", + "description": "A description of what the function does, used by the model to choose when and how to call the function." + }, + "parameters": { + "description": "The parameters the functions accepts, described as a JSON Schema object." + } + }, + "required": [ + "name", + "parameters" + ] + }, + "FunctionToolDefinition": { + "type": "object", + "description": "The input definition information for a function tool as used to configure an assistant.", + "properties": { + "function": { + "$ref": "#/definitions/FunctionDefinition", + "description": "The definition of the concrete function that the function tool should call." + } + }, + "required": [ + "function" + ], + "allOf": [ + { + "$ref": "#/definitions/ToolDefinition" + } + ], + "x-ms-discriminator-value": "function" + }, + "IncompleteRunDetails": { + "type": "string", + "description": "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.", + "enum": [ + "max_completion_tokens", + "max_prompt_tokens" + ], + "x-ms-enum": { + "name": "IncompleteRunDetails", + "modelAsString": true, + "values": [ + { + "name": "maxCompletionTokens", + "value": "max_completion_tokens", + "description": "Maximum completion tokens exceeded" + }, + { + "name": "maxPromptTokens", + "value": "max_prompt_tokens", + "description": "Maximum prompt tokens exceeded" + } + ] + } + }, + "MessageContent": { + "type": "object", + "description": "An abstract representation of a single item of thread message content.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "MessageFile": { + "type": "object", + "description": "Information about a file attached to an assistant thread message.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.message.file'.", + "enum": [ + "thread.message.file" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "message_id": { + "type": "string", + "description": "The ID of the message that this file is attached to.", + "x-ms-client-name": "messageId" + } + }, + "required": [ + "id", + "object", + "created_at", + "message_id" + ] + }, + "MessageImageFileContent": { + "type": "object", + "description": "A representation of image file content in a thread message.", + "properties": { + "image_file": { + "$ref": "#/definitions/MessageImageFileDetails", + "description": "The image file for this thread message content item.", + "x-ms-client-name": "imageFile" + } + }, + "required": [ + "image_file" + ], + "allOf": [ + { + "$ref": "#/definitions/MessageContent" + } + ], + "x-ms-discriminator-value": "image_file" + }, + "MessageImageFileDetails": { + "type": "object", + "description": "An image reference, as represented in thread message content.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID for the file associated with this image.", + "x-ms-client-name": "fileId" + } + }, + "required": [ + "file_id" + ] + }, + "MessageIncompleteDetailsReason": { + "type": "string", + "description": "A set of reasons describing why a message is marked as incomplete.", + "enum": [ + "content_filter", + "max_tokens", + "run_cancelled", + "run_failed", + "run_expired" + ], + "x-ms-enum": { + "name": "MessageIncompleteDetailsReason", + "modelAsString": true, + "values": [ + { + "name": "contentFilter", + "value": "content_filter", + "description": "The run generating the message was terminated due to content filter flagging." + }, + { + "name": "maxTokens", + "value": "max_tokens", + "description": "The run generating the message exhausted available tokens before completion." + }, + { + "name": "runCancelled", + "value": "run_cancelled", + "description": "The run generating the message was cancelled before completion." + }, + { + "name": "runFailed", + "value": "run_failed", + "description": "The run generating the message failed." + }, + { + "name": "runExpired", + "value": "run_expired", + "description": "The run generating the message expired." + } + ] + } + }, + "MessageRole": { + "type": "string", + "description": "The possible values for roles attributed to messages in a thread.", + "enum": [ + "user", + "assistant" + ], + "x-ms-enum": { + "name": "MessageRole", + "modelAsString": true, + "values": [ + { + "name": "user", + "value": "user", + "description": "The role representing the end-user." + }, + { + "name": "assistant", + "value": "assistant", + "description": "The role representing the assistant." + } + ] + } + }, + "MessageStatus": { + "type": "string", + "description": "The possible execution status values for a thread message.", + "enum": [ + "in_progress", + "incomplete", + "completed" + ], + "x-ms-enum": { + "name": "MessageStatus", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "A run is currently creating this message." + }, + { + "name": "incomplete", + "value": "incomplete", + "description": "This message is incomplete. See incomplete_details for more information." + }, + { + "name": "completed", + "value": "completed", + "description": "This message was successfully completed by a run." + } + ] + } + }, + "MessageTextAnnotation": { + "type": "object", + "description": "An abstract representation of an annotation to text thread message content.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + }, + "text": { + "type": "string", + "description": "The textual content associated with this text annotation item." + } + }, + "discriminator": "type", + "required": [ + "type", + "text" + ] + }, + "MessageTextContent": { + "type": "object", + "description": "A representation of a textual item of thread message content.", + "properties": { + "text": { + "$ref": "#/definitions/MessageTextDetails", + "description": "The text and associated annotations for this thread message content item." + } + }, + "required": [ + "text" + ], + "allOf": [ + { + "$ref": "#/definitions/MessageContent" + } + ], + "x-ms-discriminator-value": "text" + }, + "MessageTextDetails": { + "type": "object", + "description": "The text and associated annotations for a single item of assistant thread message content.", + "properties": { + "value": { + "type": "string", + "description": "The text data." + }, + "annotations": { + "type": "array", + "description": "A list of annotations associated with this text.", + "items": { + "$ref": "#/definitions/MessageTextAnnotation" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "value", + "annotations" + ] + }, + "MessageTextFileCitationAnnotation": { + "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": { + "file_citation": { + "$ref": "#/definitions/MessageTextFileCitationDetails", + "description": "A citation within the message that points to a specific quote from a specific file.\nGenerated when the assistant uses the \"retrieval\" tool to search files.", + "x-ms-client-name": "fileCitation" + }, + "start_index": { + "type": "integer", + "format": "int32", + "description": "The first text index associated with this text annotation.", + "x-ms-client-name": "startIndex" + }, + "end_index": { + "type": "integer", + "format": "int32", + "description": "The last text index associated with this text annotation.", + "x-ms-client-name": "endIndex" + } + }, + "required": [ + "file_citation" + ], + "allOf": [ + { + "$ref": "#/definitions/MessageTextAnnotation" + } + ], + "x-ms-discriminator-value": "file_citation" + }, + "MessageTextFileCitationDetails": { + "type": "object", + "description": "A representation of a file-based text citation, as used in a file-based annotation of text thread message content.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file associated with this citation.", + "x-ms-client-name": "fileId" + }, + "quote": { + "type": "string", + "description": "The specific quote cited in the associated file." + } + }, + "required": [ + "file_id", + "quote" + ] + }, + "MessageTextFilePathAnnotation": { + "type": "object", + "description": "A citation within the message that points to a file located at a specific path.", + "properties": { + "file_path": { + "$ref": "#/definitions/MessageTextFilePathDetails", + "description": "A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.", + "x-ms-client-name": "filePath" + }, + "start_index": { + "type": "integer", + "format": "int32", + "description": "The first text index associated with this text annotation.", + "x-ms-client-name": "startIndex" + }, + "end_index": { + "type": "integer", + "format": "int32", + "description": "The last text index associated with this text annotation.", + "x-ms-client-name": "endIndex" + } + }, + "required": [ + "file_path" + ], + "allOf": [ + { + "$ref": "#/definitions/MessageTextAnnotation" + } + ], + "x-ms-discriminator-value": "file_path" + }, + "MessageTextFilePathDetails": { + "type": "object", + "description": "An encapsulation of an image file ID, as used by message image content.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the specific file that the citation is from.", + "x-ms-client-name": "fileId" + } + }, + "required": [ + "file_id" + ] + }, + "OpenAIFile": { + "type": "object", + "description": "Represents an assistant that can call the model and use tools.", + "properties": { + "object": { + "type": "string", + "description": "The object type, which is always 'file'.", + "enum": [ + "file" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "bytes": { + "type": "integer", + "format": "int32", + "description": "The size of the file, in bytes." + }, + "filename": { + "type": "string", + "description": "The name of the file." + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "purpose": { + "$ref": "#/definitions/FilePurpose", + "description": "The intended purpose of a file." + } + }, + "required": [ + "object", + "id", + "bytes", + "filename", + "created_at", + "purpose" + ] + }, + "RequiredAction": { + "type": "object", + "description": "An abstract representation of a required action for an assistant thread run to continue.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "RequiredFunctionToolCall": { + "type": "object", + "description": "A representation of a requested call to a function tool, needed by the model to continue evaluation of a run.", + "properties": { + "function": { + "$ref": "#/definitions/RequiredFunctionToolCallDetails", + "description": "Detailed information about the function to be executed by the tool that includes name and arguments." + } + }, + "required": [ + "function" + ], + "allOf": [ + { + "$ref": "#/definitions/RequiredToolCall" + } + ], + "x-ms-discriminator-value": "function" + }, + "RequiredFunctionToolCallDetails": { + "type": "object", + "description": "The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation." + } + }, + "required": [ + "name", + "arguments" + ] + }, + "RequiredToolCall": { + "type": "object", + "description": "An abstract representation a a tool invocation needed by the model to continue a run.", + "properties": { + "type": { + "type": "string", + "description": "The object type for the required tool call." + }, + "id": { + "type": "string", + "description": "The ID of the tool call. This ID must be referenced when submitting tool outputs." + } + }, + "discriminator": "type", + "required": [ + "type", + "id" + ] + }, + "RetrievalToolDefinition": { + "type": "object", + "description": "The input definition information for a retrieval tool as used to configure an assistant.", + "allOf": [ + { + "$ref": "#/definitions/ToolDefinition" + } + ], + "x-ms-discriminator-value": "retrieval" + }, + "RunCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run.", + "properties": { + "completion_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of completion tokens used over the course of the run.", + "x-ms-client-name": "completionTokens" + }, + "prompt_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of prompt tokens used over the course of the run.", + "x-ms-client-name": "promptTokens" + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "description": "Total number of tokens used (prompt + completion).", + "x-ms-client-name": "totalTokens" + } + }, + "required": [ + "completion_tokens", + "prompt_tokens", + "total_tokens" + ] + }, + "RunError": { + "type": "object", + "description": "The details of an error as encountered by an assistant thread run.", + "properties": { + "code": { + "type": "string", + "description": "The status for the error." + }, + "message": { + "type": "string", + "description": "The human-readable text associated with the error." + } + }, + "required": [ + "code", + "message" + ] + }, + "RunStatus": { + "type": "string", + "description": "Possible values for the status of an assistant thread run.", + "enum": [ + "queued", + "in_progress", + "requires_action", + "cancelling", + "cancelled", + "failed", + "completed", + "expired" + ], + "x-ms-enum": { + "name": "RunStatus", + "modelAsString": true, + "values": [ + { + "name": "queued", + "value": "queued", + "description": "Represents a run that is queued to start." + }, + { + "name": "inProgress", + "value": "in_progress", + "description": "Represents a run that is in progress." + }, + { + "name": "requiresAction", + "value": "requires_action", + "description": "Represents a run that needs another operation, such as tool output submission, to continue." + }, + { + "name": "cancelling", + "value": "cancelling", + "description": "Represents a run that is in the process of cancellation." + }, + { + "name": "cancelled", + "value": "cancelled", + "description": "Represents a run that has been cancelled." + }, + { + "name": "failed", + "value": "failed", + "description": "Represents a run that failed." + }, + { + "name": "completed", + "value": "completed", + "description": "Represents a run that successfully completed." + }, + { + "name": "expired", + "value": "expired", + "description": "Represents a run that expired before it could otherwise finish." + } + ] + } + }, + "RunStep": { + "type": "object", + "description": "Detailed information about a single step of an assistant thread run.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.run.step'.", + "enum": [ + "thread.run.step" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "type": { + "$ref": "#/definitions/RunStepType", + "description": "The type of run step, which can be either message_creation or tool_calls." + }, + "assistant_id": { + "type": "string", + "description": "The ID of the assistant associated with the run step.", + "x-ms-client-name": "assistantId" + }, + "thread_id": { + "type": "string", + "description": "The ID of the thread that was run.", + "x-ms-client-name": "threadId" + }, + "run_id": { + "type": "string", + "description": "The ID of the run that this run step is a part of.", + "x-ms-client-name": "runId" + }, + "status": { + "$ref": "#/definitions/RunStepStatus", + "description": "The status of this run step." + }, + "step_details": { + "$ref": "#/definitions/RunStepDetails", + "description": "The details for this run step.", + "x-ms-client-name": "stepDetails" + }, + "last_error": { + "type": "object", + "description": "If applicable, information about the last error encountered by this run step.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunStepError" + } + ], + "x-ms-client-name": "lastError" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "expired_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this item expired.", + "x-nullable": true, + "x-ms-client-name": "expiredAt" + }, + "completed_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this completed.", + "x-nullable": true, + "x-ms-client-name": "completedAt" + }, + "cancelled_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this was cancelled.", + "x-nullable": true, + "x-ms-client-name": "cancelledAt" + }, + "failed_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this failed.", + "x-nullable": true, + "x-ms-client-name": "failedAt" + }, + "usage": { + "type": "object", + "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunStepCompletionUsage" + } + ] + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "type", + "assistant_id", + "thread_id", + "run_id", + "status", + "step_details", + "last_error", + "created_at", + "expired_at", + "completed_at", + "cancelled_at", + "failed_at", + "metadata" + ] + }, + "RunStepCodeInterpreterImageOutput": { + "type": "object", + "description": "A representation of an image output emitted by a code interpreter tool in response to a tool call by the model.", + "properties": { + "image": { + "$ref": "#/definitions/RunStepCodeInterpreterImageReference", + "description": "Referential information for the image associated with this output." + } + }, + "required": [ + "image" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" + } + ], + "x-ms-discriminator-value": "image" + }, + "RunStepCodeInterpreterImageReference": { + "type": "object", + "description": "An image reference emitted by a code interpreter tool in response to a tool call by the model.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file associated with this image.", + "x-ms-client-name": "fileId" + } + }, + "required": [ + "file_id" + ] + }, + "RunStepCodeInterpreterLogOutput": { + "type": "object", + "description": "A representation of a log output emitted by a code interpreter tool in response to a tool call by the model.", + "properties": { + "logs": { + "type": "string", + "description": "The serialized log output emitted by the code interpreter." + } + }, + "required": [ + "logs" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" + } + ], + "x-ms-discriminator-value": "logs" + }, + "RunStepCodeInterpreterToolCall": { + "type": "object", + "description": "A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that\nrepresents inputs and outputs consumed and emitted by the code interpreter.", + "properties": { + "code_interpreter": { + "$ref": "#/definitions/RunStepCodeInterpreterToolCallDetails", + "description": "The details of the tool call to the code interpreter tool.", + "x-ms-client-name": "codeInterpreter" + } + }, + "required": [ + "code_interpreter" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepToolCall" + } + ], + "x-ms-discriminator-value": "code_interpreter" + }, + "RunStepCodeInterpreterToolCallDetails": { + "type": "object", + "description": "The detailed information about a code interpreter invocation by the model.", + "properties": { + "input": { + "type": "string", + "description": "The input provided by the model to the code interpreter tool." + }, + "outputs": { + "type": "array", + "description": "The outputs produced by the code interpreter tool back to the model in response to the tool call.", + "items": { + "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" + }, + "x-ms-identifiers": [] + } + }, + "required": [ + "input", + "outputs" + ] + }, + "RunStepCodeInterpreterToolCallOutput": { + "type": "object", + "description": "An abstract representation of an emitted output from a code interpreter tool.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "RunStepCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run step.", + "properties": { + "completion_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of completion tokens used over the course of the run step.", + "x-ms-client-name": "completionTokens" + }, + "prompt_tokens": { + "type": "integer", + "format": "int64", + "description": "Number of prompt tokens used over the course of the run step.", + "x-ms-client-name": "promptTokens" + }, + "total_tokens": { + "type": "integer", + "format": "int64", + "description": "Total number of tokens used (prompt + completion).", + "x-ms-client-name": "totalTokens" + } + }, + "required": [ + "completion_tokens", + "prompt_tokens", + "total_tokens" + ] + }, + "RunStepDetails": { + "type": "object", + "description": "An abstract representation of the details for a run step.", + "properties": { + "type": { + "$ref": "#/definitions/RunStepType", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "RunStepError": { + "type": "object", + "description": "The error information associated with a failed run step.", + "properties": { + "code": { + "$ref": "#/definitions/RunStepErrorCode", + "description": "The error code for this error." + }, + "message": { + "type": "string", + "description": "The human-readable text associated with this error." + } + }, + "required": [ + "code", + "message" + ] + }, + "RunStepErrorCode": { + "type": "string", + "description": "Possible error code values attributable to a failed run step.", + "enum": [ + "server_error", + "rate_limit_exceeded" + ], + "x-ms-enum": { + "name": "RunStepErrorCode", + "modelAsString": true, + "values": [ + { + "name": "serverError", + "value": "server_error", + "description": "Represents a server error." + }, + { + "name": "rateLimitExceeded", + "value": "rate_limit_exceeded", + "description": "Represents an error indicating configured rate limits were exceeded." + } + ] + } + }, + "RunStepFunctionToolCall": { + "type": "object", + "description": "A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs\nand output consumed and emitted by the specified function.", + "properties": { + "function": { + "$ref": "#/definitions/RunStepFunctionToolCallDetails", + "description": "The detailed information about the function called by the model." + } + }, + "required": [ + "function" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepToolCall" + } + ], + "x-ms-discriminator-value": "function" + }, + "RunStepFunctionToolCallDetails": { + "type": "object", + "description": "The detailed information about the function called by the model.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function." + }, + "arguments": { + "type": "string", + "description": "The arguments that the model requires are provided to the named function." + }, + "output": { + "type": "string", + "description": "The output of the function, only populated for function calls that have already have had their outputs submitted.", + "x-nullable": true + } + }, + "required": [ + "name", + "arguments", + "output" + ] + }, + "RunStepMessageCreationDetails": { + "type": "object", + "description": "The detailed information associated with a message creation run step.", + "properties": { + "message_creation": { + "$ref": "#/definitions/RunStepMessageCreationReference", + "description": "Information about the message creation associated with this run step.", + "x-ms-client-name": "messageCreation" + } + }, + "required": [ + "message_creation" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepDetails" + } + ], + "x-ms-discriminator-value": "message_creation" + }, + "RunStepMessageCreationReference": { + "type": "object", + "description": "The details of a message created as a part of a run step.", + "properties": { + "message_id": { + "type": "string", + "description": "The ID of the message created by this run step.", + "x-ms-client-name": "messageId" + } + }, + "required": [ + "message_id" + ] + }, + "RunStepRetrievalToolCall": { + "type": "object", + "description": "A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents\nexecuted retrieval actions.", + "properties": { + "retrieval": { + "type": "object", + "description": "The key/value pairs produced by the retrieval tool.", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "retrieval" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepToolCall" + } + ], + "x-ms-discriminator-value": "retrieval" + }, + "RunStepStatus": { + "type": "string", + "description": "Possible values for the status of a run step.", + "enum": [ + "in_progress", + "cancelled", + "failed", + "completed", + "expired" + ], + "x-ms-enum": { + "name": "RunStepStatus", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "Represents a run step still in progress." + }, + { + "name": "cancelled", + "value": "cancelled", + "description": "Represents a run step that was cancelled." + }, + { + "name": "failed", + "value": "failed", + "description": "Represents a run step that failed." + }, + { + "name": "completed", + "value": "completed", + "description": "Represents a run step that successfully completed." + }, + { + "name": "expired", + "value": "expired", + "description": "Represents a run step that expired before otherwise finishing." + } + ] + } + }, + "RunStepToolCall": { + "type": "object", + "description": "An abstract representation of a detailed tool call as recorded within a run step for an existing run.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + }, + "id": { + "type": "string", + "description": "The ID of the tool call. This ID must be referenced when you submit tool outputs." + } + }, + "discriminator": "type", + "required": [ + "type", + "id" + ] + }, + "RunStepToolCallDetails": { + "type": "object", + "description": "The detailed information associated with a run step calling tools.", + "properties": { + "tool_calls": { + "type": "array", + "description": "A list of tool call details for this run step.", + "items": { + "$ref": "#/definitions/RunStepToolCall" + }, + "x-ms-client-name": "toolCalls" + } + }, + "required": [ + "tool_calls" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepDetails" + } + ], + "x-ms-discriminator-value": "tool_calls" + }, + "RunStepType": { + "type": "string", + "description": "The possible types of run steps.", + "enum": [ + "message_creation", + "tool_calls" + ], + "x-ms-enum": { + "name": "RunStepType", + "modelAsString": true, + "values": [ + { + "name": "messageCreation", + "value": "message_creation", + "description": "Represents a run step to create a message." + }, + { + "name": "toolCalls", + "value": "tool_calls", + "description": "Represents a run step that calls tools." + } + ] + } + }, + "SubmitToolOutputsAction": { + "type": "object", + "description": "The details for required tool calls that must be submitted for an assistant thread run to continue.", + "properties": { + "submit_tool_outputs": { + "$ref": "#/definitions/SubmitToolOutputsDetails", + "description": "The details describing tools that should be called to submit tool outputs.", + "x-ms-client-name": "submitToolOutputs" + } + }, + "required": [ + "submit_tool_outputs" + ], + "allOf": [ + { + "$ref": "#/definitions/RequiredAction" + } + ], + "x-ms-discriminator-value": "submit_tool_outputs" + }, + "SubmitToolOutputsDetails": { + "type": "object", + "description": "The details describing tools that should be called to submit tool outputs.", + "properties": { + "tool_calls": { + "type": "array", + "description": "The list of tool calls that must be resolved for the assistant thread run to continue.", + "items": { + "$ref": "#/definitions/RequiredToolCall" + }, + "x-ms-client-name": "toolCalls" + } + }, + "required": [ + "tool_calls" + ] + }, + "ThreadDeletionStatus": { + "type": "object", + "description": "The status of a thread deletion operation.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource specified for deletion." + }, + "deleted": { + "type": "boolean", + "description": "A value indicating whether deletion was successful." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.deleted'.", + "enum": [ + "thread.deleted" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "ThreadInitializationMessage": { + "type": "object", + "description": "A single message within an assistant thread, as provided during that thread's creation for its initial state.", + "properties": { + "role": { + "$ref": "#/definitions/MessageRole", + "description": "The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread." + }, + "content": { + "type": "string", + "description": "The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API." + }, + "file_ids": { + "type": "array", + "description": "A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can\naccess files.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "role", + "content" + ] + }, + "ThreadMessage": { + "type": "object", + "description": "A single, existing message within an assistant thread.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.message'.", + "enum": [ + "thread.message" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "thread_id": { + "type": "string", + "description": "The ID of the thread that this message belongs to.", + "x-ms-client-name": "threadId" + }, + "status": { + "$ref": "#/definitions/MessageStatus", + "description": "The status of the message." + }, + "incomplete_details": { + "$ref": "#/definitions/MessageIncompleteDetailsReason", + "description": "On an incomplete message, details about why the message is incomplete.", + "x-nullable": true, + "x-ms-client-name": "incompleteDetails" + }, + "completed_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the message was completed.", + "x-nullable": true, + "x-ms-client-name": "completedAt" + }, + "incomplete_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", + "x-nullable": true, + "x-ms-client-name": "incompleteAt" + }, + "role": { + "$ref": "#/definitions/MessageRole", + "description": "The role associated with the assistant thread message." + }, + "content": { + "type": "array", + "description": "The list of content items associated with the assistant thread message.", + "items": { + "$ref": "#/definitions/MessageContent" + }, + "x-ms-identifiers": [] + }, + "assistant_id": { + "type": "string", + "description": "If applicable, the ID of the assistant that authored this message.", + "x-ms-client-name": "assistantId" + }, + "run_id": { + "type": "string", + "description": "If applicable, the ID of the run associated with the authoring of this message.", + "x-ms-client-name": "runId" + }, + "file_ids": { + "type": "array", + "description": "A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can\naccess files.", + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "created_at", + "thread_id", + "status", + "incomplete_details", + "completed_at", + "incomplete_at", + "role", + "content", + "file_ids", + "metadata" + ] + }, + "ThreadRun": { + "type": "object", + "description": "Data representing a single evaluation run of an assistant thread.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always 'thread.run'.", + "enum": [ + "thread.run" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "thread_id": { + "type": "string", + "description": "The ID of the thread associated with this run.", + "x-ms-client-name": "threadId" + }, + "assistant_id": { + "type": "string", + "description": "The ID of the assistant associated with the thread this run was performed against.", + "x-ms-client-name": "assistantId" + }, + "status": { + "$ref": "#/definitions/RunStatus", + "description": "The status of the assistant thread run." + }, + "required_action": { + "type": "object", + "description": "The details of the action required for the assistant thread run to continue.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RequiredAction" + } + ], + "x-ms-client-name": "requiredAction" + }, + "last_error": { + "type": "object", + "description": "The last error, if any, encountered by this assistant thread run.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunError" + } + ], + "x-ms-client-name": "lastError" + }, + "model": { + "type": "string", + "description": "The ID of the model to use." + }, + "instructions": { + "type": "string", + "description": "The overridden system instructions used for this assistant thread run." + }, + "tools": { + "type": "array", + "description": "The overridden enabled tools used for this assistant thread run.", + "default": [], + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "file_ids": { + "type": "array", + "description": "A list of attached file IDs, ordered by creation date in ascending order.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this object was created.", + "x-ms-client-name": "createdAt" + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this item expires.", + "x-nullable": true, + "x-ms-client-name": "expiresAt" + }, + "started_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this item was started.", + "x-nullable": true, + "x-ms-client-name": "startedAt" + }, + "completed_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this completed.", + "x-nullable": true, + "x-ms-client-name": "completedAt" + }, + "cancelled_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this was cancelled.", + "x-nullable": true, + "x-ms-client-name": "cancelledAt" + }, + "failed_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp, in seconds, representing when this failed.", + "x-nullable": true, + "x-ms-client-name": "failedAt" + }, + "incomplete_details": { + "$ref": "#/definitions/IncompleteRunDetails", + "description": "Details on why the run is incomplete. Will be `null` if the run is not incomplete.", + "x-nullable": true, + "x-ms-client-name": "incompleteDetails" + }, + "usage": { + "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.).", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/RunCompletionUsage" + } + ] + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "id", + "object", + "thread_id", + "assistant_id", + "status", + "last_error", + "model", + "instructions", + "tools", + "file_ids", + "created_at", + "expires_at", + "started_at", + "completed_at", + "cancelled_at", + "failed_at", + "incomplete_details", + "usage", + "metadata" + ] + }, + "ToolDefinition": { + "type": "object", + "description": "An abstract representation of an input tool definition that an assistant can use.", + "properties": { + "type": { + "type": "string", + "description": "The object type." + } + }, + "discriminator": "type", + "required": [ + "type" + ] + }, + "ToolOutput": { + "type": "object", + "description": "The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue.", + "properties": { + "tool_call_id": { + "type": "string", + "description": "The ID of the tool call being resolved, as provided in the tool calls of a required action from a run.", + "x-ms-client-name": "toolCallId" + }, + "output": { + "type": "string", + "description": "The output from the tool to be submitted." + } + } + }, + "UpdateAssistantOptions": { + "type": "object", + "description": "The request details to use when modifying an existing assistant.", + "properties": { + "model": { + "type": "string", + "description": "The ID of the model to use." + }, + "name": { + "type": "string", + "description": "The modified name for the assistant to use.", + "x-nullable": true + }, + "description": { + "type": "string", + "description": "The modified description for the assistant to use.", + "x-nullable": true + }, + "instructions": { + "type": "string", + "description": "The modified system instructions for the new assistant to use.", + "x-nullable": true + }, + "tools": { + "type": "array", + "description": "The modified collection of tools to enable for the assistant.", + "default": [], + "items": { + "$ref": "#/definitions/ToolDefinition" + }, + "x-ms-identifiers": [] + }, + "file_ids": { + "type": "array", + "description": "The modified list of previously uploaded fileIDs to attach to the assistant.", + "default": [], + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "metadata": { + "type": "object", + "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "parameters": { + "UpdateAssistantOptions.assistantId": { + "name": "assistantId", + "in": "path", + "description": "The ID of the assistant to modify.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + } + } +} diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 440f0c7f6f27..8e4dbdc9e433 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -1097,7 +1097,19 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SubmitToolOutputsOptions' + type: object + properties: + tool_outputs: + type: array + items: + $ref: '#/components/schemas/ToolOutput' + description: A list of tools for which the outputs are being submitted. + 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 security: - ApiKeyAuth: [] - OAuth2Auth: @@ -2800,6 +2812,7 @@ components: type: string enum: - 2024-02-15-preview + - 2024-05-01-preview description: The known set of supported API versions. SubmitToolOutputsAction: type: object @@ -2830,23 +2843,6 @@ components: $ref: '#/components/schemas/RequiredToolCall' description: The list of tool calls that must be resolved for the assistant thread run to continue. description: The details describing tools that should be called to submit tool outputs. - SubmitToolOutputsOptions: - type: object - required: - - tool_outputs - properties: - tool_outputs: - type: array - items: - $ref: '#/components/schemas/ToolOutput' - description: A list of tools for which the outputs are being submitted. - 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. - description: Submit the results for the requested tool calls from the service. ThreadDeletionStatus: type: object required: diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml new file mode 100644 index 000000000000..66b1d565320d --- /dev/null +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml @@ -0,0 +1,3177 @@ +openapi: 3.0.0 +info: + title: Azure OpenAI + description: Azure OpenAI APIs for Assistants. + version: 2024-05-01-preview +tags: [] +paths: + /assistants: + post: + operationId: createAssistant + description: Creates a new assistant. + parameters: [] + responses: + '200': + description: The new assistant instance. + content: + application/json: + schema: + $ref: '#/components/schemas/Assistant' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantCreationOptions' + get: + operationId: listAssistants + description: Gets a list of assistants that were previously created. + parameters: + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of assistants. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/Assistant' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /assistants/{assistantId}: + get: + operationId: getAssistant + description: Retrieves an existing assistant. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant to retrieve. + schema: + type: string + responses: + '200': + description: The requested assistant instance. + content: + application/json: + schema: + $ref: '#/components/schemas/Assistant' + post: + operationId: updateAssistant + description: Modifies an existing assistant. + parameters: + - $ref: '#/components/parameters/UpdateAssistantOptions.assistantId' + responses: + '200': + description: The updated assistant instance. + content: + application/json: + schema: + $ref: '#/components/schemas/Assistant' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAssistantOptions' + delete: + operationId: deleteAssistant + description: Deletes an assistant. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant to delete. + schema: + type: string + responses: + '200': + description: Status information about the requested deletion operation. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantDeletionStatus' + /assistants/{assistantId}/files: + post: + operationId: createAssistantFile + description: Attaches a previously uploaded file to an assistant for use by tools that can read files. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant to attach the file to. + schema: + type: string + responses: + '200': + description: Information about the attached file. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantFile' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + file_id: + type: string + description: The ID of the previously uploaded file to attach. + required: + - file_id + get: + operationId: listAssistantFiles + description: Gets a list of files attached to a specific assistant, as used by tools that can read files. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant to retrieve the list of attached files for. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of files attached to the specified assistant. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/AssistantFile' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /assistants/{assistantId}/files/{fileId}: + get: + operationId: getAssistantFile + description: Retrieves a file attached to an assistant. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant associated with the attached file. + schema: + type: string + - name: fileId + in: path + required: true + description: The ID of the file to retrieve. + schema: + type: string + responses: + '200': + description: A representation of the attached file. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantFile' + delete: + operationId: deleteAssistantFile + description: |- + Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read + files. + parameters: + - name: assistantId + in: path + required: true + description: The ID of the assistant from which the specified file should be unlinked. + schema: + type: string + - name: fileId + in: path + required: true + description: The ID of the file to unlink from the specified assistant. + schema: + type: string + responses: + '200': + description: Status information about the requested file association deletion. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantFileDeletionStatus' + /files: + get: + operationId: listFiles + description: Gets a list of previously uploaded files. + parameters: + - name: purpose + in: query + required: false + description: A value that, when provided, limits list results to files matching the corresponding purpose. + schema: + $ref: '#/components/schemas/FilePurpose' + responses: + '200': + description: The requested list of files. + content: + application/json: + schema: + $ref: '#/components/schemas/FileListResponse' + post: + operationId: uploadFile + description: Uploads a file for use by other operations. + parameters: [] + responses: + '200': + description: A representation of the uploaded file. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + purpose: + allOf: + - $ref: '#/components/schemas/FilePurpose' + description: The intended purpose of the file. + filename: + type: string + description: A filename to associate with the uploaded data. + required: + - file + - purpose + /files/{fileId}: + delete: + operationId: deleteFile + description: Delete a previously uploaded file. + parameters: + - name: fileId + in: path + required: true + description: The ID of the file to delete. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/FileDeletionStatus' + get: + operationId: getFile + description: Returns information about a specific file. Does not retrieve file content. + parameters: + - name: fileId + in: path + required: true + description: The ID of the file to retrieve. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIFile' + /files/{fileId}/content: + get: + operationId: getFileContent + description: Returns information about a specific file. Does not retrieve file content. + parameters: + - name: fileId + in: path + required: true + description: The ID of the file to retrieve. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + type: string + format: byte + /threads: + post: + operationId: createThread + description: Creates a new thread. Threads contain messages and can be run by assistants. + parameters: [] + responses: + '200': + description: Information about the newly created thread. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThread' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThreadCreationOptions' + /threads/runs: + post: + operationId: createThreadAndRun + description: Creates a new assistant thread and immediately starts a run using that new thread. + parameters: [] + responses: + '200': + description: Information about the newly created thread. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAndRunThreadOptions' + /threads/{threadId}: + get: + operationId: getThread + description: Gets information about an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to retrieve information about. + schema: + type: string + responses: + '200': + description: Information about the requested thread. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThread' + post: + operationId: updateThread + description: Modifies an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to modify. + schema: + type: string + responses: + '200': + description: Information about the modified thread. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThread' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + delete: + operationId: deleteThread + description: Deletes an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to delete. + schema: + type: string + responses: + '200': + description: Status information about the requested thread deletion operation. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadDeletionStatus' + /threads/{threadId}/messages: + post: + operationId: createMessage + description: Creates a new message on a specified thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to create the new message on. + schema: + type: string + responses: + '200': + description: A representation of the new message. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadMessage' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The role to associate with the new message. + content: + type: string + description: The textual content for the new message. + file_ids: + type: array + items: + type: string + description: A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + required: + - role + - content + get: + operationId: listMessages + description: Gets a list of messages that exist on a thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to list messages from. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of messages. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/ThreadMessage' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /threads/{threadId}/messages/{messageId}: + get: + operationId: getMessage + description: Gets an existing message from an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to retrieve the specified message from. + schema: + type: string + - name: messageId + in: path + required: true + description: The ID of the message to retrieve from the specified thread. + schema: + type: string + responses: + '200': + description: A representation of the requested message. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadMessage' + post: + operationId: updateMessage + description: Modifies an existing message on an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread containing the specified message to modify. + schema: + type: string + - name: messageId + in: path + required: true + description: The ID of the message to modify on the specified thread. + schema: + type: string + responses: + '200': + description: A representation of the modified message. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadMessage' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /threads/{threadId}/messages/{messageId}/files: + get: + operationId: listMessageFiles + description: Gets a list of previously uploaded files associated with a message from a thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread containing the message to list files from. + schema: + type: string + - name: messageId + in: path + required: true + description: The ID of the message to list files from. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of files associated with the specified message. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/MessageFile' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /threads/{threadId}/messages/{messageId}/files/{fileId}: + get: + operationId: getMessageFile + description: Gets information about a file attachment to a message within a thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread containing the message to get information from. + schema: + type: string + - name: messageId + in: path + required: true + description: The ID of the message to get information from. + schema: + type: string + - name: fileId + in: path + required: true + description: The ID of the file to get information about. + schema: + type: string + responses: + '200': + description: The requested file information. + content: + application/json: + schema: + $ref: '#/components/schemas/MessageFile' + /threads/{threadId}/runs: + post: + operationId: createRun + description: Creates a new run for an assistant thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to run. + schema: + type: string + responses: + '200': + description: Information about the new thread run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + requestBody: + description: The details for the run to create. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRunOptions' + get: + operationId: listRuns + description: Gets a list of runs for a specified thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to list runs from. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of thread runs. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/ThreadRun' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /threads/{threadId}/runs/{runId}: + get: + operationId: getRun + description: Gets an existing run from an existing thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread to retrieve run information from. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the thread to retrieve information about. + schema: + type: string + responses: + '200': + description: The requested information about the specified thread run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + post: + operationId: updateRun + description: Modifies an existing thread run. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread associated with the specified run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the run to modify. + schema: + type: string + responses: + '200': + description: Information about the modified run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + /threads/{threadId}/runs/{runId}/cancel: + post: + operationId: cancelRun + description: Cancels a run of an in progress thread. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread being run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the run to cancel. + schema: + type: string + responses: + '200': + description: Updated information about the cancelled run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + /threads/{threadId}/runs/{runId}/steps: + get: + operationId: listRunSteps + description: Gets a list of run steps from a thread run. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread that was run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the run to list steps from. + schema: + type: string + - name: limit + in: query + required: false + description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + schema: + type: integer + format: int32 + default: 20 + - name: order + in: query + required: false + description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. + schema: + $ref: '#/components/schemas/ListSortOrder' + default: desc + - name: after + in: query + required: false + 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 + required: false + 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 + responses: + '200': + description: The requested list of run steps. + content: + application/json: + schema: + type: object + required: + - object + - data + - first_id + - last_id + - has_more + properties: + object: + type: string + enum: + - list + description: The object type, which is always list. + data: + type: array + items: + $ref: '#/components/schemas/RunStep' + description: The requested list of items. + first_id: + type: string + description: The first ID represented in this list. + last_id: + type: string + description: The last ID represented in this list. + has_more: + type: boolean + description: A value indicating whether there are additional values available not captured in this list. + description: The response data for a requested list of items. + /threads/{threadId}/runs/{runId}/steps/{stepId}: + get: + operationId: getRunStep + description: Gets a single run step from a thread run. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread that was run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the specific run to retrieve the step from. + schema: + type: string + - name: stepId + in: path + required: true + description: The ID of the step to retrieve information about. + schema: + type: string + responses: + '200': + description: Information about the requested run step. + content: + application/json: + schema: + $ref: '#/components/schemas/RunStep' + /threads/{threadId}/runs/{runId}/submit_tool_outputs: + post: + operationId: submitToolOutputsToRun + description: Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. + parameters: + - name: threadId + in: path + required: true + description: The ID of the thread that was run. + schema: + type: string + - name: runId + in: path + required: true + description: The ID of the run that requires tool outputs. + schema: + type: string + responses: + '200': + description: Updated information about the run. + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadRun' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + tool_outputs: + type: array + items: + $ref: '#/components/schemas/ToolOutput' + description: A list of tools for which the outputs are being submitted. + 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 +security: + - ApiKeyAuth: [] + - OAuth2Auth: + - https://cognitiveservices.azure.com/.default +components: + parameters: + UpdateAssistantOptions.assistantId: + name: assistantId + in: path + required: true + description: The ID of the assistant to modify. + schema: + type: string + schemas: + Assistant: + type: object + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - file_ids + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - assistant + description: The object type, which is always assistant. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + name: + type: string + nullable: true + description: The name of the assistant. + description: + type: string + nullable: true + description: The description of the assistant. + model: + type: string + description: The ID of the model to use. + instructions: + type: string + nullable: true + description: The system instructions for the assistant to use. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The collection of tools enabled for the assistant. + default: [] + file_ids: + type: array + items: + type: string + description: A list of attached file IDs, ordered by creation date in ascending order. + default: [] + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: Represents an assistant that can call the model and use tools. + AssistantCreationOptions: + type: object + required: + - model + properties: + model: + type: string + description: The ID of the model to use. + name: + type: string + nullable: true + description: The name of the new assistant. + description: + type: string + nullable: true + description: The description of the new assistant. + instructions: + type: string + nullable: true + description: The system instructions for the new assistant to use. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The collection of tools to enable for the new assistant. + default: [] + file_ids: + type: array + items: + type: string + description: A list of previously uploaded file IDs to attach to the assistant. + default: [] + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The request details to use when creating a new assistant. + AssistantDeletionStatus: + type: object + required: + - id + - deleted + - object + properties: + id: + type: string + description: The ID of the resource specified for deletion. + deleted: + type: boolean + description: A value indicating whether deletion was successful. + object: + type: string + enum: + - assistant.deleted + description: The object type, which is always 'assistant.deleted'. + description: The status of an assistant deletion operation. + AssistantFile: + type: object + required: + - id + - object + - created_at + - assistant_id + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - assistant.file + description: The object type, which is always 'assistant.file'. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + assistant_id: + type: string + description: The assistant ID that the file is attached to. + description: Information about a file attached to an assistant, as used by tools that can read files. + AssistantFileDeletionStatus: + type: object + required: + - id + - deleted + - object + properties: + id: + type: string + description: The ID of the resource specified for deletion. + deleted: + type: boolean + description: A value indicating whether deletion was successful. + object: + type: string + enum: + - assistant.file.deleted + description: The object type, which is always 'assistant.file.deleted'. + description: The status of an assistant file deletion operation. + AssistantStreamEvent: + anyOf: + - $ref: '#/components/schemas/ThreadStreamEvent' + - $ref: '#/components/schemas/RunStreamEvent' + - $ref: '#/components/schemas/RunStepStreamEvent' + - $ref: '#/components/schemas/MessageStreamEvent' + - $ref: '#/components/schemas/ErrorEvent' + - $ref: '#/components/schemas/DoneEvent' + description: |- + 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. + AssistantThread: + type: object + required: + - id + - object + - created_at + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread + description: The object type, which is always 'thread'. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: Information about a single thread associated with an assistant. + AssistantThreadCreationOptions: + type: object + properties: + messages: + type: array + items: + $ref: '#/components/schemas/ThreadInitializationMessage' + description: The initial messages to associate with the new thread. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The details used to create a new assistant thread. + CodeInterpreterToolDefinition: + type: object + required: + - type + properties: + type: + type: string + enum: + - code_interpreter + description: The object type, which is always 'code_interpreter'. + allOf: + - $ref: '#/components/schemas/ToolDefinition' + description: The input definition information for a code interpreter tool as used to configure an assistant. + CreateAndRunThreadOptions: + type: object + required: + - assistant_id + properties: + assistant_id: + type: string + description: The ID of the assistant for which the thread should be created. + thread: + allOf: + - $ref: '#/components/schemas/AssistantThreadCreationOptions' + description: The details used to create the new thread. If no thread is provided, an empty one will be created. + model: + type: string + nullable: true + description: The overridden model that the assistant should use to run the thread. + instructions: + type: string + nullable: true + description: The overridden system instructions the assistant should use to run the thread. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + nullable: true + description: The overridden list of enabled tools the assistant should use to run the thread. + stream: + type: boolean + 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. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The details used when creating and immediately running a new assistant thread. + CreateRunOptions: + type: object + required: + - assistant_id + properties: + assistant_id: + type: string + description: The ID of the assistant that should run the thread. + model: + type: string + nullable: true + description: The overridden model name that the assistant should use to run the thread. + instructions: + type: string + nullable: true + description: The overridden system instructions that the assistant should use to run the thread. + additional_instructions: + type: string + nullable: true + description: |- + Additional instructions to append 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. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + nullable: true + description: The overridden list of enabled tools that the assistant should use to run the thread. + stream: + type: boolean + 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. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The details used when creating a new run of an assistant thread. + DoneEvent: + anyOf: + - type: string + - type: string + enum: + - done + description: Terminal event indicating the successful end of a stream. + ErrorEvent: + anyOf: + - type: string + - type: string + enum: + - error + description: Terminal event indicating a server side error while streaming. + FileDeletionStatus: + type: object + required: + - id + - deleted + - object + properties: + id: + type: string + description: The ID of the resource specified for deletion. + deleted: + type: boolean + description: A value indicating whether deletion was successful. + object: + type: string + enum: + - file + description: The object type, which is always 'file'. + description: A status response from a file deletion operation. + FileListResponse: + type: object + required: + - object + - data + properties: + object: + type: string + enum: + - list + description: The object type, which is always 'list'. + data: + type: array + items: + $ref: '#/components/schemas/OpenAIFile' + description: The files returned for the request. + description: The response data from a file list operation. + FilePurpose: + anyOf: + - type: string + - type: string + enum: + - fine-tune + - fine-tune-results + - assistants + - assistants_output + description: The possible values denoting the intended usage of a file. + FunctionDefinition: + type: object + required: + - name + - parameters + properties: + name: + type: string + description: The name of the function to be called. + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + parameters: + description: The parameters the functions accepts, described as a JSON Schema object. + description: The input definition information for a function. + FunctionToolDefinition: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The object type, which is always 'function'. + function: + allOf: + - $ref: '#/components/schemas/FunctionDefinition' + description: The definition of the concrete function that the function tool should call. + allOf: + - $ref: '#/components/schemas/ToolDefinition' + description: The input definition information for a function tool as used to configure an assistant. + IncompleteRunDetails: + anyOf: + - type: string + - type: string + enum: + - max_completion_tokens + - max_prompt_tokens + description: The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. + ListSortOrder: + anyOf: + - type: string + - type: string + enum: + - asc + - desc + description: The available sorting options when requesting a list of response objects. + MessageContent: + type: object + required: + - type + properties: + type: + type: string + description: The object type. + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/MessageTextContent' + image_file: '#/components/schemas/MessageImageFileContent' + description: An abstract representation of a single item of thread message content. + MessageDelta: + type: object + required: + - role + - content + properties: + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The entity that produced the message. + content: + type: array + items: + $ref: '#/components/schemas/MessageDeltaContent' + description: The content of the message as an array of text and/or images. + description: Represents the typed 'delta' payload within a streaming message delta chunk. + MessageDeltaChunk: + type: object + required: + - id + - object + - delta + properties: + id: + type: string + description: The identifier of the message, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message.delta + description: The object type, which is always `thread.message.delta`. + delta: + allOf: + - $ref: '#/components/schemas/MessageDelta' + description: The delta containing the fields that have changed on the Message. + description: Represents a message delta i.e. any changed fields on a message during streaming. + MessageDeltaContent: + type: object + required: + - index + - type + properties: + index: + type: integer + format: int32 + description: The index of the content part of the message. + type: + type: string + description: The type of content for this content part. + discriminator: + propertyName: type + mapping: + image_file: '#/components/schemas/MessageDeltaImageFileContent' + text: '#/components/schemas/MessageDeltaTextContentObject' + description: The abstract base representation of a partial streamed message content payload. + MessageDeltaImageFileContent: + type: object + required: + - type + properties: + type: + type: string + enum: + - image_file + description: The type of content for this content part, which is always "image_file." + image_file: + allOf: + - $ref: '#/components/schemas/MessageDeltaImageFileContentObject' + description: The image_file data. + allOf: + - $ref: '#/components/schemas/MessageDeltaContent' + description: Represents a streamed image file content part within a streaming message delta chunk. + MessageDeltaImageFileContentObject: + type: object + properties: + file_id: + type: string + description: The file ID of the image in the message content. + description: Represents the 'image_file' payload within streaming image file content. + MessageDeltaTextAnnotation: + type: object + required: + - index + - type + properties: + index: + type: integer + format: int32 + description: The index of the annotation within a text content part. + type: + type: string + description: The type of the text content annotation. + discriminator: + propertyName: type + mapping: + file_citation: '#/components/schemas/MessageDeltaTextFileCitationAnnotationObject' + file_path: '#/components/schemas/MessageDeltaTextFilePathAnnotationObject' + description: The abstract base representation of a streamed text content part's text annotation. + MessageDeltaTextContent: + type: object + properties: + value: + type: string + description: The data that makes up the text. + annotations: + type: array + items: + $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Annotations for the text. + description: Represents the data of a streamed text content part within a streaming message delta chunk. + MessageDeltaTextContentObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - text + description: The type of content for this content part, which is always "text." + text: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextContent' + description: The text content details. + allOf: + - $ref: '#/components/schemas/MessageDeltaContent' + description: Represents a streamed text content part within a streaming message delta chunk. + MessageDeltaTextFileCitationAnnotation: + type: object + properties: + file_id: + type: string + description: The ID of the specific file the citation is from. + quote: + type: string + description: The specific quote in the cited file. + description: Represents the data of a streamed file citation as applied to a streaming text content part. + MessageDeltaTextFileCitationAnnotationObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_citation + description: The type of the text content annotation, which is always "file_citation." + file_citation: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextFileCitationAnnotation' + description: The file citation information. + text: + type: string + description: The text in the message content that needs to be replaced + start_index: + type: integer + format: int32 + description: The start index of this annotation in the content text. + end_index: + type: integer + format: int32 + description: The end index of this annotation in the content text. + allOf: + - $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Represents a streamed file citation applied to a streaming text content part. + MessageDeltaTextFilePathAnnotation: + type: object + properties: + file_id: + type: string + description: The file ID for the annotation. + description: Represents the data of a streamed file path annotation as applied to a streaming text content part. + MessageDeltaTextFilePathAnnotationObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_path + description: The type of the text content annotation, which is always "file_path." + file_path: + allOf: + - $ref: '#/components/schemas/MessageDeltaTextFilePathAnnotation' + description: The file path information. + start_index: + type: integer + format: int32 + description: The start index of this annotation in the content text. + end_index: + type: integer + format: int32 + description: The end index of this annotation in the content text. + text: + type: string + description: The text in the message content that needs to be replaced + allOf: + - $ref: '#/components/schemas/MessageDeltaTextAnnotation' + description: Represents a streamed file path annotation applied to a streaming text content part. + MessageFile: + type: object + required: + - id + - object + - created_at + - message_id + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message.file + description: The object type, which is always 'thread.message.file'. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + message_id: + type: string + description: The ID of the message that this file is attached to. + description: Information about a file attached to an assistant thread message. + MessageImageFileContent: + type: object + required: + - type + - image_file + properties: + type: + type: string + enum: + - image_file + description: The object type, which is always 'image_file'. + image_file: + allOf: + - $ref: '#/components/schemas/MessageImageFileDetails' + description: The image file for this thread message content item. + allOf: + - $ref: '#/components/schemas/MessageContent' + description: A representation of image file content in a thread message. + MessageImageFileDetails: + type: object + required: + - file_id + properties: + file_id: + type: string + description: The ID for the file associated with this image. + description: An image reference, as represented in thread message content. + MessageIncompleteDetails: + type: object + required: + - reason + properties: + reason: + allOf: + - $ref: '#/components/schemas/MessageIncompleteDetailsReason' + description: The provided reason describing why the message was marked as incomplete. + description: Information providing additional detail about a message entering an incomplete status. + MessageIncompleteDetailsReason: + anyOf: + - type: string + - type: string + enum: + - content_filter + - max_tokens + - run_cancelled + - run_failed + - run_expired + description: A set of reasons describing why a message is marked as incomplete. + MessageRole: + anyOf: + - type: string + - type: string + enum: + - user + - assistant + description: The possible values for roles attributed to messages in a thread. + MessageStatus: + anyOf: + - type: string + - type: string + enum: + - in_progress + - incomplete + - completed + description: The possible execution status values for a thread message. + MessageStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.message.created + - thread.message.in_progress + - thread.message.delta + - thread.message.completed + - thread.message.incomplete + description: Message operation related streaming events + MessageTextAnnotation: + type: object + required: + - type + - text + properties: + type: + type: string + description: The object type. + text: + type: string + description: The textual content associated with this text annotation item. + discriminator: + propertyName: type + mapping: + file_citation: '#/components/schemas/MessageTextFileCitationAnnotation' + file_path: '#/components/schemas/MessageTextFilePathAnnotation' + description: An abstract representation of an annotation to text thread message content. + MessageTextContent: + type: object + required: + - type + - text + properties: + type: + type: string + enum: + - text + description: The object type, which is always 'text'. + text: + allOf: + - $ref: '#/components/schemas/MessageTextDetails' + description: The text and associated annotations for this thread message content item. + allOf: + - $ref: '#/components/schemas/MessageContent' + description: A representation of a textual item of thread message content. + MessageTextDetails: + type: object + required: + - value + - annotations + properties: + value: + type: string + description: The text data. + annotations: + type: array + items: + $ref: '#/components/schemas/MessageTextAnnotation' + description: A list of annotations associated with this text. + description: The text and associated annotations for a single item of assistant thread message content. + MessageTextFileCitationAnnotation: + type: object + required: + - type + - file_citation + properties: + type: + type: string + enum: + - file_citation + description: The object type, which is always 'file_citation'. + file_citation: + allOf: + - $ref: '#/components/schemas/MessageTextFileCitationDetails' + description: |- + A citation within the message that points to a specific quote from a specific file. + Generated when the assistant uses the "retrieval" tool to search files. + start_index: + type: integer + format: int32 + description: The first text index associated with this text annotation. + end_index: + type: integer + format: int32 + description: The last text index associated with this text annotation. + allOf: + - $ref: '#/components/schemas/MessageTextAnnotation' + 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. + MessageTextFileCitationDetails: + type: object + required: + - file_id + - quote + properties: + file_id: + type: string + description: The ID of the file associated with this citation. + quote: + type: string + description: The specific quote cited in the associated file. + description: A representation of a file-based text citation, as used in a file-based annotation of text thread message content. + MessageTextFilePathAnnotation: + type: object + required: + - type + - file_path + properties: + type: + type: string + enum: + - file_path + description: The object type, which is always 'file_path'. + file_path: + allOf: + - $ref: '#/components/schemas/MessageTextFilePathDetails' + description: A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. + start_index: + type: integer + format: int32 + description: The first text index associated with this text annotation. + end_index: + type: integer + format: int32 + description: The last text index associated with this text annotation. + allOf: + - $ref: '#/components/schemas/MessageTextAnnotation' + description: A citation within the message that points to a file located at a specific path. + MessageTextFilePathDetails: + type: object + required: + - file_id + properties: + file_id: + type: string + description: The ID of the specific file that the citation is from. + description: An encapsulation of an image file ID, as used by message image content. + OpenAIFile: + type: object + required: + - object + - id + - bytes + - filename + - created_at + - purpose + properties: + object: + type: string + enum: + - file + description: The object type, which is always 'file'. + id: + type: string + description: The identifier, which can be referenced in API endpoints. + bytes: + type: integer + format: int32 + description: The size of the file, in bytes. + filename: + type: string + description: The name of the file. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + purpose: + allOf: + - $ref: '#/components/schemas/FilePurpose' + description: The intended purpose of a file. + description: Represents an assistant that can call the model and use tools. + RequiredAction: + type: object + required: + - type + properties: + type: + type: string + description: The object type. + discriminator: + propertyName: type + mapping: + submit_tool_outputs: '#/components/schemas/SubmitToolOutputsAction' + description: An abstract representation of a required action for an assistant thread run to continue. + RequiredFunctionToolCall: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The object type of the required tool call. Always 'function' for function tools. + function: + allOf: + - $ref: '#/components/schemas/RequiredFunctionToolCallDetails' + description: Detailed information about the function to be executed by the tool that includes name and arguments. + allOf: + - $ref: '#/components/schemas/RequiredToolCall' + description: A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. + RequiredFunctionToolCallDetails: + type: object + required: + - name + - arguments + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. + description: The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function. + RequiredToolCall: + type: object + required: + - type + - id + properties: + type: + type: string + description: The object type for the required tool call. + id: + type: string + description: The ID of the tool call. This ID must be referenced when submitting tool outputs. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/RequiredFunctionToolCall' + description: An abstract representation a a tool invocation needed by the model to continue a run. + RetrievalToolDefinition: + type: object + required: + - type + properties: + type: + type: string + enum: + - retrieval + description: The object type, which is always 'retrieval'. + allOf: + - $ref: '#/components/schemas/ToolDefinition' + description: The input definition information for a retrieval tool as used to configure an assistant. + RunCompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int64 + description: Number of completion tokens used over the course of the run. + prompt_tokens: + type: integer + format: int64 + description: Number of prompt tokens used over the course of the run. + total_tokens: + type: integer + format: int64 + description: Total number of tokens used (prompt + completion). + description: Usage statistics related to the run. + RunError: + type: object + required: + - code + - message + properties: + code: + type: string + description: The status for the error. + message: + type: string + description: The human-readable text associated with the error. + description: The details of an error as encountered by an assistant thread run. + RunStatus: + anyOf: + - type: string + - type: string + enum: + - queued + - in_progress + - requires_action + - cancelling + - cancelled + - failed + - completed + - expired + description: Possible values for the status of an assistant thread run. + RunStep: + type: object + required: + - id + - object + - type + - assistant_id + - thread_id + - run_id + - status + - step_details + - last_error + - created_at + - expired_at + - completed_at + - cancelled_at + - failed_at + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.run.step + description: The object type, which is always 'thread.run.step'. + type: + allOf: + - $ref: '#/components/schemas/RunStepType' + description: The type of run step, which can be either message_creation or tool_calls. + assistant_id: + type: string + description: The ID of the assistant associated with the run step. + thread_id: + type: string + description: The ID of the thread that was run. + run_id: + type: string + description: The ID of the run that this run step is a part of. + status: + allOf: + - $ref: '#/components/schemas/RunStepStatus' + description: The status of this run step. + step_details: + allOf: + - $ref: '#/components/schemas/RunStepDetails' + description: The details for this run step. + last_error: + type: object + allOf: + - $ref: '#/components/schemas/RunStepError' + nullable: true + description: If applicable, information about the last error encountered by this run step. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + expired_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this item expired. + completed_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this completed. + cancelled_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this was cancelled. + failed_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this failed. + usage: + type: object + allOf: + - $ref: '#/components/schemas/RunStepCompletionUsage' + nullable: true + description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: Detailed information about a single step of an assistant thread run. + RunStepCodeInterpreterImageOutput: + type: object + required: + - type + - image + properties: + type: + type: string + enum: + - image + description: The object type, which is always 'image'. + image: + allOf: + - $ref: '#/components/schemas/RunStepCodeInterpreterImageReference' + description: Referential information for the image associated with this output. + allOf: + - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' + description: A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. + RunStepCodeInterpreterImageReference: + type: object + required: + - file_id + properties: + file_id: + type: string + description: The ID of the file associated with this image. + description: An image reference emitted by a code interpreter tool in response to a tool call by the model. + RunStepCodeInterpreterLogOutput: + type: object + required: + - type + - logs + properties: + type: + type: string + enum: + - logs + description: The object type, which is always 'logs'. + logs: + type: string + description: The serialized log output emitted by the code interpreter. + allOf: + - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' + description: A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. + RunStepCodeInterpreterToolCall: + type: object + required: + - type + - code_interpreter + properties: + type: + type: string + enum: + - code_interpreter + description: The object type, which is always 'code_interpreter'. + code_interpreter: + allOf: + - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallDetails' + description: The details of the tool call to the code interpreter tool. + allOf: + - $ref: '#/components/schemas/RunStepToolCall' + description: |- + A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that + represents inputs and outputs consumed and emitted by the code interpreter. + RunStepCodeInterpreterToolCallDetails: + type: object + required: + - input + - outputs + properties: + input: + type: string + description: The input provided by the model to the code interpreter tool. + outputs: + type: array + items: + $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' + description: The outputs produced by the code interpreter tool back to the model in response to the tool call. + description: The detailed information about a code interpreter invocation by the model. + RunStepCodeInterpreterToolCallOutput: + type: object + required: + - type + properties: + type: + type: string + description: The object type. + discriminator: + propertyName: type + mapping: + logs: '#/components/schemas/RunStepCodeInterpreterLogOutput' + image: '#/components/schemas/RunStepCodeInterpreterImageOutput' + description: An abstract representation of an emitted output from a code interpreter tool. + RunStepCompletionUsage: + type: object + required: + - completion_tokens + - prompt_tokens + - total_tokens + properties: + completion_tokens: + type: integer + format: int64 + description: Number of completion tokens used over the course of the run step. + prompt_tokens: + type: integer + format: int64 + description: Number of prompt tokens used over the course of the run step. + total_tokens: + type: integer + format: int64 + description: Total number of tokens used (prompt + completion). + description: Usage statistics related to the run step. + RunStepDelta: + type: object + properties: + step_details: + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: The details of the run step. + description: Represents the delta payload in a streaming run step delta chunk. + RunStepDeltaChunk: + type: object + required: + - id + - object + - delta + properties: + id: + type: string + description: The identifier of the run step, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.run.step.delta + description: The object type, which is always `thread.run.step.delta`. + delta: + allOf: + - $ref: '#/components/schemas/RunStepDelta' + description: The delta containing the fields that have changed on the run step. + description: Represents a run step delta i.e. any changed fields on a run step during streaming. + RunStepDeltaCodeInterpreterDetailItemObject: + type: object + properties: + input: + type: string + description: The input into the Code Interpreter tool call. + outputs: + type: array + items: + $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + 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. + description: Represents the Code Interpreter tool call data in a streaming run step's tool calls. + RunStepDeltaCodeInterpreterImageOutput: + type: object + required: + - type + properties: + type: + type: string + enum: + - image + description: The object type, which is always "image." + image: + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutputObject' + description: The image data for the Code Interpreter tool call output. + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + description: Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. + RunStepDeltaCodeInterpreterImageOutputObject: + type: object + properties: + file_id: + type: string + description: The file ID for the image. + description: Represents the data for a streaming run step's Code Interpreter tool call image output. + RunStepDeltaCodeInterpreterLogOutput: + type: object + required: + - type + properties: + type: + type: string + enum: + - logs + description: The type of the object, which is always "logs." + logs: + type: string + description: The text output from the Code Interpreter tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' + description: Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. + RunStepDeltaCodeInterpreterOutput: + type: object + required: + - index + - type + properties: + index: + type: integer + format: int32 + description: The index of the output in the streaming run step tool call's Code Interpreter outputs array. + type: + type: string + description: The type of the streaming run step tool call's Code Interpreter output. + discriminator: + propertyName: type + mapping: + logs: '#/components/schemas/RunStepDeltaCodeInterpreterLogOutput' + image: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutput' + description: The abstract base representation of a streaming run step tool call's Code Interpreter tool output. + RunStepDeltaCodeInterpreterToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - code_interpreter + description: The object type, which is always "code_interpreter." + code_interpreter: + allOf: + - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterDetailItemObject' + description: The Code Interpreter data for the tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a Code Interpreter tool call within a streaming run step's tool call details. + RunStepDeltaDetail: + type: object + required: + - type + properties: + type: + type: string + description: The object type for the run step detail object. + discriminator: + propertyName: type + mapping: + message_creation: '#/components/schemas/RunStepDeltaMessageCreation' + tool_calls: '#/components/schemas/RunStepDeltaToolCallObject' + description: Represents a single run step detail item in a streaming run step's delta payload. + RunStepDeltaFunction: + type: object + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments passed to the function as input. + output: + type: string + nullable: true + description: The output of the function, null if outputs have not yet been submitted. + description: Represents the function data in a streaming run step delta's function tool call. + RunStepDeltaFunctionToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - function + description: The object type, which is always "function." + function: + allOf: + - $ref: '#/components/schemas/RunStepDeltaFunction' + description: The function data for the tool call. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a function tool call within a streaming run step's tool call details. + RunStepDeltaMessageCreation: + type: object + required: + - type + properties: + type: + type: string + enum: + - message_creation + description: The object type, which is always "message_creation." + message_creation: + allOf: + - $ref: '#/components/schemas/RunStepDeltaMessageCreationObject' + description: The message creation data. + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: Represents a message creation within a streaming run step delta. + RunStepDeltaMessageCreationObject: + type: object + properties: + message_id: + type: string + description: The ID of the newly-created message. + description: Represents the data within a streaming run step message creation response object. + RunStepDeltaRetrievalToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - retrieval + description: The object type, which is always "retrieval." + file_search: + type: object + additionalProperties: + type: string + description: Reserved for future use. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a retrieval tool call within a streaming run step's tool call details. + RunStepDeltaToolCall: + type: object + required: + - index + - id + - type + properties: + index: + type: integer + format: int32 + description: The index of the tool call detail in the run step's tool_calls array. + id: + type: string + description: The ID of the tool call, used when submitting outputs to the run. + type: + type: string + description: The type of the tool call detail item in a streaming run step's details. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/RunStepDeltaFunctionToolCall' + retrieval: '#/components/schemas/RunStepDeltaRetrievalToolCall' + code_interpreter: '#/components/schemas/RunStepDeltaCodeInterpreterToolCall' + description: The abstract base representation of a single tool call within a streaming run step's delta tool call details. + RunStepDeltaToolCallObject: + type: object + required: + - type + properties: + type: + type: string + enum: + - tool_calls + description: The object type, which is always "tool_calls." + tool_calls: + type: array + items: + $ref: '#/components/schemas/RunStepDeltaToolCall' + description: The collection of tool calls for the tool call detail item. + allOf: + - $ref: '#/components/schemas/RunStepDeltaDetail' + description: Represents an invocation of tool calls as part of a streaming run step. + RunStepDetails: + type: object + required: + - type + properties: + type: + allOf: + - $ref: '#/components/schemas/RunStepType' + description: The object type. + discriminator: + propertyName: type + mapping: + message_creation: '#/components/schemas/RunStepMessageCreationDetails' + tool_calls: '#/components/schemas/RunStepToolCallDetails' + description: An abstract representation of the details for a run step. + RunStepError: + type: object + required: + - code + - message + properties: + code: + allOf: + - $ref: '#/components/schemas/RunStepErrorCode' + description: The error code for this error. + message: + type: string + description: The human-readable text associated with this error. + description: The error information associated with a failed run step. + RunStepErrorCode: + anyOf: + - type: string + - type: string + enum: + - server_error + - rate_limit_exceeded + description: Possible error code values attributable to a failed run step. + RunStepFunctionToolCall: + type: object + required: + - type + - function + properties: + type: + type: string + enum: + - function + description: The object type, which is always 'function'. + function: + allOf: + - $ref: '#/components/schemas/RunStepFunctionToolCallDetails' + description: The detailed information about the function called by the model. + allOf: + - $ref: '#/components/schemas/RunStepToolCall' + description: |- + A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs + and output consumed and emitted by the specified function. + RunStepFunctionToolCallDetails: + type: object + required: + - name + - arguments + - output + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments that the model requires are provided to the named function. + output: + type: string + nullable: true + description: The output of the function, only populated for function calls that have already have had their outputs submitted. + description: The detailed information about the function called by the model. + RunStepMessageCreationDetails: + type: object + required: + - type + - message_creation + properties: + type: + type: string + enum: + - message_creation + description: The object type, which is always 'message_creation'. + message_creation: + allOf: + - $ref: '#/components/schemas/RunStepMessageCreationReference' + description: Information about the message creation associated with this run step. + allOf: + - $ref: '#/components/schemas/RunStepDetails' + description: The detailed information associated with a message creation run step. + RunStepMessageCreationReference: + type: object + required: + - message_id + properties: + message_id: + type: string + description: The ID of the message created by this run step. + description: The details of a message created as a part of a run step. + RunStepRetrievalToolCall: + type: object + required: + - type + - retrieval + properties: + type: + type: string + enum: + - retrieval + description: The object type, which is always 'retrieval'. + retrieval: + type: object + additionalProperties: + type: string + description: The key/value pairs produced by the retrieval tool. + allOf: + - $ref: '#/components/schemas/RunStepToolCall' + description: |- + A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents + executed retrieval actions. + RunStepStatus: + anyOf: + - type: string + - type: string + enum: + - in_progress + - cancelled + - failed + - completed + - expired + description: Possible values for the status of a run step. + RunStepStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.run.step.created + - thread.run.step.in_progress + - thread.run.step.delta + - thread.run.step.completed + - thread.run.step.failed + - thread.run.step.cancelled + - thread.run.step.expired + description: Run step operation related streaming events + RunStepToolCall: + type: object + required: + - type + - id + properties: + type: + type: string + description: The object type. + id: + type: string + description: The ID of the tool call. This ID must be referenced when you submit tool outputs. + discriminator: + propertyName: type + mapping: + code_interpreter: '#/components/schemas/RunStepCodeInterpreterToolCall' + retrieval: '#/components/schemas/RunStepRetrievalToolCall' + function: '#/components/schemas/RunStepFunctionToolCall' + description: An abstract representation of a detailed tool call as recorded within a run step for an existing run. + RunStepToolCallDetails: + type: object + required: + - type + - tool_calls + properties: + type: + type: string + enum: + - tool_calls + description: The object type, which is always 'tool_calls'. + tool_calls: + type: array + items: + $ref: '#/components/schemas/RunStepToolCall' + description: A list of tool call details for this run step. + allOf: + - $ref: '#/components/schemas/RunStepDetails' + description: The detailed information associated with a run step calling tools. + RunStepType: + anyOf: + - type: string + - type: string + enum: + - message_creation + - tool_calls + description: The possible types of run steps. + RunStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.run.created + - thread.run.queued + - thread.run.in_progress + - thread.run.requires_action + - thread.run.completed + - thread.run.failed + - thread.run.cancelling + - thread.run.cancelled + - thread.run.expired + description: Run operation related streaming events + ServiceApiVersions: + type: string + enum: + - 2024-02-15-preview + - 2024-05-01-preview + description: The known set of supported API versions. + SubmitToolOutputsAction: + type: object + required: + - type + - submit_tool_outputs + properties: + type: + type: string + enum: + - submit_tool_outputs + description: The object type, which is always 'submit_tool_outputs'. + submit_tool_outputs: + allOf: + - $ref: '#/components/schemas/SubmitToolOutputsDetails' + description: The details describing tools that should be called to submit tool outputs. + allOf: + - $ref: '#/components/schemas/RequiredAction' + description: The details for required tool calls that must be submitted for an assistant thread run to continue. + SubmitToolOutputsDetails: + type: object + required: + - tool_calls + properties: + tool_calls: + type: array + items: + $ref: '#/components/schemas/RequiredToolCall' + description: The list of tool calls that must be resolved for the assistant thread run to continue. + description: The details describing tools that should be called to submit tool outputs. + ThreadDeletionStatus: + type: object + required: + - id + - deleted + - object + properties: + id: + type: string + description: The ID of the resource specified for deletion. + deleted: + type: boolean + description: A value indicating whether deletion was successful. + object: + type: string + enum: + - thread.deleted + description: The object type, which is always 'thread.deleted'. + description: The status of a thread deletion operation. + ThreadInitializationMessage: + type: object + required: + - role + - content + properties: + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread. + content: + type: string + description: The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API. + file_ids: + type: array + items: + type: string + description: |- + A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can + access files. + default: [] + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: A single message within an assistant thread, as provided during that thread's creation for its initial state. + ThreadMessage: + type: object + required: + - id + - object + - created_at + - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at + - role + - content + - file_ids + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.message + description: The object type, which is always 'thread.message'. + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + thread_id: + type: string + description: The ID of the thread that this message belongs to. + status: + allOf: + - $ref: '#/components/schemas/MessageStatus' + description: The status of the message. + incomplete_details: + oneOf: + - $ref: '#/components/schemas/MessageIncompleteDetailsReason' + nullable: true + description: On an incomplete message, details about why the message is incomplete. + completed_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the message was completed. + incomplete_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the message was marked as incomplete. + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: The role associated with the assistant thread message. + content: + type: array + items: + $ref: '#/components/schemas/MessageContent' + description: The list of content items associated with the assistant thread message. + assistant_id: + type: string + description: If applicable, the ID of the assistant that authored this message. + run_id: + type: string + description: If applicable, the ID of the run associated with the authoring of this message. + file_ids: + type: array + items: + type: string + description: |- + A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can + access files. + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: A single, existing message within an assistant thread. + ThreadRun: + type: object + required: + - id + - object + - thread_id + - assistant_id + - status + - last_error + - model + - instructions + - tools + - file_ids + - created_at + - expires_at + - started_at + - completed_at + - cancelled_at + - failed_at + - incomplete_details + - usage + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - thread.run + description: The object type, which is always 'thread.run'. + thread_id: + type: string + description: The ID of the thread associated with this run. + assistant_id: + type: string + description: The ID of the assistant associated with the thread this run was performed against. + status: + allOf: + - $ref: '#/components/schemas/RunStatus' + description: The status of the assistant thread run. + required_action: + type: object + allOf: + - $ref: '#/components/schemas/RequiredAction' + nullable: true + description: The details of the action required for the assistant thread run to continue. + last_error: + type: object + allOf: + - $ref: '#/components/schemas/RunError' + nullable: true + description: The last error, if any, encountered by this assistant thread run. + model: + type: string + description: The ID of the model to use. + instructions: + type: string + description: The overridden system instructions used for this assistant thread run. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The overridden enabled tools used for this assistant thread run. + default: [] + file_ids: + type: array + items: + type: string + description: A list of attached file IDs, ordered by creation date in ascending order. + default: [] + created_at: + type: integer + format: unixtime + description: The Unix timestamp, in seconds, representing when this object was created. + expires_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this item expires. + started_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this item was started. + completed_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this completed. + cancelled_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this was cancelled. + failed_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp, in seconds, representing when this failed. + incomplete_details: + oneOf: + - $ref: '#/components/schemas/IncompleteRunDetails' + nullable: true + description: Details on why the run is incomplete. Will be `null` if the run is not incomplete. + usage: + type: object + allOf: + - $ref: '#/components/schemas/RunCompletionUsage' + nullable: true + 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.). + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: Data representing a single evaluation run of an assistant thread. + ThreadStreamEvent: + anyOf: + - type: string + - type: string + enum: + - thread.created + description: Thread operation related streaming events + ToolDefinition: + type: object + required: + - type + properties: + type: + type: string + description: The object type. + discriminator: + propertyName: type + mapping: + code_interpreter: '#/components/schemas/CodeInterpreterToolDefinition' + retrieval: '#/components/schemas/RetrievalToolDefinition' + function: '#/components/schemas/FunctionToolDefinition' + description: An abstract representation of an input tool definition that an assistant can use. + ToolOutput: + type: object + properties: + tool_call_id: + type: string + description: The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. + output: + type: string + description: The output from the tool to be submitted. + description: The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. + UpdateAssistantOptions: + type: object + properties: + model: + type: string + description: The ID of the model to use. + name: + type: string + nullable: true + description: The modified name for the assistant to use. + description: + type: string + nullable: true + description: The modified description for the assistant to use. + instructions: + type: string + nullable: true + description: The modified system instructions for the new assistant to use. + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinition' + description: The modified collection of tools to enable for the assistant. + default: [] + file_ids: + type: array + items: + type: string + description: The modified list of previously uploaded fileIDs to attach to the assistant. + default: [] + metadata: + type: object + additionalProperties: + type: string + nullable: true + description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. + description: The request details to use when modifying an existing assistant. + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: api-key + OAuth2Auth: + type: oauth2 + flows: + implicit: + authorizationUrl: https://login.microsoftonline.com/common/oauth2/v2.0/authorize + scopes: + https://cognitiveservices.azure.com/.default: '' +servers: + - url: '{endpoint}' + description: Azure OpenAI APIs for Assistants. + variables: + endpoint: + default: '' + description: An OpenAI endpoint supporting assistants functionality. From 8d1db4b481899177a20a18e69d041590d4ab1073 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Fri, 17 May 2024 17:36:35 +0200 Subject: [PATCH 23/25] Removed 05_01 from service version enum ... for now --- .../2024-05-01-preview/create_assistant.json | 4 - specification/ai/OpenAI.Assistants/main.tsp | 3 - .../assistants_generated.json | 3808 ----------------- .../assistants_generated.yaml | 1 - .../assistants_generated.yaml | 3177 -------------- 5 files changed, 6993 deletions(-) delete mode 100644 specification/ai/OpenAI.Assistants/examples/2024-05-01-preview/create_assistant.json delete mode 100644 specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json delete mode 100644 specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml diff --git a/specification/ai/OpenAI.Assistants/examples/2024-05-01-preview/create_assistant.json b/specification/ai/OpenAI.Assistants/examples/2024-05-01-preview/create_assistant.json deleted file mode 100644 index 24f1208ac3df..000000000000 --- a/specification/ai/OpenAI.Assistants/examples/2024-05-01-preview/create_assistant.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "title": "Assistants_CreateAssistant", - "operationId": "Assistants_CreateAssistant" -} diff --git a/specification/ai/OpenAI.Assistants/main.tsp b/specification/ai/OpenAI.Assistants/main.tsp index 79c4794e5382..462d1028e419 100644 --- a/specification/ai/OpenAI.Assistants/main.tsp +++ b/specification/ai/OpenAI.Assistants/main.tsp @@ -52,8 +52,5 @@ namespace Azure.AI.OpenAI.Assistants { @useDependency(Azure.Core.Versions.v1_0_Preview_2) @doc("The initial version of Azure OpenAI Assistants that corresponds to functionality in OpenAI's first beta release.") v2024_02_15_preview: "2024-02-15-preview", - - @doc("The May 2024 preview release for Azure OpenAI, including the first availability of assistants V2.") - v2024_05_01_preview: "2024-05-01-preview", } } diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json deleted file mode 100644 index a045a4f72ac6..000000000000 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json +++ /dev/null @@ -1,3808 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure OpenAI", - "version": "2024-05-01-preview", - "description": "Azure OpenAI APIs for Assistants.", - "x-typespec-generated": [ - { - "emitter": "@azure-tools/typespec-autorest" - } - ] - }, - "schemes": [ - "https" - ], - "x-ms-parameterized-host": { - "hostTemplate": "{endpoint}", - "useSchemePrefix": false, - "parameters": [ - { - "name": "endpoint", - "in": "path", - "description": "An OpenAI endpoint supporting assistants functionality.", - "required": true, - "type": "string" - } - ] - }, - "produces": [ - "application/json" - ], - "consumes": [ - "application/json" - ], - "security": [ - { - "ApiKeyAuth": [] - }, - { - "OAuth2Auth": [ - "https://cognitiveservices.azure.com/.default" - ] - } - ], - "securityDefinitions": { - "ApiKeyAuth": { - "type": "apiKey", - "name": "api-key", - "in": "header" - }, - "OAuth2Auth": { - "type": "oauth2", - "flow": "implicit", - "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", - "scopes": { - "https://cognitiveservices.azure.com/.default": "" - } - } - }, - "tags": [], - "paths": { - "/assistants": { - "get": { - "operationId": "ListAssistants", - "description": "Gets a list of assistants that were previously created.", - "parameters": [ - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of assistants.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/Assistant" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - }, - "post": { - "operationId": "CreateAssistant", - "description": "Creates a new assistant.", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AssistantCreationOptions" - } - } - ], - "responses": { - "200": { - "description": "The new assistant instance.", - "schema": { - "$ref": "#/definitions/Assistant" - } - } - } - } - }, - "/assistants/{assistantId}": { - "get": { - "operationId": "GetAssistant", - "description": "Retrieves an existing assistant.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to retrieve.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested assistant instance.", - "schema": { - "$ref": "#/definitions/Assistant" - } - } - } - }, - "post": { - "operationId": "UpdateAssistant", - "description": "Modifies an existing assistant.", - "parameters": [ - { - "$ref": "#/parameters/UpdateAssistantOptions.assistantId" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAssistantOptions" - } - } - ], - "responses": { - "200": { - "description": "The updated assistant instance.", - "schema": { - "$ref": "#/definitions/Assistant" - } - } - } - }, - "delete": { - "operationId": "DeleteAssistant", - "description": "Deletes an assistant.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to delete.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Status information about the requested deletion operation.", - "schema": { - "$ref": "#/definitions/AssistantDeletionStatus" - } - } - } - } - }, - "/assistants/{assistantId}/files": { - "get": { - "operationId": "ListAssistantFiles", - "description": "Gets a list of files attached to a specific assistant, as used by tools that can read files.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to retrieve the list of attached files for.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of files attached to the specified assistant.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/AssistantFile" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - }, - "post": { - "operationId": "CreateAssistantFile", - "description": "Attaches a previously uploaded file to an assistant for use by tools that can read files.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to attach the file to.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the previously uploaded file to attach.", - "x-ms-client-name": "fileId" - } - }, - "required": [ - "file_id" - ] - } - } - ], - "responses": { - "200": { - "description": "Information about the attached file.", - "schema": { - "$ref": "#/definitions/AssistantFile" - } - } - } - } - }, - "/assistants/{assistantId}/files/{fileId}": { - "get": { - "operationId": "GetAssistantFile", - "description": "Retrieves a file attached to an assistant.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant associated with the attached file.", - "required": true, - "type": "string" - }, - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to retrieve.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "A representation of the attached file.", - "schema": { - "$ref": "#/definitions/AssistantFile" - } - } - } - }, - "delete": { - "operationId": "DeleteAssistantFile", - "description": "Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read\nfiles.", - "parameters": [ - { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant from which the specified file should be unlinked.", - "required": true, - "type": "string" - }, - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to unlink from the specified assistant.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Status information about the requested file association deletion.", - "schema": { - "$ref": "#/definitions/AssistantFileDeletionStatus" - } - } - } - } - }, - "/files": { - "get": { - "operationId": "ListFiles", - "description": "Gets a list of previously uploaded files.", - "parameters": [ - { - "name": "purpose", - "in": "query", - "description": "A value that, when provided, limits list results to files matching the corresponding purpose.", - "required": false, - "type": "string", - "enum": [ - "fine-tune", - "fine-tune-results", - "assistants", - "assistants_output" - ], - "x-ms-enum": { - "name": "FilePurpose", - "modelAsString": true, - "values": [ - { - "name": "fineTune", - "value": "fine-tune", - "description": "Indicates a file is used for fine tuning input." - }, - { - "name": "fineTuneResults", - "value": "fine-tune-results", - "description": "Indicates a file is used for fine tuning results." - }, - { - "name": "assistants", - "value": "assistants", - "description": "Indicates a file is used as input to assistants." - }, - { - "name": "assistantsOutput", - "value": "assistants_output", - "description": "Indicates a file is used as output by assistants." - } - ] - } - } - ], - "responses": { - "200": { - "description": "The requested list of files.", - "schema": { - "$ref": "#/definitions/FileListResponse" - } - } - } - }, - "post": { - "operationId": "UploadFile", - "description": "Uploads a file for use by other operations.", - "consumes": [ - "multipart/form-data" - ], - "parameters": [ - { - "name": "file", - "in": "formData", - "description": "The file data (not filename) to upload.", - "required": true, - "type": "file" - }, - { - "name": "purpose", - "in": "formData", - "description": "The intended purpose of the file.", - "required": true, - "type": "string", - "enum": [ - "fine-tune", - "fine-tune-results", - "assistants", - "assistants_output" - ], - "x-ms-enum": { - "name": "FilePurpose", - "modelAsString": true, - "values": [ - { - "name": "fineTune", - "value": "fine-tune", - "description": "Indicates a file is used for fine tuning input." - }, - { - "name": "fineTuneResults", - "value": "fine-tune-results", - "description": "Indicates a file is used for fine tuning results." - }, - { - "name": "assistants", - "value": "assistants", - "description": "Indicates a file is used as input to assistants." - }, - { - "name": "assistantsOutput", - "value": "assistants_output", - "description": "Indicates a file is used as output by assistants." - } - ] - } - }, - { - "name": "filename", - "in": "formData", - "description": "A filename to associate with the uploaded data.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "A representation of the uploaded file.", - "schema": { - "$ref": "#/definitions/OpenAIFile" - } - } - } - } - }, - "/files/{fileId}": { - "get": { - "operationId": "GetFile", - "description": "Returns information about a specific file. Does not retrieve file content.", - "parameters": [ - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to retrieve.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/OpenAIFile" - } - } - } - }, - "delete": { - "operationId": "DeleteFile", - "description": "Delete a previously uploaded file.", - "parameters": [ - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to delete.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/FileDeletionStatus" - } - } - } - } - }, - "/files/{fileId}/content": { - "get": { - "operationId": "GetFileContent", - "description": "Returns information about a specific file. Does not retrieve file content.", - "parameters": [ - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to retrieve.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "type": "string", - "format": "byte" - } - } - } - } - }, - "/threads": { - "post": { - "operationId": "CreateThread", - "description": "Creates a new thread. Threads contain messages and can be run by assistants.", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AssistantThreadCreationOptions" - } - } - ], - "responses": { - "200": { - "description": "Information about the newly created thread.", - "schema": { - "$ref": "#/definitions/AssistantThread" - } - } - } - } - }, - "/threads/{threadId}": { - "get": { - "operationId": "GetThread", - "description": "Gets information about an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to retrieve information about.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Information about the requested thread.", - "schema": { - "$ref": "#/definitions/AssistantThread" - } - } - } - }, - "post": { - "operationId": "UpdateThread", - "description": "Modifies an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to modify.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - } - } - ], - "responses": { - "200": { - "description": "Information about the modified thread.", - "schema": { - "$ref": "#/definitions/AssistantThread" - } - } - } - }, - "delete": { - "operationId": "DeleteThread", - "description": "Deletes an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to delete.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Status information about the requested thread deletion operation.", - "schema": { - "$ref": "#/definitions/ThreadDeletionStatus" - } - } - } - } - }, - "/threads/{threadId}/messages": { - "get": { - "operationId": "ListMessages", - "description": "Gets a list of messages that exist on a thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to list messages from.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of messages.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/ThreadMessage" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - }, - "post": { - "operationId": "CreateMessage", - "description": "Creates a new message on a specified thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to create the new message on.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "role": { - "$ref": "#/definitions/MessageRole", - "description": "The role to associate with the new message." - }, - "content": { - "type": "string", - "description": "The textual content for the new message." - }, - "file_ids": { - "type": "array", - "description": "A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files.", - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "role", - "content" - ] - } - } - ], - "responses": { - "200": { - "description": "A representation of the new message.", - "schema": { - "$ref": "#/definitions/ThreadMessage" - } - } - } - } - }, - "/threads/{threadId}/messages/{messageId}": { - "get": { - "operationId": "GetMessage", - "description": "Gets an existing message from an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to retrieve the specified message from.", - "required": true, - "type": "string" - }, - { - "name": "messageId", - "in": "path", - "description": "The ID of the message to retrieve from the specified thread.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "A representation of the requested message.", - "schema": { - "$ref": "#/definitions/ThreadMessage" - } - } - } - }, - "post": { - "operationId": "UpdateMessage", - "description": "Modifies an existing message on an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread containing the specified message to modify.", - "required": true, - "type": "string" - }, - { - "name": "messageId", - "in": "path", - "description": "The ID of the message to modify on the specified thread.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - } - } - ], - "responses": { - "200": { - "description": "A representation of the modified message.", - "schema": { - "$ref": "#/definitions/ThreadMessage" - } - } - } - } - }, - "/threads/{threadId}/messages/{messageId}/files": { - "get": { - "operationId": "ListMessageFiles", - "description": "Gets a list of previously uploaded files associated with a message from a thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread containing the message to list files from.", - "required": true, - "type": "string" - }, - { - "name": "messageId", - "in": "path", - "description": "The ID of the message to list files from.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of files associated with the specified message.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/MessageFile" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - } - }, - "/threads/{threadId}/messages/{messageId}/files/{fileId}": { - "get": { - "operationId": "GetMessageFile", - "description": "Gets information about a file attachment to a message within a thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread containing the message to get information from.", - "required": true, - "type": "string" - }, - { - "name": "messageId", - "in": "path", - "description": "The ID of the message to get information from.", - "required": true, - "type": "string" - }, - { - "name": "fileId", - "in": "path", - "description": "The ID of the file to get information about.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested file information.", - "schema": { - "$ref": "#/definitions/MessageFile" - } - } - } - } - }, - "/threads/{threadId}/runs": { - "get": { - "operationId": "ListRuns", - "description": "Gets a list of runs for a specified thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to list runs from.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of thread runs.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/ThreadRun" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - }, - "post": { - "operationId": "CreateRun", - "description": "Creates a new run for an assistant thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to run.", - "required": true, - "type": "string" - }, - { - "name": "createRunOptions", - "in": "body", - "description": "The details for the run to create.", - "required": true, - "schema": { - "$ref": "#/definitions/CreateRunOptions" - } - } - ], - "responses": { - "200": { - "description": "Information about the new thread run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}": { - "get": { - "operationId": "GetRun", - "description": "Gets an existing run from an existing thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to retrieve run information from.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the thread to retrieve information about.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested information about the specified thread run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - }, - "post": { - "operationId": "UpdateRun", - "description": "Modifies an existing thread run.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread associated with the specified run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the run to modify.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - } - } - ], - "responses": { - "200": { - "description": "Information about the modified run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}/cancel": { - "post": { - "operationId": "CancelRun", - "description": "Cancels a run of an in progress thread.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread being run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the run to cancel.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Updated information about the cancelled run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}/steps": { - "get": { - "operationId": "ListRunSteps", - "description": "Gets a list of run steps from a thread run.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread that was run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the run to list steps from.", - "required": true, - "type": "string" - }, - { - "name": "limit", - "in": "query", - "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, - "type": "integer", - "format": "int32", - "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.", - "required": false, - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "x-ms-enum": { - "name": "ListSortOrder", - "modelAsString": true, - "values": [ - { - "name": "ascending", - "value": "asc", - "description": "Specifies an ascending sort order." - }, - { - "name": "descending", - "value": "desc", - "description": "Specifies a descending sort 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.", - "required": false, - "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.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "The requested list of run steps.", - "schema": { - "type": "object", - "description": "The response data for a requested list of items.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always list.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The requested list of items.", - "items": { - "$ref": "#/definitions/RunStep" - } - }, - "first_id": { - "type": "string", - "description": "The first ID represented in this list.", - "x-ms-client-name": "firstId" - }, - "last_id": { - "type": "string", - "description": "The last ID represented in this list.", - "x-ms-client-name": "lastId" - }, - "has_more": { - "type": "boolean", - "description": "A value indicating whether there are additional values available not captured in this list.", - "x-ms-client-name": "hasMore" - } - }, - "required": [ - "object", - "data", - "first_id", - "last_id", - "has_more" - ] - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}/steps/{stepId}": { - "get": { - "operationId": "GetRunStep", - "description": "Gets a single run step from a thread run.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread that was run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the specific run to retrieve the step from.", - "required": true, - "type": "string" - }, - { - "name": "stepId", - "in": "path", - "description": "The ID of the step to retrieve information about.", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Information about the requested run step.", - "schema": { - "$ref": "#/definitions/RunStep" - } - } - } - } - }, - "/threads/{threadId}/runs/{runId}/submit_tool_outputs": { - "post": { - "operationId": "SubmitToolOutputsToRun", - "description": "Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'.", - "parameters": [ - { - "name": "threadId", - "in": "path", - "description": "The ID of the thread that was run.", - "required": true, - "type": "string" - }, - { - "name": "runId", - "in": "path", - "description": "The ID of the run that requires tool outputs.", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "tool_outputs": { - "type": "array", - "description": "A list of tools for which the outputs are being submitted.", - "items": { - "$ref": "#/definitions/ToolOutput" - }, - "x-ms-client-name": "toolOutputs", - "x-ms-identifiers": [] - }, - "stream": { - "type": "boolean", - "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.", - "x-nullable": true - } - }, - "required": [ - "tool_outputs" - ] - } - } - ], - "responses": { - "200": { - "description": "Updated information about the run.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - }, - "/threads/runs": { - "post": { - "operationId": "CreateThreadAndRun", - "description": "Creates a new assistant thread and immediately starts a run using that new thread.", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateAndRunThreadOptions" - } - } - ], - "responses": { - "200": { - "description": "Information about the newly created thread.", - "schema": { - "$ref": "#/definitions/ThreadRun" - } - } - } - } - } - }, - "definitions": { - "Assistant": { - "type": "object", - "description": "Represents an assistant that can call the model and use tools.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always assistant.", - "enum": [ - "assistant" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "name": { - "type": "string", - "description": "The name of the assistant.", - "x-nullable": true - }, - "description": { - "type": "string", - "description": "The description of the assistant.", - "x-nullable": true - }, - "model": { - "type": "string", - "description": "The ID of the model to use." - }, - "instructions": { - "type": "string", - "description": "The system instructions for the assistant to use.", - "x-nullable": true - }, - "tools": { - "type": "array", - "description": "The collection of tools enabled for the assistant.", - "default": [], - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "file_ids": { - "type": "array", - "description": "A list of attached file IDs, ordered by creation date in ascending order.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "created_at", - "name", - "description", - "model", - "instructions", - "tools", - "file_ids", - "metadata" - ] - }, - "AssistantCreationOptions": { - "type": "object", - "description": "The request details to use when creating a new assistant.", - "properties": { - "model": { - "type": "string", - "description": "The ID of the model to use." - }, - "name": { - "type": "string", - "description": "The name of the new assistant.", - "x-nullable": true - }, - "description": { - "type": "string", - "description": "The description of the new assistant.", - "x-nullable": true - }, - "instructions": { - "type": "string", - "description": "The system instructions for the new assistant to use.", - "x-nullable": true - }, - "tools": { - "type": "array", - "description": "The collection of tools to enable for the new assistant.", - "default": [], - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "file_ids": { - "type": "array", - "description": "A list of previously uploaded file IDs to attach to the assistant.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "model" - ] - }, - "AssistantDeletionStatus": { - "type": "object", - "description": "The status of an assistant deletion operation.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource specified for deletion." - }, - "deleted": { - "type": "boolean", - "description": "A value indicating whether deletion was successful." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'assistant.deleted'.", - "enum": [ - "assistant.deleted" - ], - "x-ms-enum": { - "modelAsString": false - } - } - }, - "required": [ - "id", - "deleted", - "object" - ] - }, - "AssistantFile": { - "type": "object", - "description": "Information about a file attached to an assistant, as used by tools that can read files.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'assistant.file'.", - "enum": [ - "assistant.file" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "assistant_id": { - "type": "string", - "description": "The assistant ID that the file is attached to.", - "x-ms-client-name": "assistantId" - } - }, - "required": [ - "id", - "object", - "created_at", - "assistant_id" - ] - }, - "AssistantFileDeletionStatus": { - "type": "object", - "description": "The status of an assistant file deletion operation.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource specified for deletion." - }, - "deleted": { - "type": "boolean", - "description": "A value indicating whether deletion was successful." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'assistant.file.deleted'.", - "enum": [ - "assistant.file.deleted" - ], - "x-ms-enum": { - "modelAsString": false - } - } - }, - "required": [ - "id", - "deleted", - "object" - ] - }, - "AssistantThread": { - "type": "object", - "description": "Information about a single thread associated with an assistant.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread'.", - "enum": [ - "thread" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "created_at", - "metadata" - ] - }, - "AssistantThreadCreationOptions": { - "type": "object", - "description": "The details used to create a new assistant thread.", - "properties": { - "messages": { - "type": "array", - "description": "The initial messages to associate with the new thread.", - "items": { - "$ref": "#/definitions/ThreadInitializationMessage" - }, - "x-ms-identifiers": [] - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - }, - "CodeInterpreterToolDefinition": { - "type": "object", - "description": "The input definition information for a code interpreter tool as used to configure an assistant.", - "allOf": [ - { - "$ref": "#/definitions/ToolDefinition" - } - ], - "x-ms-discriminator-value": "code_interpreter" - }, - "CreateAndRunThreadOptions": { - "type": "object", - "description": "The details used when creating and immediately running a new assistant thread.", - "properties": { - "assistant_id": { - "type": "string", - "description": "The ID of the assistant for which the thread should be created.", - "x-ms-client-name": "assistantId" - }, - "thread": { - "$ref": "#/definitions/AssistantThreadCreationOptions", - "description": "The details used to create the new thread. If no thread is provided, an empty one will be created." - }, - "model": { - "type": "string", - "description": "The overridden model that the assistant should use to run the thread.", - "x-nullable": true - }, - "instructions": { - "type": "string", - "description": "The overridden system instructions the assistant should use to run the thread.", - "x-nullable": true - }, - "tools": { - "type": "array", - "description": "The overridden list of enabled tools the assistant should use to run the thread.", - "x-nullable": true, - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "stream": { - "type": "boolean", - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "assistant_id" - ] - }, - "CreateRunOptions": { - "type": "object", - "description": "The details used when creating a new run of an assistant thread.", - "properties": { - "assistant_id": { - "type": "string", - "description": "The ID of the assistant that should run the thread.", - "x-ms-client-name": "assistantId" - }, - "model": { - "type": "string", - "description": "The overridden model name that the assistant should use to run the thread.", - "x-nullable": true - }, - "instructions": { - "type": "string", - "description": "The overridden system instructions that the assistant should use to run the thread.", - "x-nullable": true - }, - "additional_instructions": { - "type": "string", - "description": "Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior\non a per-run basis without overriding other instructions.", - "x-nullable": true, - "x-ms-client-name": "additionalInstructions" - }, - "tools": { - "type": "array", - "description": "The overridden list of enabled tools that the assistant should use to run the thread.", - "x-nullable": true, - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "stream": { - "type": "boolean", - "description": "If `true`, returns a stream of events that happen during the Run as server-sent events,\nterminating when the Run enters a terminal state with a `data: [DONE]` message." - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "assistant_id" - ] - }, - "FileDeletionStatus": { - "type": "object", - "description": "A status response from a file deletion operation.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource specified for deletion." - }, - "deleted": { - "type": "boolean", - "description": "A value indicating whether deletion was successful." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'file'.", - "enum": [ - "file" - ], - "x-ms-enum": { - "modelAsString": false - } - } - }, - "required": [ - "id", - "deleted", - "object" - ] - }, - "FileListResponse": { - "type": "object", - "description": "The response data from a file list operation.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always 'list'.", - "enum": [ - "list" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "data": { - "type": "array", - "description": "The files returned for the request.", - "items": { - "$ref": "#/definitions/OpenAIFile" - } - } - }, - "required": [ - "object", - "data" - ] - }, - "FilePurpose": { - "type": "string", - "description": "The possible values denoting the intended usage of a file.", - "enum": [ - "fine-tune", - "fine-tune-results", - "assistants", - "assistants_output" - ], - "x-ms-enum": { - "name": "FilePurpose", - "modelAsString": true, - "values": [ - { - "name": "fineTune", - "value": "fine-tune", - "description": "Indicates a file is used for fine tuning input." - }, - { - "name": "fineTuneResults", - "value": "fine-tune-results", - "description": "Indicates a file is used for fine tuning results." - }, - { - "name": "assistants", - "value": "assistants", - "description": "Indicates a file is used as input to assistants." - }, - { - "name": "assistantsOutput", - "value": "assistants_output", - "description": "Indicates a file is used as output by assistants." - } - ] - } - }, - "FunctionDefinition": { - "type": "object", - "description": "The input definition information for a function.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function to be called." - }, - "description": { - "type": "string", - "description": "A description of what the function does, used by the model to choose when and how to call the function." - }, - "parameters": { - "description": "The parameters the functions accepts, described as a JSON Schema object." - } - }, - "required": [ - "name", - "parameters" - ] - }, - "FunctionToolDefinition": { - "type": "object", - "description": "The input definition information for a function tool as used to configure an assistant.", - "properties": { - "function": { - "$ref": "#/definitions/FunctionDefinition", - "description": "The definition of the concrete function that the function tool should call." - } - }, - "required": [ - "function" - ], - "allOf": [ - { - "$ref": "#/definitions/ToolDefinition" - } - ], - "x-ms-discriminator-value": "function" - }, - "IncompleteRunDetails": { - "type": "string", - "description": "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.", - "enum": [ - "max_completion_tokens", - "max_prompt_tokens" - ], - "x-ms-enum": { - "name": "IncompleteRunDetails", - "modelAsString": true, - "values": [ - { - "name": "maxCompletionTokens", - "value": "max_completion_tokens", - "description": "Maximum completion tokens exceeded" - }, - { - "name": "maxPromptTokens", - "value": "max_prompt_tokens", - "description": "Maximum prompt tokens exceeded" - } - ] - } - }, - "MessageContent": { - "type": "object", - "description": "An abstract representation of a single item of thread message content.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "MessageFile": { - "type": "object", - "description": "Information about a file attached to an assistant thread message.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.message.file'.", - "enum": [ - "thread.message.file" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "message_id": { - "type": "string", - "description": "The ID of the message that this file is attached to.", - "x-ms-client-name": "messageId" - } - }, - "required": [ - "id", - "object", - "created_at", - "message_id" - ] - }, - "MessageImageFileContent": { - "type": "object", - "description": "A representation of image file content in a thread message.", - "properties": { - "image_file": { - "$ref": "#/definitions/MessageImageFileDetails", - "description": "The image file for this thread message content item.", - "x-ms-client-name": "imageFile" - } - }, - "required": [ - "image_file" - ], - "allOf": [ - { - "$ref": "#/definitions/MessageContent" - } - ], - "x-ms-discriminator-value": "image_file" - }, - "MessageImageFileDetails": { - "type": "object", - "description": "An image reference, as represented in thread message content.", - "properties": { - "file_id": { - "type": "string", - "description": "The ID for the file associated with this image.", - "x-ms-client-name": "fileId" - } - }, - "required": [ - "file_id" - ] - }, - "MessageIncompleteDetailsReason": { - "type": "string", - "description": "A set of reasons describing why a message is marked as incomplete.", - "enum": [ - "content_filter", - "max_tokens", - "run_cancelled", - "run_failed", - "run_expired" - ], - "x-ms-enum": { - "name": "MessageIncompleteDetailsReason", - "modelAsString": true, - "values": [ - { - "name": "contentFilter", - "value": "content_filter", - "description": "The run generating the message was terminated due to content filter flagging." - }, - { - "name": "maxTokens", - "value": "max_tokens", - "description": "The run generating the message exhausted available tokens before completion." - }, - { - "name": "runCancelled", - "value": "run_cancelled", - "description": "The run generating the message was cancelled before completion." - }, - { - "name": "runFailed", - "value": "run_failed", - "description": "The run generating the message failed." - }, - { - "name": "runExpired", - "value": "run_expired", - "description": "The run generating the message expired." - } - ] - } - }, - "MessageRole": { - "type": "string", - "description": "The possible values for roles attributed to messages in a thread.", - "enum": [ - "user", - "assistant" - ], - "x-ms-enum": { - "name": "MessageRole", - "modelAsString": true, - "values": [ - { - "name": "user", - "value": "user", - "description": "The role representing the end-user." - }, - { - "name": "assistant", - "value": "assistant", - "description": "The role representing the assistant." - } - ] - } - }, - "MessageStatus": { - "type": "string", - "description": "The possible execution status values for a thread message.", - "enum": [ - "in_progress", - "incomplete", - "completed" - ], - "x-ms-enum": { - "name": "MessageStatus", - "modelAsString": true, - "values": [ - { - "name": "inProgress", - "value": "in_progress", - "description": "A run is currently creating this message." - }, - { - "name": "incomplete", - "value": "incomplete", - "description": "This message is incomplete. See incomplete_details for more information." - }, - { - "name": "completed", - "value": "completed", - "description": "This message was successfully completed by a run." - } - ] - } - }, - "MessageTextAnnotation": { - "type": "object", - "description": "An abstract representation of an annotation to text thread message content.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - }, - "text": { - "type": "string", - "description": "The textual content associated with this text annotation item." - } - }, - "discriminator": "type", - "required": [ - "type", - "text" - ] - }, - "MessageTextContent": { - "type": "object", - "description": "A representation of a textual item of thread message content.", - "properties": { - "text": { - "$ref": "#/definitions/MessageTextDetails", - "description": "The text and associated annotations for this thread message content item." - } - }, - "required": [ - "text" - ], - "allOf": [ - { - "$ref": "#/definitions/MessageContent" - } - ], - "x-ms-discriminator-value": "text" - }, - "MessageTextDetails": { - "type": "object", - "description": "The text and associated annotations for a single item of assistant thread message content.", - "properties": { - "value": { - "type": "string", - "description": "The text data." - }, - "annotations": { - "type": "array", - "description": "A list of annotations associated with this text.", - "items": { - "$ref": "#/definitions/MessageTextAnnotation" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "value", - "annotations" - ] - }, - "MessageTextFileCitationAnnotation": { - "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": { - "file_citation": { - "$ref": "#/definitions/MessageTextFileCitationDetails", - "description": "A citation within the message that points to a specific quote from a specific file.\nGenerated when the assistant uses the \"retrieval\" tool to search files.", - "x-ms-client-name": "fileCitation" - }, - "start_index": { - "type": "integer", - "format": "int32", - "description": "The first text index associated with this text annotation.", - "x-ms-client-name": "startIndex" - }, - "end_index": { - "type": "integer", - "format": "int32", - "description": "The last text index associated with this text annotation.", - "x-ms-client-name": "endIndex" - } - }, - "required": [ - "file_citation" - ], - "allOf": [ - { - "$ref": "#/definitions/MessageTextAnnotation" - } - ], - "x-ms-discriminator-value": "file_citation" - }, - "MessageTextFileCitationDetails": { - "type": "object", - "description": "A representation of a file-based text citation, as used in a file-based annotation of text thread message content.", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file associated with this citation.", - "x-ms-client-name": "fileId" - }, - "quote": { - "type": "string", - "description": "The specific quote cited in the associated file." - } - }, - "required": [ - "file_id", - "quote" - ] - }, - "MessageTextFilePathAnnotation": { - "type": "object", - "description": "A citation within the message that points to a file located at a specific path.", - "properties": { - "file_path": { - "$ref": "#/definitions/MessageTextFilePathDetails", - "description": "A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.", - "x-ms-client-name": "filePath" - }, - "start_index": { - "type": "integer", - "format": "int32", - "description": "The first text index associated with this text annotation.", - "x-ms-client-name": "startIndex" - }, - "end_index": { - "type": "integer", - "format": "int32", - "description": "The last text index associated with this text annotation.", - "x-ms-client-name": "endIndex" - } - }, - "required": [ - "file_path" - ], - "allOf": [ - { - "$ref": "#/definitions/MessageTextAnnotation" - } - ], - "x-ms-discriminator-value": "file_path" - }, - "MessageTextFilePathDetails": { - "type": "object", - "description": "An encapsulation of an image file ID, as used by message image content.", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the specific file that the citation is from.", - "x-ms-client-name": "fileId" - } - }, - "required": [ - "file_id" - ] - }, - "OpenAIFile": { - "type": "object", - "description": "Represents an assistant that can call the model and use tools.", - "properties": { - "object": { - "type": "string", - "description": "The object type, which is always 'file'.", - "enum": [ - "file" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "bytes": { - "type": "integer", - "format": "int32", - "description": "The size of the file, in bytes." - }, - "filename": { - "type": "string", - "description": "The name of the file." - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "purpose": { - "$ref": "#/definitions/FilePurpose", - "description": "The intended purpose of a file." - } - }, - "required": [ - "object", - "id", - "bytes", - "filename", - "created_at", - "purpose" - ] - }, - "RequiredAction": { - "type": "object", - "description": "An abstract representation of a required action for an assistant thread run to continue.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "RequiredFunctionToolCall": { - "type": "object", - "description": "A representation of a requested call to a function tool, needed by the model to continue evaluation of a run.", - "properties": { - "function": { - "$ref": "#/definitions/RequiredFunctionToolCallDetails", - "description": "Detailed information about the function to be executed by the tool that includes name and arguments." - } - }, - "required": [ - "function" - ], - "allOf": [ - { - "$ref": "#/definitions/RequiredToolCall" - } - ], - "x-ms-discriminator-value": "function" - }, - "RequiredFunctionToolCallDetails": { - "type": "object", - "description": "The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." - }, - "arguments": { - "type": "string", - "description": "The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation." - } - }, - "required": [ - "name", - "arguments" - ] - }, - "RequiredToolCall": { - "type": "object", - "description": "An abstract representation a a tool invocation needed by the model to continue a run.", - "properties": { - "type": { - "type": "string", - "description": "The object type for the required tool call." - }, - "id": { - "type": "string", - "description": "The ID of the tool call. This ID must be referenced when submitting tool outputs." - } - }, - "discriminator": "type", - "required": [ - "type", - "id" - ] - }, - "RetrievalToolDefinition": { - "type": "object", - "description": "The input definition information for a retrieval tool as used to configure an assistant.", - "allOf": [ - { - "$ref": "#/definitions/ToolDefinition" - } - ], - "x-ms-discriminator-value": "retrieval" - }, - "RunCompletionUsage": { - "type": "object", - "description": "Usage statistics related to the run.", - "properties": { - "completion_tokens": { - "type": "integer", - "format": "int64", - "description": "Number of completion tokens used over the course of the run.", - "x-ms-client-name": "completionTokens" - }, - "prompt_tokens": { - "type": "integer", - "format": "int64", - "description": "Number of prompt tokens used over the course of the run.", - "x-ms-client-name": "promptTokens" - }, - "total_tokens": { - "type": "integer", - "format": "int64", - "description": "Total number of tokens used (prompt + completion).", - "x-ms-client-name": "totalTokens" - } - }, - "required": [ - "completion_tokens", - "prompt_tokens", - "total_tokens" - ] - }, - "RunError": { - "type": "object", - "description": "The details of an error as encountered by an assistant thread run.", - "properties": { - "code": { - "type": "string", - "description": "The status for the error." - }, - "message": { - "type": "string", - "description": "The human-readable text associated with the error." - } - }, - "required": [ - "code", - "message" - ] - }, - "RunStatus": { - "type": "string", - "description": "Possible values for the status of an assistant thread run.", - "enum": [ - "queued", - "in_progress", - "requires_action", - "cancelling", - "cancelled", - "failed", - "completed", - "expired" - ], - "x-ms-enum": { - "name": "RunStatus", - "modelAsString": true, - "values": [ - { - "name": "queued", - "value": "queued", - "description": "Represents a run that is queued to start." - }, - { - "name": "inProgress", - "value": "in_progress", - "description": "Represents a run that is in progress." - }, - { - "name": "requiresAction", - "value": "requires_action", - "description": "Represents a run that needs another operation, such as tool output submission, to continue." - }, - { - "name": "cancelling", - "value": "cancelling", - "description": "Represents a run that is in the process of cancellation." - }, - { - "name": "cancelled", - "value": "cancelled", - "description": "Represents a run that has been cancelled." - }, - { - "name": "failed", - "value": "failed", - "description": "Represents a run that failed." - }, - { - "name": "completed", - "value": "completed", - "description": "Represents a run that successfully completed." - }, - { - "name": "expired", - "value": "expired", - "description": "Represents a run that expired before it could otherwise finish." - } - ] - } - }, - "RunStep": { - "type": "object", - "description": "Detailed information about a single step of an assistant thread run.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.run.step'.", - "enum": [ - "thread.run.step" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "type": { - "$ref": "#/definitions/RunStepType", - "description": "The type of run step, which can be either message_creation or tool_calls." - }, - "assistant_id": { - "type": "string", - "description": "The ID of the assistant associated with the run step.", - "x-ms-client-name": "assistantId" - }, - "thread_id": { - "type": "string", - "description": "The ID of the thread that was run.", - "x-ms-client-name": "threadId" - }, - "run_id": { - "type": "string", - "description": "The ID of the run that this run step is a part of.", - "x-ms-client-name": "runId" - }, - "status": { - "$ref": "#/definitions/RunStepStatus", - "description": "The status of this run step." - }, - "step_details": { - "$ref": "#/definitions/RunStepDetails", - "description": "The details for this run step.", - "x-ms-client-name": "stepDetails" - }, - "last_error": { - "type": "object", - "description": "If applicable, information about the last error encountered by this run step.", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RunStepError" - } - ], - "x-ms-client-name": "lastError" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "expired_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this item expired.", - "x-nullable": true, - "x-ms-client-name": "expiredAt" - }, - "completed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this completed.", - "x-nullable": true, - "x-ms-client-name": "completedAt" - }, - "cancelled_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this was cancelled.", - "x-nullable": true, - "x-ms-client-name": "cancelledAt" - }, - "failed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this failed.", - "x-nullable": true, - "x-ms-client-name": "failedAt" - }, - "usage": { - "type": "object", - "description": "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RunStepCompletionUsage" - } - ] - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "type", - "assistant_id", - "thread_id", - "run_id", - "status", - "step_details", - "last_error", - "created_at", - "expired_at", - "completed_at", - "cancelled_at", - "failed_at", - "metadata" - ] - }, - "RunStepCodeInterpreterImageOutput": { - "type": "object", - "description": "A representation of an image output emitted by a code interpreter tool in response to a tool call by the model.", - "properties": { - "image": { - "$ref": "#/definitions/RunStepCodeInterpreterImageReference", - "description": "Referential information for the image associated with this output." - } - }, - "required": [ - "image" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" - } - ], - "x-ms-discriminator-value": "image" - }, - "RunStepCodeInterpreterImageReference": { - "type": "object", - "description": "An image reference emitted by a code interpreter tool in response to a tool call by the model.", - "properties": { - "file_id": { - "type": "string", - "description": "The ID of the file associated with this image.", - "x-ms-client-name": "fileId" - } - }, - "required": [ - "file_id" - ] - }, - "RunStepCodeInterpreterLogOutput": { - "type": "object", - "description": "A representation of a log output emitted by a code interpreter tool in response to a tool call by the model.", - "properties": { - "logs": { - "type": "string", - "description": "The serialized log output emitted by the code interpreter." - } - }, - "required": [ - "logs" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" - } - ], - "x-ms-discriminator-value": "logs" - }, - "RunStepCodeInterpreterToolCall": { - "type": "object", - "description": "A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that\nrepresents inputs and outputs consumed and emitted by the code interpreter.", - "properties": { - "code_interpreter": { - "$ref": "#/definitions/RunStepCodeInterpreterToolCallDetails", - "description": "The details of the tool call to the code interpreter tool.", - "x-ms-client-name": "codeInterpreter" - } - }, - "required": [ - "code_interpreter" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepToolCall" - } - ], - "x-ms-discriminator-value": "code_interpreter" - }, - "RunStepCodeInterpreterToolCallDetails": { - "type": "object", - "description": "The detailed information about a code interpreter invocation by the model.", - "properties": { - "input": { - "type": "string", - "description": "The input provided by the model to the code interpreter tool." - }, - "outputs": { - "type": "array", - "description": "The outputs produced by the code interpreter tool back to the model in response to the tool call.", - "items": { - "$ref": "#/definitions/RunStepCodeInterpreterToolCallOutput" - }, - "x-ms-identifiers": [] - } - }, - "required": [ - "input", - "outputs" - ] - }, - "RunStepCodeInterpreterToolCallOutput": { - "type": "object", - "description": "An abstract representation of an emitted output from a code interpreter tool.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "RunStepCompletionUsage": { - "type": "object", - "description": "Usage statistics related to the run step.", - "properties": { - "completion_tokens": { - "type": "integer", - "format": "int64", - "description": "Number of completion tokens used over the course of the run step.", - "x-ms-client-name": "completionTokens" - }, - "prompt_tokens": { - "type": "integer", - "format": "int64", - "description": "Number of prompt tokens used over the course of the run step.", - "x-ms-client-name": "promptTokens" - }, - "total_tokens": { - "type": "integer", - "format": "int64", - "description": "Total number of tokens used (prompt + completion).", - "x-ms-client-name": "totalTokens" - } - }, - "required": [ - "completion_tokens", - "prompt_tokens", - "total_tokens" - ] - }, - "RunStepDetails": { - "type": "object", - "description": "An abstract representation of the details for a run step.", - "properties": { - "type": { - "$ref": "#/definitions/RunStepType", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "RunStepError": { - "type": "object", - "description": "The error information associated with a failed run step.", - "properties": { - "code": { - "$ref": "#/definitions/RunStepErrorCode", - "description": "The error code for this error." - }, - "message": { - "type": "string", - "description": "The human-readable text associated with this error." - } - }, - "required": [ - "code", - "message" - ] - }, - "RunStepErrorCode": { - "type": "string", - "description": "Possible error code values attributable to a failed run step.", - "enum": [ - "server_error", - "rate_limit_exceeded" - ], - "x-ms-enum": { - "name": "RunStepErrorCode", - "modelAsString": true, - "values": [ - { - "name": "serverError", - "value": "server_error", - "description": "Represents a server error." - }, - { - "name": "rateLimitExceeded", - "value": "rate_limit_exceeded", - "description": "Represents an error indicating configured rate limits were exceeded." - } - ] - } - }, - "RunStepFunctionToolCall": { - "type": "object", - "description": "A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs\nand output consumed and emitted by the specified function.", - "properties": { - "function": { - "$ref": "#/definitions/RunStepFunctionToolCallDetails", - "description": "The detailed information about the function called by the model." - } - }, - "required": [ - "function" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepToolCall" - } - ], - "x-ms-discriminator-value": "function" - }, - "RunStepFunctionToolCallDetails": { - "type": "object", - "description": "The detailed information about the function called by the model.", - "properties": { - "name": { - "type": "string", - "description": "The name of the function." - }, - "arguments": { - "type": "string", - "description": "The arguments that the model requires are provided to the named function." - }, - "output": { - "type": "string", - "description": "The output of the function, only populated for function calls that have already have had their outputs submitted.", - "x-nullable": true - } - }, - "required": [ - "name", - "arguments", - "output" - ] - }, - "RunStepMessageCreationDetails": { - "type": "object", - "description": "The detailed information associated with a message creation run step.", - "properties": { - "message_creation": { - "$ref": "#/definitions/RunStepMessageCreationReference", - "description": "Information about the message creation associated with this run step.", - "x-ms-client-name": "messageCreation" - } - }, - "required": [ - "message_creation" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepDetails" - } - ], - "x-ms-discriminator-value": "message_creation" - }, - "RunStepMessageCreationReference": { - "type": "object", - "description": "The details of a message created as a part of a run step.", - "properties": { - "message_id": { - "type": "string", - "description": "The ID of the message created by this run step.", - "x-ms-client-name": "messageId" - } - }, - "required": [ - "message_id" - ] - }, - "RunStepRetrievalToolCall": { - "type": "object", - "description": "A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents\nexecuted retrieval actions.", - "properties": { - "retrieval": { - "type": "object", - "description": "The key/value pairs produced by the retrieval tool.", - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "retrieval" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepToolCall" - } - ], - "x-ms-discriminator-value": "retrieval" - }, - "RunStepStatus": { - "type": "string", - "description": "Possible values for the status of a run step.", - "enum": [ - "in_progress", - "cancelled", - "failed", - "completed", - "expired" - ], - "x-ms-enum": { - "name": "RunStepStatus", - "modelAsString": true, - "values": [ - { - "name": "inProgress", - "value": "in_progress", - "description": "Represents a run step still in progress." - }, - { - "name": "cancelled", - "value": "cancelled", - "description": "Represents a run step that was cancelled." - }, - { - "name": "failed", - "value": "failed", - "description": "Represents a run step that failed." - }, - { - "name": "completed", - "value": "completed", - "description": "Represents a run step that successfully completed." - }, - { - "name": "expired", - "value": "expired", - "description": "Represents a run step that expired before otherwise finishing." - } - ] - } - }, - "RunStepToolCall": { - "type": "object", - "description": "An abstract representation of a detailed tool call as recorded within a run step for an existing run.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - }, - "id": { - "type": "string", - "description": "The ID of the tool call. This ID must be referenced when you submit tool outputs." - } - }, - "discriminator": "type", - "required": [ - "type", - "id" - ] - }, - "RunStepToolCallDetails": { - "type": "object", - "description": "The detailed information associated with a run step calling tools.", - "properties": { - "tool_calls": { - "type": "array", - "description": "A list of tool call details for this run step.", - "items": { - "$ref": "#/definitions/RunStepToolCall" - }, - "x-ms-client-name": "toolCalls" - } - }, - "required": [ - "tool_calls" - ], - "allOf": [ - { - "$ref": "#/definitions/RunStepDetails" - } - ], - "x-ms-discriminator-value": "tool_calls" - }, - "RunStepType": { - "type": "string", - "description": "The possible types of run steps.", - "enum": [ - "message_creation", - "tool_calls" - ], - "x-ms-enum": { - "name": "RunStepType", - "modelAsString": true, - "values": [ - { - "name": "messageCreation", - "value": "message_creation", - "description": "Represents a run step to create a message." - }, - { - "name": "toolCalls", - "value": "tool_calls", - "description": "Represents a run step that calls tools." - } - ] - } - }, - "SubmitToolOutputsAction": { - "type": "object", - "description": "The details for required tool calls that must be submitted for an assistant thread run to continue.", - "properties": { - "submit_tool_outputs": { - "$ref": "#/definitions/SubmitToolOutputsDetails", - "description": "The details describing tools that should be called to submit tool outputs.", - "x-ms-client-name": "submitToolOutputs" - } - }, - "required": [ - "submit_tool_outputs" - ], - "allOf": [ - { - "$ref": "#/definitions/RequiredAction" - } - ], - "x-ms-discriminator-value": "submit_tool_outputs" - }, - "SubmitToolOutputsDetails": { - "type": "object", - "description": "The details describing tools that should be called to submit tool outputs.", - "properties": { - "tool_calls": { - "type": "array", - "description": "The list of tool calls that must be resolved for the assistant thread run to continue.", - "items": { - "$ref": "#/definitions/RequiredToolCall" - }, - "x-ms-client-name": "toolCalls" - } - }, - "required": [ - "tool_calls" - ] - }, - "ThreadDeletionStatus": { - "type": "object", - "description": "The status of a thread deletion operation.", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource specified for deletion." - }, - "deleted": { - "type": "boolean", - "description": "A value indicating whether deletion was successful." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.deleted'.", - "enum": [ - "thread.deleted" - ], - "x-ms-enum": { - "modelAsString": false - } - } - }, - "required": [ - "id", - "deleted", - "object" - ] - }, - "ThreadInitializationMessage": { - "type": "object", - "description": "A single message within an assistant thread, as provided during that thread's creation for its initial state.", - "properties": { - "role": { - "$ref": "#/definitions/MessageRole", - "description": "The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread." - }, - "content": { - "type": "string", - "description": "The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API." - }, - "file_ids": { - "type": "array", - "description": "A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can\naccess files.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "role", - "content" - ] - }, - "ThreadMessage": { - "type": "object", - "description": "A single, existing message within an assistant thread.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.message'.", - "enum": [ - "thread.message" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "thread_id": { - "type": "string", - "description": "The ID of the thread that this message belongs to.", - "x-ms-client-name": "threadId" - }, - "status": { - "$ref": "#/definitions/MessageStatus", - "description": "The status of the message." - }, - "incomplete_details": { - "$ref": "#/definitions/MessageIncompleteDetailsReason", - "description": "On an incomplete message, details about why the message is incomplete.", - "x-nullable": true, - "x-ms-client-name": "incompleteDetails" - }, - "completed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the message was completed.", - "x-nullable": true, - "x-ms-client-name": "completedAt" - }, - "incomplete_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.", - "x-nullable": true, - "x-ms-client-name": "incompleteAt" - }, - "role": { - "$ref": "#/definitions/MessageRole", - "description": "The role associated with the assistant thread message." - }, - "content": { - "type": "array", - "description": "The list of content items associated with the assistant thread message.", - "items": { - "$ref": "#/definitions/MessageContent" - }, - "x-ms-identifiers": [] - }, - "assistant_id": { - "type": "string", - "description": "If applicable, the ID of the assistant that authored this message.", - "x-ms-client-name": "assistantId" - }, - "run_id": { - "type": "string", - "description": "If applicable, the ID of the run associated with the authoring of this message.", - "x-ms-client-name": "runId" - }, - "file_ids": { - "type": "array", - "description": "A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can\naccess files.", - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "created_at", - "thread_id", - "status", - "incomplete_details", - "completed_at", - "incomplete_at", - "role", - "content", - "file_ids", - "metadata" - ] - }, - "ThreadRun": { - "type": "object", - "description": "Data representing a single evaluation run of an assistant thread.", - "properties": { - "id": { - "type": "string", - "description": "The identifier, which can be referenced in API endpoints." - }, - "object": { - "type": "string", - "description": "The object type, which is always 'thread.run'.", - "enum": [ - "thread.run" - ], - "x-ms-enum": { - "modelAsString": false - } - }, - "thread_id": { - "type": "string", - "description": "The ID of the thread associated with this run.", - "x-ms-client-name": "threadId" - }, - "assistant_id": { - "type": "string", - "description": "The ID of the assistant associated with the thread this run was performed against.", - "x-ms-client-name": "assistantId" - }, - "status": { - "$ref": "#/definitions/RunStatus", - "description": "The status of the assistant thread run." - }, - "required_action": { - "type": "object", - "description": "The details of the action required for the assistant thread run to continue.", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RequiredAction" - } - ], - "x-ms-client-name": "requiredAction" - }, - "last_error": { - "type": "object", - "description": "The last error, if any, encountered by this assistant thread run.", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RunError" - } - ], - "x-ms-client-name": "lastError" - }, - "model": { - "type": "string", - "description": "The ID of the model to use." - }, - "instructions": { - "type": "string", - "description": "The overridden system instructions used for this assistant thread run." - }, - "tools": { - "type": "array", - "description": "The overridden enabled tools used for this assistant thread run.", - "default": [], - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "file_ids": { - "type": "array", - "description": "A list of attached file IDs, ordered by creation date in ascending order.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "created_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this object was created.", - "x-ms-client-name": "createdAt" - }, - "expires_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this item expires.", - "x-nullable": true, - "x-ms-client-name": "expiresAt" - }, - "started_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this item was started.", - "x-nullable": true, - "x-ms-client-name": "startedAt" - }, - "completed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this completed.", - "x-nullable": true, - "x-ms-client-name": "completedAt" - }, - "cancelled_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this was cancelled.", - "x-nullable": true, - "x-ms-client-name": "cancelledAt" - }, - "failed_at": { - "type": "integer", - "format": "unixtime", - "description": "The Unix timestamp, in seconds, representing when this failed.", - "x-nullable": true, - "x-ms-client-name": "failedAt" - }, - "incomplete_details": { - "$ref": "#/definitions/IncompleteRunDetails", - "description": "Details on why the run is incomplete. Will be `null` if the run is not incomplete.", - "x-nullable": true, - "x-ms-client-name": "incompleteDetails" - }, - "usage": { - "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.).", - "x-nullable": true, - "allOf": [ - { - "$ref": "#/definitions/RunCompletionUsage" - } - ] - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - }, - "required": [ - "id", - "object", - "thread_id", - "assistant_id", - "status", - "last_error", - "model", - "instructions", - "tools", - "file_ids", - "created_at", - "expires_at", - "started_at", - "completed_at", - "cancelled_at", - "failed_at", - "incomplete_details", - "usage", - "metadata" - ] - }, - "ToolDefinition": { - "type": "object", - "description": "An abstract representation of an input tool definition that an assistant can use.", - "properties": { - "type": { - "type": "string", - "description": "The object type." - } - }, - "discriminator": "type", - "required": [ - "type" - ] - }, - "ToolOutput": { - "type": "object", - "description": "The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue.", - "properties": { - "tool_call_id": { - "type": "string", - "description": "The ID of the tool call being resolved, as provided in the tool calls of a required action from a run.", - "x-ms-client-name": "toolCallId" - }, - "output": { - "type": "string", - "description": "The output from the tool to be submitted." - } - } - }, - "UpdateAssistantOptions": { - "type": "object", - "description": "The request details to use when modifying an existing assistant.", - "properties": { - "model": { - "type": "string", - "description": "The ID of the model to use." - }, - "name": { - "type": "string", - "description": "The modified name for the assistant to use.", - "x-nullable": true - }, - "description": { - "type": "string", - "description": "The modified description for the assistant to use.", - "x-nullable": true - }, - "instructions": { - "type": "string", - "description": "The modified system instructions for the new assistant to use.", - "x-nullable": true - }, - "tools": { - "type": "array", - "description": "The modified collection of tools to enable for the assistant.", - "default": [], - "items": { - "$ref": "#/definitions/ToolDefinition" - }, - "x-ms-identifiers": [] - }, - "file_ids": { - "type": "array", - "description": "The modified list of previously uploaded fileIDs to attach to the assistant.", - "default": [], - "items": { - "type": "string" - }, - "x-ms-client-name": "fileIds" - }, - "metadata": { - "type": "object", - "description": "A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - } - } - } - }, - "parameters": { - "UpdateAssistantOptions.assistantId": { - "name": "assistantId", - "in": "path", - "description": "The ID of the assistant to modify.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - } - } -} diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index 8e4dbdc9e433..cd143ef725b9 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -2812,7 +2812,6 @@ components: type: string enum: - 2024-02-15-preview - - 2024-05-01-preview description: The known set of supported API versions. SubmitToolOutputsAction: type: object diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml deleted file mode 100644 index 66b1d565320d..000000000000 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml +++ /dev/null @@ -1,3177 +0,0 @@ -openapi: 3.0.0 -info: - title: Azure OpenAI - description: Azure OpenAI APIs for Assistants. - version: 2024-05-01-preview -tags: [] -paths: - /assistants: - post: - operationId: createAssistant - description: Creates a new assistant. - parameters: [] - responses: - '200': - description: The new assistant instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Assistant' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantCreationOptions' - get: - operationId: listAssistants - description: Gets a list of assistants that were previously created. - parameters: - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of assistants. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/Assistant' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /assistants/{assistantId}: - get: - operationId: getAssistant - description: Retrieves an existing assistant. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant to retrieve. - schema: - type: string - responses: - '200': - description: The requested assistant instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Assistant' - post: - operationId: updateAssistant - description: Modifies an existing assistant. - parameters: - - $ref: '#/components/parameters/UpdateAssistantOptions.assistantId' - responses: - '200': - description: The updated assistant instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Assistant' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateAssistantOptions' - delete: - operationId: deleteAssistant - description: Deletes an assistant. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant to delete. - schema: - type: string - responses: - '200': - description: Status information about the requested deletion operation. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantDeletionStatus' - /assistants/{assistantId}/files: - post: - operationId: createAssistantFile - description: Attaches a previously uploaded file to an assistant for use by tools that can read files. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant to attach the file to. - schema: - type: string - responses: - '200': - description: Information about the attached file. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantFile' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - file_id: - type: string - description: The ID of the previously uploaded file to attach. - required: - - file_id - get: - operationId: listAssistantFiles - description: Gets a list of files attached to a specific assistant, as used by tools that can read files. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant to retrieve the list of attached files for. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of files attached to the specified assistant. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/AssistantFile' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /assistants/{assistantId}/files/{fileId}: - get: - operationId: getAssistantFile - description: Retrieves a file attached to an assistant. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant associated with the attached file. - schema: - type: string - - name: fileId - in: path - required: true - description: The ID of the file to retrieve. - schema: - type: string - responses: - '200': - description: A representation of the attached file. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantFile' - delete: - operationId: deleteAssistantFile - description: |- - Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read - files. - parameters: - - name: assistantId - in: path - required: true - description: The ID of the assistant from which the specified file should be unlinked. - schema: - type: string - - name: fileId - in: path - required: true - description: The ID of the file to unlink from the specified assistant. - schema: - type: string - responses: - '200': - description: Status information about the requested file association deletion. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantFileDeletionStatus' - /files: - get: - operationId: listFiles - description: Gets a list of previously uploaded files. - parameters: - - name: purpose - in: query - required: false - description: A value that, when provided, limits list results to files matching the corresponding purpose. - schema: - $ref: '#/components/schemas/FilePurpose' - responses: - '200': - description: The requested list of files. - content: - application/json: - schema: - $ref: '#/components/schemas/FileListResponse' - post: - operationId: uploadFile - description: Uploads a file for use by other operations. - parameters: [] - responses: - '200': - description: A representation of the uploaded file. - content: - application/json: - schema: - $ref: '#/components/schemas/OpenAIFile' - requestBody: - required: true - content: - multipart/form-data: - schema: - type: object - properties: - file: - type: string - format: binary - purpose: - allOf: - - $ref: '#/components/schemas/FilePurpose' - description: The intended purpose of the file. - filename: - type: string - description: A filename to associate with the uploaded data. - required: - - file - - purpose - /files/{fileId}: - delete: - operationId: deleteFile - description: Delete a previously uploaded file. - parameters: - - name: fileId - in: path - required: true - description: The ID of the file to delete. - schema: - type: string - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/FileDeletionStatus' - get: - operationId: getFile - description: Returns information about a specific file. Does not retrieve file content. - parameters: - - name: fileId - in: path - required: true - description: The ID of the file to retrieve. - schema: - type: string - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - $ref: '#/components/schemas/OpenAIFile' - /files/{fileId}/content: - get: - operationId: getFileContent - description: Returns information about a specific file. Does not retrieve file content. - parameters: - - name: fileId - in: path - required: true - description: The ID of the file to retrieve. - schema: - type: string - responses: - '200': - description: The request has succeeded. - content: - application/json: - schema: - type: string - format: byte - /threads: - post: - operationId: createThread - description: Creates a new thread. Threads contain messages and can be run by assistants. - parameters: [] - responses: - '200': - description: Information about the newly created thread. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantThread' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantThreadCreationOptions' - /threads/runs: - post: - operationId: createThreadAndRun - description: Creates a new assistant thread and immediately starts a run using that new thread. - parameters: [] - responses: - '200': - description: Information about the newly created thread. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CreateAndRunThreadOptions' - /threads/{threadId}: - get: - operationId: getThread - description: Gets information about an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to retrieve information about. - schema: - type: string - responses: - '200': - description: Information about the requested thread. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantThread' - post: - operationId: updateThread - description: Modifies an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to modify. - schema: - type: string - responses: - '200': - description: Information about the modified thread. - content: - application/json: - schema: - $ref: '#/components/schemas/AssistantThread' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - delete: - operationId: deleteThread - description: Deletes an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to delete. - schema: - type: string - responses: - '200': - description: Status information about the requested thread deletion operation. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadDeletionStatus' - /threads/{threadId}/messages: - post: - operationId: createMessage - description: Creates a new message on a specified thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to create the new message on. - schema: - type: string - responses: - '200': - description: A representation of the new message. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadMessage' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - role: - allOf: - - $ref: '#/components/schemas/MessageRole' - description: The role to associate with the new message. - content: - type: string - description: The textual content for the new message. - file_ids: - type: array - items: - type: string - description: A list of up to 10 file IDs to associate with the message, as used by tools like 'code_interpreter' or 'retrieval' that can read files. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - required: - - role - - content - get: - operationId: listMessages - description: Gets a list of messages that exist on a thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to list messages from. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of messages. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/ThreadMessage' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /threads/{threadId}/messages/{messageId}: - get: - operationId: getMessage - description: Gets an existing message from an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to retrieve the specified message from. - schema: - type: string - - name: messageId - in: path - required: true - description: The ID of the message to retrieve from the specified thread. - schema: - type: string - responses: - '200': - description: A representation of the requested message. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadMessage' - post: - operationId: updateMessage - description: Modifies an existing message on an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread containing the specified message to modify. - schema: - type: string - - name: messageId - in: path - required: true - description: The ID of the message to modify on the specified thread. - schema: - type: string - responses: - '200': - description: A representation of the modified message. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadMessage' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /threads/{threadId}/messages/{messageId}/files: - get: - operationId: listMessageFiles - description: Gets a list of previously uploaded files associated with a message from a thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread containing the message to list files from. - schema: - type: string - - name: messageId - in: path - required: true - description: The ID of the message to list files from. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of files associated with the specified message. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/MessageFile' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /threads/{threadId}/messages/{messageId}/files/{fileId}: - get: - operationId: getMessageFile - description: Gets information about a file attachment to a message within a thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread containing the message to get information from. - schema: - type: string - - name: messageId - in: path - required: true - description: The ID of the message to get information from. - schema: - type: string - - name: fileId - in: path - required: true - description: The ID of the file to get information about. - schema: - type: string - responses: - '200': - description: The requested file information. - content: - application/json: - schema: - $ref: '#/components/schemas/MessageFile' - /threads/{threadId}/runs: - post: - operationId: createRun - description: Creates a new run for an assistant thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to run. - schema: - type: string - responses: - '200': - description: Information about the new thread run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - requestBody: - description: The details for the run to create. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CreateRunOptions' - get: - operationId: listRuns - description: Gets a list of runs for a specified thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to list runs from. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of thread runs. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/ThreadRun' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /threads/{threadId}/runs/{runId}: - get: - operationId: getRun - description: Gets an existing run from an existing thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread to retrieve run information from. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the thread to retrieve information about. - schema: - type: string - responses: - '200': - description: The requested information about the specified thread run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - post: - operationId: updateRun - description: Modifies an existing thread run. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread associated with the specified run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the run to modify. - schema: - type: string - responses: - '200': - description: Information about the modified run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - /threads/{threadId}/runs/{runId}/cancel: - post: - operationId: cancelRun - description: Cancels a run of an in progress thread. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread being run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the run to cancel. - schema: - type: string - responses: - '200': - description: Updated information about the cancelled run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - /threads/{threadId}/runs/{runId}/steps: - get: - operationId: listRunSteps - description: Gets a list of run steps from a thread run. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread that was run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the run to list steps from. - schema: - type: string - - name: limit - in: query - required: false - description: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - schema: - type: integer - format: int32 - default: 20 - - name: order - in: query - required: false - description: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - schema: - $ref: '#/components/schemas/ListSortOrder' - default: desc - - name: after - in: query - required: false - 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 - required: false - 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 - responses: - '200': - description: The requested list of run steps. - content: - application/json: - schema: - type: object - required: - - object - - data - - first_id - - last_id - - has_more - properties: - object: - type: string - enum: - - list - description: The object type, which is always list. - data: - type: array - items: - $ref: '#/components/schemas/RunStep' - description: The requested list of items. - first_id: - type: string - description: The first ID represented in this list. - last_id: - type: string - description: The last ID represented in this list. - has_more: - type: boolean - description: A value indicating whether there are additional values available not captured in this list. - description: The response data for a requested list of items. - /threads/{threadId}/runs/{runId}/steps/{stepId}: - get: - operationId: getRunStep - description: Gets a single run step from a thread run. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread that was run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the specific run to retrieve the step from. - schema: - type: string - - name: stepId - in: path - required: true - description: The ID of the step to retrieve information about. - schema: - type: string - responses: - '200': - description: Information about the requested run step. - content: - application/json: - schema: - $ref: '#/components/schemas/RunStep' - /threads/{threadId}/runs/{runId}/submit_tool_outputs: - post: - operationId: submitToolOutputsToRun - description: Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. - parameters: - - name: threadId - in: path - required: true - description: The ID of the thread that was run. - schema: - type: string - - name: runId - in: path - required: true - description: The ID of the run that requires tool outputs. - schema: - type: string - responses: - '200': - description: Updated information about the run. - content: - application/json: - schema: - $ref: '#/components/schemas/ThreadRun' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - tool_outputs: - type: array - items: - $ref: '#/components/schemas/ToolOutput' - description: A list of tools for which the outputs are being submitted. - 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 -security: - - ApiKeyAuth: [] - - OAuth2Auth: - - https://cognitiveservices.azure.com/.default -components: - parameters: - UpdateAssistantOptions.assistantId: - name: assistantId - in: path - required: true - description: The ID of the assistant to modify. - schema: - type: string - schemas: - Assistant: - type: object - required: - - id - - object - - created_at - - name - - description - - model - - instructions - - tools - - file_ids - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - assistant - description: The object type, which is always assistant. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - name: - type: string - nullable: true - description: The name of the assistant. - description: - type: string - nullable: true - description: The description of the assistant. - model: - type: string - description: The ID of the model to use. - instructions: - type: string - nullable: true - description: The system instructions for the assistant to use. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The collection of tools enabled for the assistant. - default: [] - file_ids: - type: array - items: - type: string - description: A list of attached file IDs, ordered by creation date in ascending order. - default: [] - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: Represents an assistant that can call the model and use tools. - AssistantCreationOptions: - type: object - required: - - model - properties: - model: - type: string - description: The ID of the model to use. - name: - type: string - nullable: true - description: The name of the new assistant. - description: - type: string - nullable: true - description: The description of the new assistant. - instructions: - type: string - nullable: true - description: The system instructions for the new assistant to use. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The collection of tools to enable for the new assistant. - default: [] - file_ids: - type: array - items: - type: string - description: A list of previously uploaded file IDs to attach to the assistant. - default: [] - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The request details to use when creating a new assistant. - AssistantDeletionStatus: - type: object - required: - - id - - deleted - - object - properties: - id: - type: string - description: The ID of the resource specified for deletion. - deleted: - type: boolean - description: A value indicating whether deletion was successful. - object: - type: string - enum: - - assistant.deleted - description: The object type, which is always 'assistant.deleted'. - description: The status of an assistant deletion operation. - AssistantFile: - type: object - required: - - id - - object - - created_at - - assistant_id - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - assistant.file - description: The object type, which is always 'assistant.file'. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - assistant_id: - type: string - description: The assistant ID that the file is attached to. - description: Information about a file attached to an assistant, as used by tools that can read files. - AssistantFileDeletionStatus: - type: object - required: - - id - - deleted - - object - properties: - id: - type: string - description: The ID of the resource specified for deletion. - deleted: - type: boolean - description: A value indicating whether deletion was successful. - object: - type: string - enum: - - assistant.file.deleted - description: The object type, which is always 'assistant.file.deleted'. - description: The status of an assistant file deletion operation. - AssistantStreamEvent: - anyOf: - - $ref: '#/components/schemas/ThreadStreamEvent' - - $ref: '#/components/schemas/RunStreamEvent' - - $ref: '#/components/schemas/RunStepStreamEvent' - - $ref: '#/components/schemas/MessageStreamEvent' - - $ref: '#/components/schemas/ErrorEvent' - - $ref: '#/components/schemas/DoneEvent' - description: |- - 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. - AssistantThread: - type: object - required: - - id - - object - - created_at - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread - description: The object type, which is always 'thread'. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: Information about a single thread associated with an assistant. - AssistantThreadCreationOptions: - type: object - properties: - messages: - type: array - items: - $ref: '#/components/schemas/ThreadInitializationMessage' - description: The initial messages to associate with the new thread. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The details used to create a new assistant thread. - CodeInterpreterToolDefinition: - type: object - required: - - type - properties: - type: - type: string - enum: - - code_interpreter - description: The object type, which is always 'code_interpreter'. - allOf: - - $ref: '#/components/schemas/ToolDefinition' - description: The input definition information for a code interpreter tool as used to configure an assistant. - CreateAndRunThreadOptions: - type: object - required: - - assistant_id - properties: - assistant_id: - type: string - description: The ID of the assistant for which the thread should be created. - thread: - allOf: - - $ref: '#/components/schemas/AssistantThreadCreationOptions' - description: The details used to create the new thread. If no thread is provided, an empty one will be created. - model: - type: string - nullable: true - description: The overridden model that the assistant should use to run the thread. - instructions: - type: string - nullable: true - description: The overridden system instructions the assistant should use to run the thread. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - nullable: true - description: The overridden list of enabled tools the assistant should use to run the thread. - stream: - type: boolean - 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. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The details used when creating and immediately running a new assistant thread. - CreateRunOptions: - type: object - required: - - assistant_id - properties: - assistant_id: - type: string - description: The ID of the assistant that should run the thread. - model: - type: string - nullable: true - description: The overridden model name that the assistant should use to run the thread. - instructions: - type: string - nullable: true - description: The overridden system instructions that the assistant should use to run the thread. - additional_instructions: - type: string - nullable: true - description: |- - Additional instructions to append 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. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - nullable: true - description: The overridden list of enabled tools that the assistant should use to run the thread. - stream: - type: boolean - 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. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The details used when creating a new run of an assistant thread. - DoneEvent: - anyOf: - - type: string - - type: string - enum: - - done - description: Terminal event indicating the successful end of a stream. - ErrorEvent: - anyOf: - - type: string - - type: string - enum: - - error - description: Terminal event indicating a server side error while streaming. - FileDeletionStatus: - type: object - required: - - id - - deleted - - object - properties: - id: - type: string - description: The ID of the resource specified for deletion. - deleted: - type: boolean - description: A value indicating whether deletion was successful. - object: - type: string - enum: - - file - description: The object type, which is always 'file'. - description: A status response from a file deletion operation. - FileListResponse: - type: object - required: - - object - - data - properties: - object: - type: string - enum: - - list - description: The object type, which is always 'list'. - data: - type: array - items: - $ref: '#/components/schemas/OpenAIFile' - description: The files returned for the request. - description: The response data from a file list operation. - FilePurpose: - anyOf: - - type: string - - type: string - enum: - - fine-tune - - fine-tune-results - - assistants - - assistants_output - description: The possible values denoting the intended usage of a file. - FunctionDefinition: - type: object - required: - - name - - parameters - properties: - name: - type: string - description: The name of the function to be called. - description: - type: string - description: A description of what the function does, used by the model to choose when and how to call the function. - parameters: - description: The parameters the functions accepts, described as a JSON Schema object. - description: The input definition information for a function. - FunctionToolDefinition: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - description: The object type, which is always 'function'. - function: - allOf: - - $ref: '#/components/schemas/FunctionDefinition' - description: The definition of the concrete function that the function tool should call. - allOf: - - $ref: '#/components/schemas/ToolDefinition' - description: The input definition information for a function tool as used to configure an assistant. - IncompleteRunDetails: - anyOf: - - type: string - - type: string - enum: - - max_completion_tokens - - max_prompt_tokens - description: The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. - ListSortOrder: - anyOf: - - type: string - - type: string - enum: - - asc - - desc - description: The available sorting options when requesting a list of response objects. - MessageContent: - type: object - required: - - type - properties: - type: - type: string - description: The object type. - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/MessageTextContent' - image_file: '#/components/schemas/MessageImageFileContent' - description: An abstract representation of a single item of thread message content. - MessageDelta: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/MessageRole' - description: The entity that produced the message. - content: - type: array - items: - $ref: '#/components/schemas/MessageDeltaContent' - description: The content of the message as an array of text and/or images. - description: Represents the typed 'delta' payload within a streaming message delta chunk. - MessageDeltaChunk: - type: object - required: - - id - - object - - delta - properties: - id: - type: string - description: The identifier of the message, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.message.delta - description: The object type, which is always `thread.message.delta`. - delta: - allOf: - - $ref: '#/components/schemas/MessageDelta' - description: The delta containing the fields that have changed on the Message. - description: Represents a message delta i.e. any changed fields on a message during streaming. - MessageDeltaContent: - type: object - required: - - index - - type - properties: - index: - type: integer - format: int32 - description: The index of the content part of the message. - type: - type: string - description: The type of content for this content part. - discriminator: - propertyName: type - mapping: - image_file: '#/components/schemas/MessageDeltaImageFileContent' - text: '#/components/schemas/MessageDeltaTextContentObject' - description: The abstract base representation of a partial streamed message content payload. - MessageDeltaImageFileContent: - type: object - required: - - type - properties: - type: - type: string - enum: - - image_file - description: The type of content for this content part, which is always "image_file." - image_file: - allOf: - - $ref: '#/components/schemas/MessageDeltaImageFileContentObject' - description: The image_file data. - allOf: - - $ref: '#/components/schemas/MessageDeltaContent' - description: Represents a streamed image file content part within a streaming message delta chunk. - MessageDeltaImageFileContentObject: - type: object - properties: - file_id: - type: string - description: The file ID of the image in the message content. - description: Represents the 'image_file' payload within streaming image file content. - MessageDeltaTextAnnotation: - type: object - required: - - index - - type - properties: - index: - type: integer - format: int32 - description: The index of the annotation within a text content part. - type: - type: string - description: The type of the text content annotation. - discriminator: - propertyName: type - mapping: - file_citation: '#/components/schemas/MessageDeltaTextFileCitationAnnotationObject' - file_path: '#/components/schemas/MessageDeltaTextFilePathAnnotationObject' - description: The abstract base representation of a streamed text content part's text annotation. - MessageDeltaTextContent: - type: object - properties: - value: - type: string - description: The data that makes up the text. - annotations: - type: array - items: - $ref: '#/components/schemas/MessageDeltaTextAnnotation' - description: Annotations for the text. - description: Represents the data of a streamed text content part within a streaming message delta chunk. - MessageDeltaTextContentObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - text - description: The type of content for this content part, which is always "text." - text: - allOf: - - $ref: '#/components/schemas/MessageDeltaTextContent' - description: The text content details. - allOf: - - $ref: '#/components/schemas/MessageDeltaContent' - description: Represents a streamed text content part within a streaming message delta chunk. - MessageDeltaTextFileCitationAnnotation: - type: object - properties: - file_id: - type: string - description: The ID of the specific file the citation is from. - quote: - type: string - description: The specific quote in the cited file. - description: Represents the data of a streamed file citation as applied to a streaming text content part. - MessageDeltaTextFileCitationAnnotationObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - file_citation - description: The type of the text content annotation, which is always "file_citation." - file_citation: - allOf: - - $ref: '#/components/schemas/MessageDeltaTextFileCitationAnnotation' - description: The file citation information. - text: - type: string - description: The text in the message content that needs to be replaced - start_index: - type: integer - format: int32 - description: The start index of this annotation in the content text. - end_index: - type: integer - format: int32 - description: The end index of this annotation in the content text. - allOf: - - $ref: '#/components/schemas/MessageDeltaTextAnnotation' - description: Represents a streamed file citation applied to a streaming text content part. - MessageDeltaTextFilePathAnnotation: - type: object - properties: - file_id: - type: string - description: The file ID for the annotation. - description: Represents the data of a streamed file path annotation as applied to a streaming text content part. - MessageDeltaTextFilePathAnnotationObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - file_path - description: The type of the text content annotation, which is always "file_path." - file_path: - allOf: - - $ref: '#/components/schemas/MessageDeltaTextFilePathAnnotation' - description: The file path information. - start_index: - type: integer - format: int32 - description: The start index of this annotation in the content text. - end_index: - type: integer - format: int32 - description: The end index of this annotation in the content text. - text: - type: string - description: The text in the message content that needs to be replaced - allOf: - - $ref: '#/components/schemas/MessageDeltaTextAnnotation' - description: Represents a streamed file path annotation applied to a streaming text content part. - MessageFile: - type: object - required: - - id - - object - - created_at - - message_id - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.message.file - description: The object type, which is always 'thread.message.file'. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - message_id: - type: string - description: The ID of the message that this file is attached to. - description: Information about a file attached to an assistant thread message. - MessageImageFileContent: - type: object - required: - - type - - image_file - properties: - type: - type: string - enum: - - image_file - description: The object type, which is always 'image_file'. - image_file: - allOf: - - $ref: '#/components/schemas/MessageImageFileDetails' - description: The image file for this thread message content item. - allOf: - - $ref: '#/components/schemas/MessageContent' - description: A representation of image file content in a thread message. - MessageImageFileDetails: - type: object - required: - - file_id - properties: - file_id: - type: string - description: The ID for the file associated with this image. - description: An image reference, as represented in thread message content. - MessageIncompleteDetails: - type: object - required: - - reason - properties: - reason: - allOf: - - $ref: '#/components/schemas/MessageIncompleteDetailsReason' - description: The provided reason describing why the message was marked as incomplete. - description: Information providing additional detail about a message entering an incomplete status. - MessageIncompleteDetailsReason: - anyOf: - - type: string - - type: string - enum: - - content_filter - - max_tokens - - run_cancelled - - run_failed - - run_expired - description: A set of reasons describing why a message is marked as incomplete. - MessageRole: - anyOf: - - type: string - - type: string - enum: - - user - - assistant - description: The possible values for roles attributed to messages in a thread. - MessageStatus: - anyOf: - - type: string - - type: string - enum: - - in_progress - - incomplete - - completed - description: The possible execution status values for a thread message. - MessageStreamEvent: - anyOf: - - type: string - - type: string - enum: - - thread.message.created - - thread.message.in_progress - - thread.message.delta - - thread.message.completed - - thread.message.incomplete - description: Message operation related streaming events - MessageTextAnnotation: - type: object - required: - - type - - text - properties: - type: - type: string - description: The object type. - text: - type: string - description: The textual content associated with this text annotation item. - discriminator: - propertyName: type - mapping: - file_citation: '#/components/schemas/MessageTextFileCitationAnnotation' - file_path: '#/components/schemas/MessageTextFilePathAnnotation' - description: An abstract representation of an annotation to text thread message content. - MessageTextContent: - type: object - required: - - type - - text - properties: - type: - type: string - enum: - - text - description: The object type, which is always 'text'. - text: - allOf: - - $ref: '#/components/schemas/MessageTextDetails' - description: The text and associated annotations for this thread message content item. - allOf: - - $ref: '#/components/schemas/MessageContent' - description: A representation of a textual item of thread message content. - MessageTextDetails: - type: object - required: - - value - - annotations - properties: - value: - type: string - description: The text data. - annotations: - type: array - items: - $ref: '#/components/schemas/MessageTextAnnotation' - description: A list of annotations associated with this text. - description: The text and associated annotations for a single item of assistant thread message content. - MessageTextFileCitationAnnotation: - type: object - required: - - type - - file_citation - properties: - type: - type: string - enum: - - file_citation - description: The object type, which is always 'file_citation'. - file_citation: - allOf: - - $ref: '#/components/schemas/MessageTextFileCitationDetails' - description: |- - A citation within the message that points to a specific quote from a specific file. - Generated when the assistant uses the "retrieval" tool to search files. - start_index: - type: integer - format: int32 - description: The first text index associated with this text annotation. - end_index: - type: integer - format: int32 - description: The last text index associated with this text annotation. - allOf: - - $ref: '#/components/schemas/MessageTextAnnotation' - 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. - MessageTextFileCitationDetails: - type: object - required: - - file_id - - quote - properties: - file_id: - type: string - description: The ID of the file associated with this citation. - quote: - type: string - description: The specific quote cited in the associated file. - description: A representation of a file-based text citation, as used in a file-based annotation of text thread message content. - MessageTextFilePathAnnotation: - type: object - required: - - type - - file_path - properties: - type: - type: string - enum: - - file_path - description: The object type, which is always 'file_path'. - file_path: - allOf: - - $ref: '#/components/schemas/MessageTextFilePathDetails' - description: A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file. - start_index: - type: integer - format: int32 - description: The first text index associated with this text annotation. - end_index: - type: integer - format: int32 - description: The last text index associated with this text annotation. - allOf: - - $ref: '#/components/schemas/MessageTextAnnotation' - description: A citation within the message that points to a file located at a specific path. - MessageTextFilePathDetails: - type: object - required: - - file_id - properties: - file_id: - type: string - description: The ID of the specific file that the citation is from. - description: An encapsulation of an image file ID, as used by message image content. - OpenAIFile: - type: object - required: - - object - - id - - bytes - - filename - - created_at - - purpose - properties: - object: - type: string - enum: - - file - description: The object type, which is always 'file'. - id: - type: string - description: The identifier, which can be referenced in API endpoints. - bytes: - type: integer - format: int32 - description: The size of the file, in bytes. - filename: - type: string - description: The name of the file. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - purpose: - allOf: - - $ref: '#/components/schemas/FilePurpose' - description: The intended purpose of a file. - description: Represents an assistant that can call the model and use tools. - RequiredAction: - type: object - required: - - type - properties: - type: - type: string - description: The object type. - discriminator: - propertyName: type - mapping: - submit_tool_outputs: '#/components/schemas/SubmitToolOutputsAction' - description: An abstract representation of a required action for an assistant thread run to continue. - RequiredFunctionToolCall: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - description: The object type of the required tool call. Always 'function' for function tools. - function: - allOf: - - $ref: '#/components/schemas/RequiredFunctionToolCallDetails' - description: Detailed information about the function to be executed by the tool that includes name and arguments. - allOf: - - $ref: '#/components/schemas/RequiredToolCall' - description: A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. - RequiredFunctionToolCallDetails: - type: object - required: - - name - - arguments - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. - description: The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function. - RequiredToolCall: - type: object - required: - - type - - id - properties: - type: - type: string - description: The object type for the required tool call. - id: - type: string - description: The ID of the tool call. This ID must be referenced when submitting tool outputs. - discriminator: - propertyName: type - mapping: - function: '#/components/schemas/RequiredFunctionToolCall' - description: An abstract representation a a tool invocation needed by the model to continue a run. - RetrievalToolDefinition: - type: object - required: - - type - properties: - type: - type: string - enum: - - retrieval - description: The object type, which is always 'retrieval'. - allOf: - - $ref: '#/components/schemas/ToolDefinition' - description: The input definition information for a retrieval tool as used to configure an assistant. - RunCompletionUsage: - type: object - required: - - completion_tokens - - prompt_tokens - - total_tokens - properties: - completion_tokens: - type: integer - format: int64 - description: Number of completion tokens used over the course of the run. - prompt_tokens: - type: integer - format: int64 - description: Number of prompt tokens used over the course of the run. - total_tokens: - type: integer - format: int64 - description: Total number of tokens used (prompt + completion). - description: Usage statistics related to the run. - RunError: - type: object - required: - - code - - message - properties: - code: - type: string - description: The status for the error. - message: - type: string - description: The human-readable text associated with the error. - description: The details of an error as encountered by an assistant thread run. - RunStatus: - anyOf: - - type: string - - type: string - enum: - - queued - - in_progress - - requires_action - - cancelling - - cancelled - - failed - - completed - - expired - description: Possible values for the status of an assistant thread run. - RunStep: - type: object - required: - - id - - object - - type - - assistant_id - - thread_id - - run_id - - status - - step_details - - last_error - - created_at - - expired_at - - completed_at - - cancelled_at - - failed_at - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.run.step - description: The object type, which is always 'thread.run.step'. - type: - allOf: - - $ref: '#/components/schemas/RunStepType' - description: The type of run step, which can be either message_creation or tool_calls. - assistant_id: - type: string - description: The ID of the assistant associated with the run step. - thread_id: - type: string - description: The ID of the thread that was run. - run_id: - type: string - description: The ID of the run that this run step is a part of. - status: - allOf: - - $ref: '#/components/schemas/RunStepStatus' - description: The status of this run step. - step_details: - allOf: - - $ref: '#/components/schemas/RunStepDetails' - description: The details for this run step. - last_error: - type: object - allOf: - - $ref: '#/components/schemas/RunStepError' - nullable: true - description: If applicable, information about the last error encountered by this run step. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - expired_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this item expired. - completed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this completed. - cancelled_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this was cancelled. - failed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this failed. - usage: - type: object - allOf: - - $ref: '#/components/schemas/RunStepCompletionUsage' - nullable: true - description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: Detailed information about a single step of an assistant thread run. - RunStepCodeInterpreterImageOutput: - type: object - required: - - type - - image - properties: - type: - type: string - enum: - - image - description: The object type, which is always 'image'. - image: - allOf: - - $ref: '#/components/schemas/RunStepCodeInterpreterImageReference' - description: Referential information for the image associated with this output. - allOf: - - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' - description: A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. - RunStepCodeInterpreterImageReference: - type: object - required: - - file_id - properties: - file_id: - type: string - description: The ID of the file associated with this image. - description: An image reference emitted by a code interpreter tool in response to a tool call by the model. - RunStepCodeInterpreterLogOutput: - type: object - required: - - type - - logs - properties: - type: - type: string - enum: - - logs - description: The object type, which is always 'logs'. - logs: - type: string - description: The serialized log output emitted by the code interpreter. - allOf: - - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' - description: A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. - RunStepCodeInterpreterToolCall: - type: object - required: - - type - - code_interpreter - properties: - type: - type: string - enum: - - code_interpreter - description: The object type, which is always 'code_interpreter'. - code_interpreter: - allOf: - - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallDetails' - description: The details of the tool call to the code interpreter tool. - allOf: - - $ref: '#/components/schemas/RunStepToolCall' - description: |- - A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that - represents inputs and outputs consumed and emitted by the code interpreter. - RunStepCodeInterpreterToolCallDetails: - type: object - required: - - input - - outputs - properties: - input: - type: string - description: The input provided by the model to the code interpreter tool. - outputs: - type: array - items: - $ref: '#/components/schemas/RunStepCodeInterpreterToolCallOutput' - description: The outputs produced by the code interpreter tool back to the model in response to the tool call. - description: The detailed information about a code interpreter invocation by the model. - RunStepCodeInterpreterToolCallOutput: - type: object - required: - - type - properties: - type: - type: string - description: The object type. - discriminator: - propertyName: type - mapping: - logs: '#/components/schemas/RunStepCodeInterpreterLogOutput' - image: '#/components/schemas/RunStepCodeInterpreterImageOutput' - description: An abstract representation of an emitted output from a code interpreter tool. - RunStepCompletionUsage: - type: object - required: - - completion_tokens - - prompt_tokens - - total_tokens - properties: - completion_tokens: - type: integer - format: int64 - description: Number of completion tokens used over the course of the run step. - prompt_tokens: - type: integer - format: int64 - description: Number of prompt tokens used over the course of the run step. - total_tokens: - type: integer - format: int64 - description: Total number of tokens used (prompt + completion). - description: Usage statistics related to the run step. - RunStepDelta: - type: object - properties: - step_details: - allOf: - - $ref: '#/components/schemas/RunStepDeltaDetail' - description: The details of the run step. - description: Represents the delta payload in a streaming run step delta chunk. - RunStepDeltaChunk: - type: object - required: - - id - - object - - delta - properties: - id: - type: string - description: The identifier of the run step, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.run.step.delta - description: The object type, which is always `thread.run.step.delta`. - delta: - allOf: - - $ref: '#/components/schemas/RunStepDelta' - description: The delta containing the fields that have changed on the run step. - description: Represents a run step delta i.e. any changed fields on a run step during streaming. - RunStepDeltaCodeInterpreterDetailItemObject: - type: object - properties: - input: - type: string - description: The input into the Code Interpreter tool call. - outputs: - type: array - items: - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' - 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. - description: Represents the Code Interpreter tool call data in a streaming run step's tool calls. - RunStepDeltaCodeInterpreterImageOutput: - type: object - required: - - type - properties: - type: - type: string - enum: - - image - description: The object type, which is always "image." - image: - allOf: - - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutputObject' - description: The image data for the Code Interpreter tool call output. - allOf: - - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' - description: Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. - RunStepDeltaCodeInterpreterImageOutputObject: - type: object - properties: - file_id: - type: string - description: The file ID for the image. - description: Represents the data for a streaming run step's Code Interpreter tool call image output. - RunStepDeltaCodeInterpreterLogOutput: - type: object - required: - - type - properties: - type: - type: string - enum: - - logs - description: The type of the object, which is always "logs." - logs: - type: string - description: The text output from the Code Interpreter tool call. - allOf: - - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterOutput' - description: Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. - RunStepDeltaCodeInterpreterOutput: - type: object - required: - - index - - type - properties: - index: - type: integer - format: int32 - description: The index of the output in the streaming run step tool call's Code Interpreter outputs array. - type: - type: string - description: The type of the streaming run step tool call's Code Interpreter output. - discriminator: - propertyName: type - mapping: - logs: '#/components/schemas/RunStepDeltaCodeInterpreterLogOutput' - image: '#/components/schemas/RunStepDeltaCodeInterpreterImageOutput' - description: The abstract base representation of a streaming run step tool call's Code Interpreter tool output. - RunStepDeltaCodeInterpreterToolCall: - type: object - required: - - type - properties: - type: - type: string - enum: - - code_interpreter - description: The object type, which is always "code_interpreter." - code_interpreter: - allOf: - - $ref: '#/components/schemas/RunStepDeltaCodeInterpreterDetailItemObject' - description: The Code Interpreter data for the tool call. - allOf: - - $ref: '#/components/schemas/RunStepDeltaToolCall' - description: Represents a Code Interpreter tool call within a streaming run step's tool call details. - RunStepDeltaDetail: - type: object - required: - - type - properties: - type: - type: string - description: The object type for the run step detail object. - discriminator: - propertyName: type - mapping: - message_creation: '#/components/schemas/RunStepDeltaMessageCreation' - tool_calls: '#/components/schemas/RunStepDeltaToolCallObject' - description: Represents a single run step detail item in a streaming run step's delta payload. - RunStepDeltaFunction: - type: object - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments passed to the function as input. - output: - type: string - nullable: true - description: The output of the function, null if outputs have not yet been submitted. - description: Represents the function data in a streaming run step delta's function tool call. - RunStepDeltaFunctionToolCall: - type: object - required: - - type - properties: - type: - type: string - enum: - - function - description: The object type, which is always "function." - function: - allOf: - - $ref: '#/components/schemas/RunStepDeltaFunction' - description: The function data for the tool call. - allOf: - - $ref: '#/components/schemas/RunStepDeltaToolCall' - description: Represents a function tool call within a streaming run step's tool call details. - RunStepDeltaMessageCreation: - type: object - required: - - type - properties: - type: - type: string - enum: - - message_creation - description: The object type, which is always "message_creation." - message_creation: - allOf: - - $ref: '#/components/schemas/RunStepDeltaMessageCreationObject' - description: The message creation data. - allOf: - - $ref: '#/components/schemas/RunStepDeltaDetail' - description: Represents a message creation within a streaming run step delta. - RunStepDeltaMessageCreationObject: - type: object - properties: - message_id: - type: string - description: The ID of the newly-created message. - description: Represents the data within a streaming run step message creation response object. - RunStepDeltaRetrievalToolCall: - type: object - required: - - type - properties: - type: - type: string - enum: - - retrieval - description: The object type, which is always "retrieval." - file_search: - type: object - additionalProperties: - type: string - description: Reserved for future use. - allOf: - - $ref: '#/components/schemas/RunStepDeltaToolCall' - description: Represents a retrieval tool call within a streaming run step's tool call details. - RunStepDeltaToolCall: - type: object - required: - - index - - id - - type - properties: - index: - type: integer - format: int32 - description: The index of the tool call detail in the run step's tool_calls array. - id: - type: string - description: The ID of the tool call, used when submitting outputs to the run. - type: - type: string - description: The type of the tool call detail item in a streaming run step's details. - discriminator: - propertyName: type - mapping: - function: '#/components/schemas/RunStepDeltaFunctionToolCall' - retrieval: '#/components/schemas/RunStepDeltaRetrievalToolCall' - code_interpreter: '#/components/schemas/RunStepDeltaCodeInterpreterToolCall' - description: The abstract base representation of a single tool call within a streaming run step's delta tool call details. - RunStepDeltaToolCallObject: - type: object - required: - - type - properties: - type: - type: string - enum: - - tool_calls - description: The object type, which is always "tool_calls." - tool_calls: - type: array - items: - $ref: '#/components/schemas/RunStepDeltaToolCall' - description: The collection of tool calls for the tool call detail item. - allOf: - - $ref: '#/components/schemas/RunStepDeltaDetail' - description: Represents an invocation of tool calls as part of a streaming run step. - RunStepDetails: - type: object - required: - - type - properties: - type: - allOf: - - $ref: '#/components/schemas/RunStepType' - description: The object type. - discriminator: - propertyName: type - mapping: - message_creation: '#/components/schemas/RunStepMessageCreationDetails' - tool_calls: '#/components/schemas/RunStepToolCallDetails' - description: An abstract representation of the details for a run step. - RunStepError: - type: object - required: - - code - - message - properties: - code: - allOf: - - $ref: '#/components/schemas/RunStepErrorCode' - description: The error code for this error. - message: - type: string - description: The human-readable text associated with this error. - description: The error information associated with a failed run step. - RunStepErrorCode: - anyOf: - - type: string - - type: string - enum: - - server_error - - rate_limit_exceeded - description: Possible error code values attributable to a failed run step. - RunStepFunctionToolCall: - type: object - required: - - type - - function - properties: - type: - type: string - enum: - - function - description: The object type, which is always 'function'. - function: - allOf: - - $ref: '#/components/schemas/RunStepFunctionToolCallDetails' - description: The detailed information about the function called by the model. - allOf: - - $ref: '#/components/schemas/RunStepToolCall' - description: |- - A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs - and output consumed and emitted by the specified function. - RunStepFunctionToolCallDetails: - type: object - required: - - name - - arguments - - output - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments that the model requires are provided to the named function. - output: - type: string - nullable: true - description: The output of the function, only populated for function calls that have already have had their outputs submitted. - description: The detailed information about the function called by the model. - RunStepMessageCreationDetails: - type: object - required: - - type - - message_creation - properties: - type: - type: string - enum: - - message_creation - description: The object type, which is always 'message_creation'. - message_creation: - allOf: - - $ref: '#/components/schemas/RunStepMessageCreationReference' - description: Information about the message creation associated with this run step. - allOf: - - $ref: '#/components/schemas/RunStepDetails' - description: The detailed information associated with a message creation run step. - RunStepMessageCreationReference: - type: object - required: - - message_id - properties: - message_id: - type: string - description: The ID of the message created by this run step. - description: The details of a message created as a part of a run step. - RunStepRetrievalToolCall: - type: object - required: - - type - - retrieval - properties: - type: - type: string - enum: - - retrieval - description: The object type, which is always 'retrieval'. - retrieval: - type: object - additionalProperties: - type: string - description: The key/value pairs produced by the retrieval tool. - allOf: - - $ref: '#/components/schemas/RunStepToolCall' - description: |- - A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents - executed retrieval actions. - RunStepStatus: - anyOf: - - type: string - - type: string - enum: - - in_progress - - cancelled - - failed - - completed - - expired - description: Possible values for the status of a run step. - RunStepStreamEvent: - anyOf: - - type: string - - type: string - enum: - - thread.run.step.created - - thread.run.step.in_progress - - thread.run.step.delta - - thread.run.step.completed - - thread.run.step.failed - - thread.run.step.cancelled - - thread.run.step.expired - description: Run step operation related streaming events - RunStepToolCall: - type: object - required: - - type - - id - properties: - type: - type: string - description: The object type. - id: - type: string - description: The ID of the tool call. This ID must be referenced when you submit tool outputs. - discriminator: - propertyName: type - mapping: - code_interpreter: '#/components/schemas/RunStepCodeInterpreterToolCall' - retrieval: '#/components/schemas/RunStepRetrievalToolCall' - function: '#/components/schemas/RunStepFunctionToolCall' - description: An abstract representation of a detailed tool call as recorded within a run step for an existing run. - RunStepToolCallDetails: - type: object - required: - - type - - tool_calls - properties: - type: - type: string - enum: - - tool_calls - description: The object type, which is always 'tool_calls'. - tool_calls: - type: array - items: - $ref: '#/components/schemas/RunStepToolCall' - description: A list of tool call details for this run step. - allOf: - - $ref: '#/components/schemas/RunStepDetails' - description: The detailed information associated with a run step calling tools. - RunStepType: - anyOf: - - type: string - - type: string - enum: - - message_creation - - tool_calls - description: The possible types of run steps. - RunStreamEvent: - anyOf: - - type: string - - type: string - enum: - - thread.run.created - - thread.run.queued - - thread.run.in_progress - - thread.run.requires_action - - thread.run.completed - - thread.run.failed - - thread.run.cancelling - - thread.run.cancelled - - thread.run.expired - description: Run operation related streaming events - ServiceApiVersions: - type: string - enum: - - 2024-02-15-preview - - 2024-05-01-preview - description: The known set of supported API versions. - SubmitToolOutputsAction: - type: object - required: - - type - - submit_tool_outputs - properties: - type: - type: string - enum: - - submit_tool_outputs - description: The object type, which is always 'submit_tool_outputs'. - submit_tool_outputs: - allOf: - - $ref: '#/components/schemas/SubmitToolOutputsDetails' - description: The details describing tools that should be called to submit tool outputs. - allOf: - - $ref: '#/components/schemas/RequiredAction' - description: The details for required tool calls that must be submitted for an assistant thread run to continue. - SubmitToolOutputsDetails: - type: object - required: - - tool_calls - properties: - tool_calls: - type: array - items: - $ref: '#/components/schemas/RequiredToolCall' - description: The list of tool calls that must be resolved for the assistant thread run to continue. - description: The details describing tools that should be called to submit tool outputs. - ThreadDeletionStatus: - type: object - required: - - id - - deleted - - object - properties: - id: - type: string - description: The ID of the resource specified for deletion. - deleted: - type: boolean - description: A value indicating whether deletion was successful. - object: - type: string - enum: - - thread.deleted - description: The object type, which is always 'thread.deleted'. - description: The status of a thread deletion operation. - ThreadInitializationMessage: - type: object - required: - - role - - content - properties: - role: - allOf: - - $ref: '#/components/schemas/MessageRole' - description: The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread. - content: - type: string - description: The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API. - file_ids: - type: array - items: - type: string - description: |- - A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can - access files. - default: [] - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: A single message within an assistant thread, as provided during that thread's creation for its initial state. - ThreadMessage: - type: object - required: - - id - - object - - created_at - - thread_id - - status - - incomplete_details - - completed_at - - incomplete_at - - role - - content - - file_ids - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.message - description: The object type, which is always 'thread.message'. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - thread_id: - type: string - description: The ID of the thread that this message belongs to. - status: - allOf: - - $ref: '#/components/schemas/MessageStatus' - description: The status of the message. - incomplete_details: - oneOf: - - $ref: '#/components/schemas/MessageIncompleteDetailsReason' - nullable: true - description: On an incomplete message, details about why the message is incomplete. - completed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp (in seconds) for when the message was completed. - incomplete_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp (in seconds) for when the message was marked as incomplete. - role: - allOf: - - $ref: '#/components/schemas/MessageRole' - description: The role associated with the assistant thread message. - content: - type: array - items: - $ref: '#/components/schemas/MessageContent' - description: The list of content items associated with the assistant thread message. - assistant_id: - type: string - description: If applicable, the ID of the assistant that authored this message. - run_id: - type: string - description: If applicable, the ID of the run associated with the authoring of this message. - file_ids: - type: array - items: - type: string - description: |- - A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can - access files. - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: A single, existing message within an assistant thread. - ThreadRun: - type: object - required: - - id - - object - - thread_id - - assistant_id - - status - - last_error - - model - - instructions - - tools - - file_ids - - created_at - - expires_at - - started_at - - completed_at - - cancelled_at - - failed_at - - incomplete_details - - usage - - metadata - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: - type: string - enum: - - thread.run - description: The object type, which is always 'thread.run'. - thread_id: - type: string - description: The ID of the thread associated with this run. - assistant_id: - type: string - description: The ID of the assistant associated with the thread this run was performed against. - status: - allOf: - - $ref: '#/components/schemas/RunStatus' - description: The status of the assistant thread run. - required_action: - type: object - allOf: - - $ref: '#/components/schemas/RequiredAction' - nullable: true - description: The details of the action required for the assistant thread run to continue. - last_error: - type: object - allOf: - - $ref: '#/components/schemas/RunError' - nullable: true - description: The last error, if any, encountered by this assistant thread run. - model: - type: string - description: The ID of the model to use. - instructions: - type: string - description: The overridden system instructions used for this assistant thread run. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The overridden enabled tools used for this assistant thread run. - default: [] - file_ids: - type: array - items: - type: string - description: A list of attached file IDs, ordered by creation date in ascending order. - default: [] - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, representing when this object was created. - expires_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this item expires. - started_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this item was started. - completed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this completed. - cancelled_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this was cancelled. - failed_at: - type: integer - format: unixtime - nullable: true - description: The Unix timestamp, in seconds, representing when this failed. - incomplete_details: - oneOf: - - $ref: '#/components/schemas/IncompleteRunDetails' - nullable: true - description: Details on why the run is incomplete. Will be `null` if the run is not incomplete. - usage: - type: object - allOf: - - $ref: '#/components/schemas/RunCompletionUsage' - nullable: true - 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.). - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: Data representing a single evaluation run of an assistant thread. - ThreadStreamEvent: - anyOf: - - type: string - - type: string - enum: - - thread.created - description: Thread operation related streaming events - ToolDefinition: - type: object - required: - - type - properties: - type: - type: string - description: The object type. - discriminator: - propertyName: type - mapping: - code_interpreter: '#/components/schemas/CodeInterpreterToolDefinition' - retrieval: '#/components/schemas/RetrievalToolDefinition' - function: '#/components/schemas/FunctionToolDefinition' - description: An abstract representation of an input tool definition that an assistant can use. - ToolOutput: - type: object - properties: - tool_call_id: - type: string - description: The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. - output: - type: string - description: The output from the tool to be submitted. - description: The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. - UpdateAssistantOptions: - type: object - properties: - model: - type: string - description: The ID of the model to use. - name: - type: string - nullable: true - description: The modified name for the assistant to use. - description: - type: string - nullable: true - description: The modified description for the assistant to use. - instructions: - type: string - nullable: true - description: The modified system instructions for the new assistant to use. - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinition' - description: The modified collection of tools to enable for the assistant. - default: [] - file_ids: - type: array - items: - type: string - description: The modified list of previously uploaded fileIDs to attach to the assistant. - default: [] - metadata: - type: object - additionalProperties: - type: string - nullable: true - description: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. - description: The request details to use when modifying an existing assistant. - securitySchemes: - ApiKeyAuth: - type: apiKey - in: header - name: api-key - OAuth2Auth: - type: oauth2 - flows: - implicit: - authorizationUrl: https://login.microsoftonline.com/common/oauth2/v2.0/authorize - scopes: - https://cognitiveservices.azure.com/.default: '' -servers: - - url: '{endpoint}' - description: Azure OpenAI APIs for Assistants. - variables: - endpoint: - default: '' - description: An OpenAI endpoint supporting assistants functionality. From d4d7a29a8f44d98bd872057b9ce89e4dfdc701d6 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Wed, 22 May 2024 10:02:43 +0200 Subject: [PATCH 24/25] Added string type to AssistantStreamEvent --- .../ai/OpenAI.Assistants/streaming/events.tsp | 13 +++++++------ .../2024-02-15-preview/assistants_generated.yaml | 14 ++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp index 1f25f45f78f0..b1d65a797199 100644 --- a/specification/ai/OpenAI.Assistants/streaming/events.tsp +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -23,13 +23,14 @@ We may add additional events over time, so we recommend handling unknown events in your code. """) union AssistantStreamEvent { + string, - | ThreadStreamEvent - | RunStreamEvent - | RunStepStreamEvent - | MessageStreamEvent - | ErrorEvent - | DoneEvent, + | ThreadStreamEvent + | RunStreamEvent + | RunStepStreamEvent + | MessageStreamEvent + | ErrorEvent + | DoneEvent, } /** Thread operation related streaming events */ diff --git a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml index cd143ef725b9..dad7788dcc2c 100644 --- a/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-02-15-preview/assistants_generated.yaml @@ -1287,12 +1287,14 @@ components: description: The status of an assistant file deletion operation. AssistantStreamEvent: anyOf: - - $ref: '#/components/schemas/ThreadStreamEvent' - - $ref: '#/components/schemas/RunStreamEvent' - - $ref: '#/components/schemas/RunStepStreamEvent' - - $ref: '#/components/schemas/MessageStreamEvent' - - $ref: '#/components/schemas/ErrorEvent' - - $ref: '#/components/schemas/DoneEvent' + - type: string + - anyOf: + - $ref: '#/components/schemas/ThreadStreamEvent' + - $ref: '#/components/schemas/RunStreamEvent' + - $ref: '#/components/schemas/RunStepStreamEvent' + - $ref: '#/components/schemas/MessageStreamEvent' + - $ref: '#/components/schemas/ErrorEvent' + - $ref: '#/components/schemas/DoneEvent' description: |- Each event in a server-sent events stream has an `event` and `data` property: From 3879615d7a08c1aac9704a7f47d93f15932bea16 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Wed, 22 May 2024 10:09:30 +0200 Subject: [PATCH 25/25] tsp validation check --- .../ai/OpenAI.Assistants/streaming/events.tsp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/specification/ai/OpenAI.Assistants/streaming/events.tsp b/specification/ai/OpenAI.Assistants/streaming/events.tsp index b1d65a797199..22d34453e587 100644 --- a/specification/ai/OpenAI.Assistants/streaming/events.tsp +++ b/specification/ai/OpenAI.Assistants/streaming/events.tsp @@ -25,12 +25,12 @@ in your code. union AssistantStreamEvent { string, - | ThreadStreamEvent - | RunStreamEvent - | RunStepStreamEvent - | MessageStreamEvent - | ErrorEvent - | DoneEvent, + | ThreadStreamEvent + | RunStreamEvent + | RunStepStreamEvent + | MessageStreamEvent + | ErrorEvent + | DoneEvent, } /** Thread operation related streaming events */