From 5b4680decb81a4b3d266a189206efcb2619e7806 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Fri, 31 May 2024 18:46:46 +0200 Subject: [PATCH] Assistant SDK V2 changes (depending on the Assistant V1 PR) (#29067) * initial commit for models in support of streaming Assistants calls * merge + pr feedback * [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 * Update specification/ai/OpenAI.Assistants/streaming/events.tsp * Added usage models for run and runStep (#28864) * Added usage models for run and runStep * Added added annotation * Added warning suppresion for nullable fields * Compiled with new models and unions * back ported everything to a past version. Extracted SubmitToolOutputsOptions model * re-compile * Removed toolresources for now and added warning supressions * Brought up to date the classes related to streaming for AssistantStreamEvent * Making filename mandatory uploadFile operation * Project compilation * Re-formated definitiones according to CI instructions * Added new service version * Figuring out error highlights in vscode * Added get method listVectorStore * extracted union * Added create vector store method * Adding method to get single vector store * Added update methods for vector store * Added deletion method for vector stores * Removed assistant specific file models and operations * Added operation for listing vector store files * Added create file for vector store method * Added the rest of the file operations * Re-structured files under vector_store * Reformated correctly * Added first operation for vector store file batch * Added file listing per vector store file batch * WIP: AssistantsApiResponseFormatOption generates as anyOf of instead of oneOf * corrected values for enum * Adjusted Assistant response object * Added browse azure tool call type and renamed retrieval to file_search * Adding models for createAssistantsOptions * Updated assistant update models * Added TruncationObject * Added tool_choice to run related objects * Added new fields to ThreadRun model * Added attachements and tool resources to thread and message related models * 2nd pass to thread and message related files * Renamed 'retrieva'->'file_search' added 'browse' * Removed deprecated file endpoints and add java customizations for code gen * Spellchecks * Added missing documentation * -clear * Renamed union * TSP validation check * Reverted nullability of fileName * re-compiled * Added new file purposes * Removed openapi v2 and v3 files generated with the placeholder version * reformating * Added AOAI fields for Files * Added missing tool_resource object to createThreadAndRunRequest * Updated docs and removed Browse tools for this release * Maded the stream events public to expose types and docs to users * Made stream events publics * PR feedback and solved one open comment left for UpdateThreadOptions * remove single-use options model, merge into route params directly * proactively add 2024-05-01-preview label * Removed model removed in upstream branch * Recompile * Removed 05_01 from service version enum ... for now * Restored example * Added string type to AssistantStreamEvent * tsp validation check * Duplicate doc annotation * Removed duplicate entries * Added documentation for API response formats * Applied formatter * Removed package and annotation usage causing issues in Java emitter * Made temperature and top_p nullable for assistant create request * Commented out linter rule breaking code emission * Corrected double dot in documentation * Restored linter rules for formater and adjusted definition of JSON polymorphic type * Cleaned up comment * Split out the string variants into their own union * tsp format * PR feedback --------- Co-authored-by: Travis Wilson Co-authored-by: Travis Wilson <35748617+trrwilson@users.noreply.github.com> --- .../OpenAI.Assistants/assistants/models.tsp | 151 +- .../OpenAI.Assistants/assistants/routes.tsp | 74 - specification/ai/OpenAI.Assistants/client.tsp | 13 - .../ai/OpenAI.Assistants/common/models.tsp | 56 + .../2024-05-01-preview/create_assistant.json | 4 + .../ai/OpenAI.Assistants/files/models.tsp | 75 +- specification/ai/OpenAI.Assistants/main.tsp | 6 + .../ai/OpenAI.Assistants/messages/models.tsp | 90 +- .../ai/OpenAI.Assistants/messages/routes.tsp | 61 +- .../ai/OpenAI.Assistants/run_steps/models.tsp | 12 +- .../ai/OpenAI.Assistants/runs/models.tsp | 228 +- .../ai/OpenAI.Assistants/runs/routes.tsp | 2 + .../ai/OpenAI.Assistants/threads/models.tsp | 49 +- .../ai/OpenAI.Assistants/threads/routes.tsp | 6 +- .../ai/OpenAI.Assistants/tools/models.tsp | 91 +- .../tools/tool_resources.tsp | 164 + .../ai/OpenAI.Assistants/tspconfig.yaml | 2 +- .../vector_stores/file_batches/main.tsp | 2 + .../vector_stores/file_batches/models.tsp | 46 + .../vector_stores/file_batches/routes.tsp | 88 + .../vector_stores/files/main.tsp | 2 + .../vector_stores/files/models.tsp | 111 + .../vector_stores/files/routes.tsp | 85 + .../OpenAI.Assistants/vector_stores/main.tsp | 5 + .../vector_stores/models.tsp | 161 + .../vector_stores/routes.tsp | 81 + .../assistants_generated.json | 802 +-- .../assistants_generated.json | 5184 +++++++++++++++++ .../assistants_generated.yaml | 534 +- .../assistants_generated.yaml | 4225 ++++++++++++++ 30 files changed, 10959 insertions(+), 1451 deletions(-) create mode 100644 specification/ai/OpenAI.Assistants/examples/2024-05-01-preview/create_assistant.json create mode 100644 specification/ai/OpenAI.Assistants/tools/tool_resources.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/file_batches/main.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/file_batches/models.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/file_batches/routes.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/files/main.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/files/models.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/files/routes.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/main.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/models.tsp create mode 100644 specification/ai/OpenAI.Assistants/vector_stores/routes.tsp 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/assistants/models.tsp b/specification/ai/OpenAI.Assistants/assistants/models.tsp index 6f82c711d58d..1ecff00e2e15 100644 --- a/specification/ai/OpenAI.Assistants/assistants/models.tsp +++ b/specification/ai/OpenAI.Assistants/assistants/models.tsp @@ -1,6 +1,9 @@ import "@typespec/versioning"; + import "../common/models.tsp"; import "../tools/models.tsp"; +import "../tools/tool_resources.tsp"; +import "../main.tsp"; namespace Azure.AI.OpenAI.Assistants; @@ -39,9 +42,43 @@ model Assistant { @doc("The collection of tools enabled for the assistant.") tools: ToolDefinition[] = []; - @encodedName("application/json", "file_ids") - @doc("A list of attached file IDs, ordered by creation date in ascending order.") - fileIds: string[] = []; + /** + * A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "tool_resources") + @added(ServiceApiVersions.v2024_05_01_preview) + toolResources: ToolResources | null; + + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + @minValue(0) + @maxValue(2) + temperature: float32 | null = 1; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + @minValue(0) + @maxValue(1) + @encodedName("application/json", "top_p") + topP: float32 | null = 1; + + /** The response format of the tool calls used by this assistant. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "response_format") + @added(ServiceApiVersions.v2024_05_01_preview) + responseFormat?: AssistantsApiResponseFormatOption | null; ...RequiredNullableMetadata; } @@ -68,9 +105,43 @@ model AssistantCreationOptions { @doc("The collection of tools to enable for the new assistant.") tools?: ToolDefinition[] = []; - @encodedName("application/json", "file_ids") - @doc("A list of previously uploaded file IDs to attach to the assistant.") - fileIds?: string[] = []; + /** + * A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "tool_resources") + @added(ServiceApiVersions.v2024_05_01_preview) + toolResources?: CreateToolResourcesOptions | null; + + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + @minValue(0) + @maxValue(2) + temperature?: float32 | null = 1; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + @minValue(0) + @maxValue(1) + @encodedName("application/json", "top_p") + topP?: float32 | null = 1; + + /** The response format of the tool calls used by this assistant. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "response_format") + @added(ServiceApiVersions.v2024_05_01_preview) + responseFormat?: AssistantsApiResponseFormatOption | null; ...OptionalNullableMetadata; } @@ -100,9 +171,42 @@ model UpdateAssistantOptions { @doc("The modified collection of tools to enable for the assistant.") tools?: ToolDefinition[] = []; - @encodedName("application/json", "file_ids") - @doc("The modified list of previously uploaded fileIDs to attach to the assistant.") - fileIds?: string[] = []; + /** + * A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, + * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + */ + @encodedName("application/json", "tool_resources") + @added(ServiceApiVersions.v2024_05_01_preview) + toolResources?: UpdateToolResourcesOptions; + + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + * while lower values like 0.2 will make it more focused and deterministic. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + @minValue(0) + @maxValue(2) + temperature?: float32 | null = 1; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + * So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + @minValue(0) + @maxValue(1) + @encodedName("application/json", "top_p") + topP?: float32 | null = 1; + + /** The response format of the tool calls used by this assistant. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "response_format") + @added(ServiceApiVersions.v2024_05_01_preview) + responseFormat?: AssistantsApiResponseFormatOption | null; ...OptionalNullableMetadata; } @@ -115,32 +219,3 @@ model AssistantDeletionStatus { @doc("The object type, which is always 'assistant.deleted'.") object: "assistant.deleted"; } - -@doc("Information about a file attached to an assistant, as used by tools that can read files.") -@added(ServiceApiVersions.v2024_02_15_preview) -model AssistantFile { - @doc("The identifier, which can be referenced in API endpoints.") - id: string; - - @doc("The object type, which is always 'assistant.file'.") - object: "assistant.file"; - - @encodedName("application/json", "created_at") - @encode(DateTimeKnownEncoding.unixTimestamp, int32) - @doc("The Unix timestamp, in seconds, representing when this object was created.") - createdAt: utcDateTime; - - @encodedName("application/json", "assistant_id") - @doc("The assistant ID that the file is attached to.") - assistantId: string; -} - -#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "https://github.com/Azure/autorest.csharp/issues/4041" -@doc("The status of an assistant file deletion operation.") -@added(ServiceApiVersions.v2024_02_15_preview) -model AssistantFileDeletionStatus { - ...DeletionStatus; - - @doc("The object type, which is always 'assistant.file.deleted'.") - object: "assistant.file.deleted"; -} diff --git a/specification/ai/OpenAI.Assistants/assistants/routes.tsp b/specification/ai/OpenAI.Assistants/assistants/routes.tsp index bbdb7829485a..cdefb9fd6aa5 100644 --- a/specification/ai/OpenAI.Assistants/assistants/routes.tsp +++ b/specification/ai/OpenAI.Assistants/assistants/routes.tsp @@ -78,77 +78,3 @@ op updateAssistant(...UpdateAssistantOptions): Assistant; @route("/assistants/{assistantId}") @added(ServiceApiVersions.v2024_02_15_preview) op deleteAssistant(@path assistantId: string): AssistantDeletionStatus; - -/** - * Attaches a previously uploaded file to an assistant for use by tools that can read files. - * - * @param assistantId The ID of the assistant to attach the file to. - * @param fileId The ID of the previously uploaded file to attach. - * @returns Information about the attached file. - */ -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" -#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations" -#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" -@post -@route("assistants/{assistantId}/files") -@added(ServiceApiVersions.v2024_02_15_preview) -op createAssistantFile( - @path assistantId: string, - @encodedName("application/json", "file_id") fileId: string, -): AssistantFile; - -/** - * Gets a list of files attached to a specific assistant, as used by tools that can read files. - * - * @param assistantId The ID of the assistant to retrieve the list of attached files for. - * @returns The requested list of files attached to the specified assistant. - */ -#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" -#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations" -#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" -@get -@route("assistants/{assistantId}/files") -@added(ServiceApiVersions.v2024_02_15_preview) -op listAssistantFiles( - @path assistantId: string, - ...OpenAIListRequestOptions, -): OpenAIPageableListOf; - -/** - * Retrieves a file attached to an assistant. - * - * @param assistantId The ID of the assistant associated with the attached file. - * @param fileId The ID of the file to retrieve. - * @returns A representation of the attached file. - */ -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" -#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations" -#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" -#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API name parity" -@get -@route("assistants/{assistantId}/files/{fileId}") -@added(ServiceApiVersions.v2024_02_15_preview) -op getAssistantFile( - @path assistantId: string, - @path fileId: string, -): AssistantFile; - -/** - * Unlinks a previously attached file from an assistant, rendering it unavailable for use by tools that can read - * files. - * - * @param assistantId The ID of the assistant from which the specified file should be unlinked. - * @param fileId The ID of the file to unlink from the specified assistant. - * @returns Status information about the requested file association deletion. - */ -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" -#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations" -#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" -@delete -@route("assistants/{assistantId}/files/{fileId}") -@added(ServiceApiVersions.v2024_02_15_preview) -op deleteAssistantFile( - @path assistantId: string, - @path fileId: string, -): AssistantFileDeletionStatus; diff --git a/specification/ai/OpenAI.Assistants/client.tsp b/specification/ai/OpenAI.Assistants/client.tsp index a2ef9ea62da6..09cbd97e3622 100644 --- a/specification/ai/OpenAI.Assistants/client.tsp +++ b/specification/ai/OpenAI.Assistants/client.tsp @@ -24,21 +24,10 @@ namespace Azure.AI.OpenAI.Assistants { ); @@access(deleteAssistant, Access.internal, "csharp"); @@clientName(deleteAssistant, "InternalDeleteAssistant", "csharp"); - @@access(AssistantFileDeletionStatus, Access.internal, "csharp"); - @@clientName(AssistantFileDeletionStatus, - "InternalAssistantFileDeletionStatus", - "csharp" - ); - @@access(deleteAssistantFile, Access.internal, "csharp"); - @@clientName(deleteAssistantFile, "InternalUnlinkAssistantFile", "csharp"); @@access(deleteThread, Access.internal, "csharp"); @@clientName(deleteThread, "InternalDeleteThread", "csharp"); @@access(listAssistants, Access.internal, "csharp"); @@clientName(listAssistants, "InternalGetAssistants", "csharp"); - @@access(listAssistantFiles, Access.internal, "csharp"); - @@clientName(listAssistantFiles, "InternalGetAssistantFiles", "csharp"); - @@access(listMessageFiles, Access.internal, "csharp"); - @@clientName(listMessageFiles, "InternalGetMessageFiles", "csharp"); @@access(listRunSteps, Access.internal, "csharp"); @@clientName(listRunSteps, "InternalGetRunSteps", "csharp"); @@access(listMessages, Access.internal, "csharp"); @@ -241,6 +230,4 @@ namespace Azure.AI.OpenAI.Assistants { // From https://platform.openai.com/docs/assistants/how-it-works // "Note that deleting an AssistantFile doesn’t delete the original File object, it simply deletes the association // between that File and the Assistant." - @@clientName(createAssistantFile, "LinkAssistantFile", "csharp"); - // 'Unlink' counterpart already renamed for DeletionStatus merge } diff --git a/specification/ai/OpenAI.Assistants/common/models.tsp b/specification/ai/OpenAI.Assistants/common/models.tsp index bbdfce9bed09..5c446a1d1d42 100644 --- a/specification/ai/OpenAI.Assistants/common/models.tsp +++ b/specification/ai/OpenAI.Assistants/common/models.tsp @@ -92,3 +92,59 @@ alias OptionalNullableMetadata = { #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" metadata?: Record | null; }; + +/** + * Specifies the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. + * + * Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON. + * + * **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. + * Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, + * resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off + * if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. + */ +#suppress "@azure-tools/typespec-autorest/union-unsupported" "This union is defined according to the OpenAI API" +@added(ServiceApiVersions.v2024_05_01_preview) +union AssistantsApiResponseFormatOption { + string, + + /** The model will handle the return format. */ + AssistantsApiResponseFormatMode, + + /** Sets the format of the output of the model when a ToolCall is returned. */ + AssistantsApiResponseFormat, +} + +/** Represents the mode in which the model will handle the return format of a tool call. */ +@added(ServiceApiVersions.v2024_05_01_preview) +union AssistantsApiResponseFormatMode { + string, + + /** Default value. Let the model handle the return format. */ + "auto", + + /** Setting the value to `none`, will result in a 400 Bad request. */ + "none", +} + +/** + * An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. + * If `text` the model can return text or any value needed. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model AssistantsApiResponseFormat { + /** Must be one of `text` or `json_object`. */ + type?: ApiResponseFormat = ApiResponseFormat.text; +} + +/** Possible API response formats. */ +@added(ServiceApiVersions.v2024_05_01_preview) +union ApiResponseFormat { + string, + + /** `text` format should be used for requests involving any sort of ToolCall. */ + text: "text", + + /** Using `json_object` format will limit the usage of ToolCall to only functions. */ + jsonObject: "json_object", +} 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 new file mode 100644 index 000000000000..24f1208ac3df --- /dev/null +++ b/specification/ai/OpenAI.Assistants/examples/2024-05-01-preview/create_assistant.json @@ -0,0 +1,4 @@ +{ + "title": "Assistants_CreateAssistant", + "operationId": "Assistants_CreateAssistant" +} diff --git a/specification/ai/OpenAI.Assistants/files/models.tsp b/specification/ai/OpenAI.Assistants/files/models.tsp index 1b26b9845bf1..9b1963dd9a46 100644 --- a/specification/ai/OpenAI.Assistants/files/models.tsp +++ b/specification/ai/OpenAI.Assistants/files/models.tsp @@ -1,5 +1,7 @@ import "@typespec/versioning"; +import "../main.tsp"; + namespace Azure.AI.OpenAI.Assistants; using TypeSpec.Versioning; @@ -27,24 +29,87 @@ model OpenAIFile { @doc("The intended purpose of a file.") purpose: FilePurpose; + + /** The state of the file. This field is available in Azure OpenAI only. */ + @added(ServiceApiVersions.v2024_05_01_preview) + status?: FileState; + + /** The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. */ + @encodedName("application/json", "status_details") + @added(ServiceApiVersions.v2024_05_01_preview) + statusDetails?: string; +} + +/** The state of the file. */ +@added(ServiceApiVersions.v2024_05_01_preview) +union FileState { + string, + + /** + * The file has been uploaded but it's not yet processed. This state is not returned by Azure OpenAI and exposed only for + * compatibility. It can be categorized as an inactive state. + */ + uploaded: "uploaded", + + /** + * The operation was created and is not queued to be processed in the future. It can be categorized as an inactive state. + */ + pending: "pending", + + /** The operation has started to be processed. It can be categorized as an active state. */ + running: "running", + + /** + * The operation has successfully processed and is ready for consumption. It can be categorized as a terminal state. + */ + processed: "processed", + + /** + * The operation has completed processing with a failure and cannot be further consumed. It can be categorized as a terminal state. + */ + error: "error", + + /** + * The entity is in the process to be deleted. This state is not returned by Azure OpenAI and exposed only for compatibility. + * It can be categorized as an active state. + */ + deleting: "deleting", + + /** + * The entity has been deleted but may still be referenced by other entities predating the deletion. It can be categorized as a + * terminal state. + */ + deleted: "deleted", } -@doc("The possible values denoting the intended usage of a file.") +/** The possible values denoting the intended usage of a file. */ @added(ServiceApiVersions.v2024_02_15_preview) union FilePurpose { string, - @doc("Indicates a file is used for fine tuning input.") + /** Indicates a file is used for fine tuning input. */ fineTune: "fine-tune", - @doc("Indicates a file is used for fine tuning results.") + /** Indicates a file is used for fine tuning results. */ fineTuneResults: "fine-tune-results", - @doc("Indicates a file is used as input to assistants.") + /** Indicates a file is used as input to assistants. */ assistants: "assistants", - @doc("Indicates a file is used as output by assistants.") + /** Indicates a file is used as output by assistants. */ assistantsOutput: "assistants_output", + + /** Indicates a file is used as input to . */ + @added(ServiceApiVersions.v2024_05_01_preview) + batch: "batch", + + /** Indicates a file is used as output by a vector store batch operation. */ + @added(ServiceApiVersions.v2024_05_01_preview) + batchOutput: "batch_output", + + /** Indicates a file is used as input to a vision operation. */ + @added(ServiceApiVersions.v2024_05_01_preview) + vision: "vision", } @doc("The response data from a file list operation.") diff --git a/specification/ai/OpenAI.Assistants/main.tsp b/specification/ai/OpenAI.Assistants/main.tsp index 462d1028e419..1fa7e0790ce4 100644 --- a/specification/ai/OpenAI.Assistants/main.tsp +++ b/specification/ai/OpenAI.Assistants/main.tsp @@ -1,6 +1,7 @@ import "@azure-tools/typespec-azure-core"; import "@typespec/http"; import "@typespec/versioning"; + import "./assistants/main.tsp"; import "./threads/main.tsp"; import "./messages/main.tsp"; @@ -8,6 +9,7 @@ import "./runs/main.tsp"; import "./run_steps/main.tsp"; import "./files/main.tsp"; import "./streaming/events.tsp"; +import "./vector_stores/main.tsp"; using TypeSpec.Http; using TypeSpec.Versioning; @@ -52,5 +54,9 @@ 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", + + @useDependency(Azure.Core.Versions.v1_0_Preview_2) + @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/OpenAI.Assistants/messages/models.tsp b/specification/ai/OpenAI.Assistants/messages/models.tsp index a6b286399fd0..ebce66ef29c4 100644 --- a/specification/ai/OpenAI.Assistants/messages/models.tsp +++ b/specification/ai/OpenAI.Assistants/messages/models.tsp @@ -1,24 +1,31 @@ +import "../main.tsp"; +import "../tools/models.tsp"; + import "@typespec/versioning"; namespace Azure.AI.OpenAI.Assistants; using TypeSpec.Versioning; -@doc("A single message within an assistant thread, as provided during that thread's creation for its initial state.") -@added(ServiceApiVersions.v2024_02_15_preview) -model ThreadInitializationMessage { - @doc("The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread.") +/** A single message within an assistant thread, as provided during that thread's creation for its initial state. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model ThreadMessageOptions { + /** + * The role of the entity that is creating the message. Allowed values include: + * - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + * - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into + * the conversation. + */ role: MessageRole; - @doc("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.") + /** 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. + */ content: string; - @encodedName("application/json", "file_ids") - @doc(""" - A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can - access files. - """) - fileIds?: string[] = []; + /** A list of files attached to the message, and the tools they should be added to. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + attachments?: MessageAttachment[] | null; ...OptionalNullableMetadata; } @@ -49,7 +56,7 @@ model ThreadMessage { #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @encodedName("application/json", "incomplete_details") @added(ServiceApiVersions.v2024_02_15_preview) - incompleteDetails: MessageIncompleteDetailsReason | null; + incompleteDetails: MessageIncompleteDetails | 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" @@ -71,24 +78,42 @@ model ThreadMessage { @doc("The list of content items associated with the assistant thread message.") content: MessageContent[]; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @encodedName("application/json", "assistant_id") @doc("If applicable, the ID of the assistant that authored this message.") - assistantId?: string; + assistantId: string | null; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @encodedName("application/json", "run_id") @doc("If applicable, the ID of the run associated with the authoring of this message.") - runId?: string; + runId: string | null; - @encodedName("application/json", "file_ids") - @doc(""" - A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can - access files. - """) - fileIds: string[]; + /** A list of files attached to the message, and the tools they were added to. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + attachments: MessageAttachment[] | null; ...RequiredNullableMetadata; } +/** This describes to which tools a file has been attached. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model MessageAttachment { + /** The ID of the file to attach to the message. */ + @encodedName("application/json", "file_id") + fileId: string; + + /** The tools to add to this file. */ + tools: MessageAttachmentToolDefinition[]; +} + +/** The possible tools to which files will be added by this message */ +#suppress "@azure-tools/typespec-autorest/union-unsupported" "This union is defined according to the OpenAI API" +@added(ServiceApiVersions.v2024_05_01_preview) +union MessageAttachmentToolDefinition { + CodeInterpreterToolDefinition | FileSearchToolDefinition, +} + // Message content types: "text" | "image_file" @discriminator("type") @@ -147,7 +172,7 @@ model MessageTextAnnotation { // File citation annotation + details -@doc("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.") +@doc("A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the 'file_search' tool to search files.") @added(ServiceApiVersions.v2024_02_15_preview) model MessageTextFileCitationAnnotation extends MessageTextAnnotation { @doc("The object type, which is always 'file_citation'.") @@ -156,7 +181,7 @@ model MessageTextFileCitationAnnotation extends MessageTextAnnotation { @encodedName("application/json", "file_citation") @doc(""" 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. + Generated when the assistant uses the "file_search" tool to search files. """) fileCitation: MessageTextFileCitationDetails; @@ -219,27 +244,6 @@ model MessageImageFileDetails { fileId: string; } -// Assistant message file representation, used for message "list files" route responses - -@doc("Information about a file attached to an assistant thread message.") -@added(ServiceApiVersions.v2024_02_15_preview) -model MessageFile { - @doc("The identifier, which can be referenced in API endpoints.") - id: string; - - @doc("The object type, which is always 'thread.message.file'.") - object: "thread.message.file"; - - @encodedName("application/json", "created_at") - @encode(DateTimeKnownEncoding.unixTimestamp, int32) - @doc("The Unix timestamp, in seconds, representing when this object was created.") - createdAt: utcDateTime; - - @encodedName("application/json", "message_id") - @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.v2024_02_15_preview) union MessageStatus { diff --git a/specification/ai/OpenAI.Assistants/messages/routes.tsp b/specification/ai/OpenAI.Assistants/messages/routes.tsp index 356bf12e140f..9d8b27ad11f1 100644 --- a/specification/ai/OpenAI.Assistants/messages/routes.tsp +++ b/specification/ai/OpenAI.Assistants/messages/routes.tsp @@ -2,6 +2,8 @@ import "@azure-tools/typespec-azure-core"; import "@typespec/rest"; import "@typespec/http"; import "@typespec/versioning"; + +import "../main.tsp"; import "../common/models.tsp"; import "./models.tsp"; @@ -17,9 +19,6 @@ namespace Azure.AI.OpenAI.Assistants; * Creates a new message on a specified thread. * * @param threadId The ID of the thread to create the new message on. - * @param role The role to associate with the new message. - * @param content The textual content for the new message. - * @param fileIds 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. * @returns A representation of the new message. */ #suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" @@ -31,10 +30,11 @@ namespace Azure.AI.OpenAI.Assistants; @added(ServiceApiVersions.v2024_02_15_preview) op createMessage( @path threadId: string, - role: MessageRole, - content: string, - @encodedName("application/json", "file_ids") fileIds?: string[], - ...OptionalNullableMetadata, + + /** A single message within an assistant thread, as provided during that thread's creation for its initial state. */ + @added(ServiceApiVersions.v2024_05_01_preview) + @body + threadMessageOptions: ThreadMessageOptions, ): ThreadMessage; /** @@ -52,6 +52,12 @@ op createMessage( @added(ServiceApiVersions.v2024_02_15_preview) op listMessages( @path threadId: string, + + /** Filter messages by the run ID that generated them. */ + @added(ServiceApiVersions.v2024_05_01_preview) + @query + runId?: string, + ...OpenAIListRequestOptions, ): OpenAIPageableListOf; @@ -89,44 +95,3 @@ op updateMessage( @path messageId: string, ...OptionalNullableMetadata, ): ThreadMessage; - -/** - * Gets a list of previously uploaded files associated with a message from a thread. - * - * @param threadId The ID of the thread containing the message to list files from. - * @param messageId The ID of the message to list files from. - * @returns The requested list of files associated with the specified message. - */ -#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" -#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations" -#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" -@get -@route("/threads/{threadId}/messages/{messageId}/files") -@added(ServiceApiVersions.v2024_02_15_preview) -op listMessageFiles( - @path threadId: string, - @path messageId: string, - ...OpenAIListRequestOptions, -): OpenAIPageableListOf; - -/** - * Gets information about a file attachment to a message within a thread. - * - * @param threadId The ID of the thread containing the message to get information from. - * @param messageId The ID of the message to get information from. - * @param fileId The ID of the file to get information about. - * @returns The requested file information. - */ -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" -#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations" -#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" -#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API name parity" -@get -@route("/threads/{threadId}/messages/{messageId}/files/{fileId}") -@added(ServiceApiVersions.v2024_02_15_preview) -op getMessageFile( - @path threadId: string, - @path messageId: string, - @path fileId: string, -): MessageFile; diff --git a/specification/ai/OpenAI.Assistants/run_steps/models.tsp b/specification/ai/OpenAI.Assistants/run_steps/models.tsp index 6a17ee099d81..89d15c2ea2bf 100644 --- a/specification/ai/OpenAI.Assistants/run_steps/models.tsp +++ b/specification/ai/OpenAI.Assistants/run_steps/models.tsp @@ -1,5 +1,7 @@ import "@typespec/versioning"; + import "../tools/models.tsp"; +import "../main.tsp"; namespace Azure.AI.OpenAI.Assistants; @@ -274,11 +276,11 @@ model RunStepDeltaFunctionToolCall extends RunStepDeltaToolCall { function?: RunStepDeltaFunction; } -/** Represents a retrieval tool call within a streaming run step's tool call details. */ -@added(ServiceApiVersions.v2024_02_15_preview) -model RunStepDeltaRetrievalToolCall extends RunStepDeltaToolCall { - /** The object type, which is always "retrieval." */ - type: "retrieval"; +/** Represents a file search tool call within a streaming run step's tool call details. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model RunStepDeltaFileSearchToolCall extends RunStepDeltaToolCall { + /** The object type, which is always "file_search." */ + type: "file_search"; /** Reserved for future use. */ @encodedName("application/json", "file_search") diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index 32f328e86fb2..08cd8e08355b 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -53,10 +53,6 @@ model ThreadRun { @doc("The overridden enabled tools used for this assistant thread run.") tools: ToolDefinition[] = []; - @encodedName("application/json", "file_ids") - @doc("A list of attached file IDs, ordered by creation date in ascending order.") - fileIds: string[] = []; - @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") @@ -105,6 +101,49 @@ model ThreadRun { @added(ServiceApiVersions.v2024_02_15_preview) usage: RunCompletionUsage | null; + /** The sampling temperature used for this run. If not set, defaults to 1. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + temperature?: float32 | null; + + /** The nucleus sampling value used for this run. If not set, defaults to 1. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "top_p") + @added(ServiceApiVersions.v2024_05_01_preview) + topP?: float32 | null; + + /** The maximum number of prompt tokens specified to have been used over the course of the run. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "max_prompt_tokens") + @added(ServiceApiVersions.v2024_05_01_preview) + @minValue(256) + maxPromptTokens: int32 | null; + + /** The maximum number of completion tokens specified to have been used over the course of the run. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "max_completion_tokens") + @added(ServiceApiVersions.v2024_05_01_preview) + @minValue(256) + maxCompletionTokens: int32 | null; + + /** The strategy to use for dropping messages as the context windows moves forward. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "truncation_strategy") + @added(ServiceApiVersions.v2024_05_01_preview) + truncationStrategy: TruncationObject | null; + + /** Controls whether or not and which tool is called by the model. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "tool_choice") + @added(ServiceApiVersions.v2024_05_01_preview) + toolChoice: AssistantsApiToolChoiceOption | null; + + /** The response format of the tool calls used in this run. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "response_format") + @added(ServiceApiVersions.v2024_05_01_preview) + responseFormat: AssistantsApiResponseFormatOption | null; + ...RequiredNullableMetadata; } @@ -120,7 +159,9 @@ union IncompleteRunDetails { maxPromptTokens: "max_prompt_tokens", } -@doc("Usage statistics related to the run.") +/** + * 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) model RunCompletionUsage { @doc("Number of completion tokens used over the course of the run.") @@ -159,6 +200,12 @@ model CreateRunOptions { """) additionalInstructions?: string | null; + /** Adds additional messages to the thread before creating the run. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "additional_messages") + @added(ServiceApiVersions.v2024_05_01_preview) + additionalMessages?: ThreadMessage[] | null; + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @doc("The overridden list of enabled tools that the assistant should use to run the thread.") tools?: ToolDefinition[] | null; @@ -170,6 +217,70 @@ model CreateRunOptions { @added(ServiceApiVersions.v2024_02_15_preview) stream?: boolean; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(0) + @maxValue(2) + @added(ServiceApiVersions.v2024_05_01_preview) + temperature?: float32 | null = 1; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(0) + @maxValue(1) + @encodedName("application/json", "top_p") + @added(ServiceApiVersions.v2024_05_01_preview) + topP?: float32 | null = 1; + + /** + * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(256) + @encodedName("application/json", "max_prompt_tokens") + @added(ServiceApiVersions.v2024_05_01_preview) + maxPromptTokens?: int32 | null; + + /** + * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort + * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(256) + @encodedName("application/json", "max_completion_tokens") + @added(ServiceApiVersions.v2024_05_01_preview) + maxCompletionTokens?: int32 | null; + + /** The strategy to use for dropping messages as the context windows moves forward. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "truncation_strategy") + @added(ServiceApiVersions.v2024_05_01_preview) + truncationStrategy?: TruncationObject | null; + + /** Controls whether or not and which tool is called by the model. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "tool_choice") + @added(ServiceApiVersions.v2024_05_01_preview) + toolChoice?: AssistantsApiToolChoiceOption | null; + + /** Specifies the format that the model must output. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "response_format") + @added(ServiceApiVersions.v2024_05_01_preview) + responseFormat?: AssistantsApiResponseFormatOption | null; + ...OptionalNullableMetadata; } @@ -265,6 +376,12 @@ model CreateAndRunThreadOptions { @clientName("overrideTools", "csharp") tools?: ToolDefinition[] | null; + /** Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "tool_resources") + @added(ServiceApiVersions.v2024_05_01_preview) + toolResources?: UpdateToolResourcesOptions | 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. @@ -272,5 +389,106 @@ model CreateAndRunThreadOptions { @added(ServiceApiVersions.v2024_02_15_preview) stream?: boolean; + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + * more random, while lower values like 0.2 will make it more focused and deterministic. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(0) + @maxValue(2) + @added(ServiceApiVersions.v2024_05_01_preview) + temperature?: float32 | null = 1; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the model + * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + * comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or temperature but not both. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(0) + @maxValue(1) + @encodedName("application/json", "top_p") + @added(ServiceApiVersions.v2024_05_01_preview) + topP?: float32 | null = 1; + + /** + * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + * the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(256) + @encodedName("application/json", "max_prompt_tokens") + @added(ServiceApiVersions.v2024_05_01_preview) + maxPromptTokens?: int32 | null; + + /** + * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only + * the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens + * specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(256) + @encodedName("application/json", "max_completion_tokens") + @added(ServiceApiVersions.v2024_05_01_preview) + maxCompletionTokens?: int32 | null; + + /** The strategy to use for dropping messages as the context windows moves forward. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "truncation_strategy") + @added(ServiceApiVersions.v2024_05_01_preview) + truncationStrategy?: TruncationObject | null; + + /** Controls whether or not and which tool is called by the model. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "tool_choice") + @added(ServiceApiVersions.v2024_05_01_preview) + toolChoice?: AssistantsApiToolChoiceOption | null; + + /** Specifies the format that the model must output. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "response_format") + @added(ServiceApiVersions.v2024_05_01_preview) + responseFormat?: AssistantsApiResponseFormatOption | null; + ...OptionalNullableMetadata; } + +/** + * Controls for how a thread will be truncated prior to the run. Use this to control the initial + * context window of the run. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model TruncationObject { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will + * be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread + * will be dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: TruncationStrategy = TruncationStrategy.auto; + + /** + * The number of most recent messages from the thread when constructing the context for the run. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @minValue(1) + @added(ServiceApiVersions.v2024_05_01_preview) + @encodedName("application/json", "last_messages") + lastMessages?: int32 | null; +} + +/** + * Possible truncation strategies for the thread. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +union TruncationStrategy { + string, + + /** Default value. Messages in the middle of the thread will be dropped to fit the context length of the model. */ + auto: "auto", + + /** The thread will truncate to the `lastMessages` count of recent messages. */ + lastMessages: "last_messages", +} diff --git a/specification/ai/OpenAI.Assistants/runs/routes.tsp b/specification/ai/OpenAI.Assistants/runs/routes.tsp index d1387e794cfd..c65c2d07fa06 100644 --- a/specification/ai/OpenAI.Assistants/runs/routes.tsp +++ b/specification/ai/OpenAI.Assistants/runs/routes.tsp @@ -1,6 +1,8 @@ import "@typespec/rest"; import "@typespec/http"; import "@typespec/versioning"; + +import "../main.tsp"; import "../threads/models.tsp"; import "../runs/models.tsp"; import "./models.tsp"; diff --git a/specification/ai/OpenAI.Assistants/threads/models.tsp b/specification/ai/OpenAI.Assistants/threads/models.tsp index d4097d0fecb0..167bc432d197 100644 --- a/specification/ai/OpenAI.Assistants/threads/models.tsp +++ b/specification/ai/OpenAI.Assistants/threads/models.tsp @@ -1,7 +1,10 @@ import "@typespec/versioning"; + +import "../tools/tool_resources.tsp"; import "../common/models.tsp"; import "../messages/models.tsp"; +using TypeSpec.Http; using TypeSpec.Versioning; namespace Azure.AI.OpenAI.Assistants; @@ -20,14 +23,54 @@ model AssistantThread { @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; + /** + * A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type + * of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list + * of vector store IDs. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @added(ServiceApiVersions.v2024_05_01_preview) + @encodedName("application/json", "tool_resources") + toolResources: ToolResources | null; + ...RequiredNullableMetadata; } -@doc("The details used to create a new assistant thread.") +/** The details used to create a new assistant thread. */ @added(ServiceApiVersions.v2024_02_15_preview) model AssistantThreadCreationOptions { - @doc("The initial messages to associate with the new thread.") - messages?: ThreadInitializationMessage[]; + /** The initial messages to associate with the new thread. */ + @added(ServiceApiVersions.v2024_05_01_preview) + messages?: ThreadMessageOptions[]; + + /** + * A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + * a list of vector store IDs. + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "tool_resources") + @added(ServiceApiVersions.v2024_05_01_preview) + toolResources?: CreateToolResourcesOptions | null; + + ...OptionalNullableMetadata; +} + +/** The details used to update an existing assistant thread */ +@added(ServiceApiVersions.v2024_02_15_preview) +model UpdateAssistantThreadOptions { + /** The ID of the thread to modify. */ + @path threadId: string; + + /** + * A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + * a list of vector store IDs + */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "tool_resources") + @added(ServiceApiVersions.v2024_05_01_preview) + toolResources?: UpdateToolResourcesOptions | null; ...OptionalNullableMetadata; } diff --git a/specification/ai/OpenAI.Assistants/threads/routes.tsp b/specification/ai/OpenAI.Assistants/threads/routes.tsp index 6867743b97ec..53dbc7fa16de 100644 --- a/specification/ai/OpenAI.Assistants/threads/routes.tsp +++ b/specification/ai/OpenAI.Assistants/threads/routes.tsp @@ -43,6 +43,7 @@ op getThread(@path threadId: string): AssistantThread; * Modifies an existing thread. * * @param threadId The ID of the thread to modify. + * @param updateAssistantThreadOptions The details of the modification to perform on a specified thread. * @returns Information about the modified thread. */ #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" @@ -51,10 +52,7 @@ op getThread(@path threadId: string): AssistantThread; @post @route("/threads/{threadId}") @added(ServiceApiVersions.v2024_02_15_preview) -op updateThread( - @path threadId: string, - ...OptionalNullableMetadata, -): AssistantThread; +op updateThread(...UpdateAssistantThreadOptions): AssistantThread; /** * Deletes an existing thread. diff --git a/specification/ai/OpenAI.Assistants/tools/models.tsp b/specification/ai/OpenAI.Assistants/tools/models.tsp index 250013bdf449..7b0118649f98 100644 --- a/specification/ai/OpenAI.Assistants/tools/models.tsp +++ b/specification/ai/OpenAI.Assistants/tools/models.tsp @@ -25,11 +25,11 @@ model CodeInterpreterToolDefinition extends ToolDefinition { type: "code_interpreter"; } -@doc("The input definition information for a retrieval tool as used to configure an assistant.") -@added(ServiceApiVersions.v2024_02_15_preview) -model RetrievalToolDefinition extends ToolDefinition { - @doc("The object type, which is always 'retrieval'.") - type: "retrieval"; +@doc("The input definition information for a file search tool as used to configure an assistant.") +@added(ServiceApiVersions.v2024_05_01_preview) +model FileSearchToolDefinition extends ToolDefinition { + @doc("The object type, which is always 'file_search'.") + type: "file_search"; } @doc("The input definition information for a function tool as used to configure an assistant.") @@ -125,16 +125,17 @@ model RunStepCodeInterpreterToolCall extends RunStepToolCall { } @doc(""" -A record of a call to a retrieval tool, issued by the model in evaluation of a defined tool, that represents -executed retrieval actions. +A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents +executed file search. """) -@added(ServiceApiVersions.v2024_02_15_preview) -model RunStepRetrievalToolCall extends RunStepToolCall { - @doc("The object type, which is always 'retrieval'.") - type: "retrieval"; - - @doc("The key/value pairs produced by the retrieval tool.") - retrieval: Record; +@added(ServiceApiVersions.v2024_05_01_preview) +model RunStepFileSearchToolCall extends RunStepToolCall { + @doc("The object type, which is always 'file_search'.") + type: "file_search"; + + @doc("Reserved for future use.") + @encodedName("application/json", "file_search") + fileSearch: Record; } @doc(""" @@ -230,3 +231,65 @@ model ToolOutput { @doc("The output from the tool to be submitted.") output?: string; } + +/** + * Controls which (if any) tool is called by the model. + * - `none` means the model will not call any tools and instead generates a message. + * - `auto` is the default value and means the model can pick between generating a message or calling a tool. + * Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` + * forces the model to call that tool. + */ +#suppress "@azure-tools/typespec-autorest/union-unsupported" "This union is defined according to the OpenAI API" +@added(ServiceApiVersions.v2024_05_01_preview) +union AssistantsApiToolChoiceOption { + string, + + /** Specifies how the tool choice will be used */ + AssistantsApiToolChoiceOptionMode, + + /** Specifies a tool the model should use. Use to force the model to call a specific tool. */ + AssistantsNamedToolChoice, +} + +/** Specifies how the tool choice will be used */ +@added(ServiceApiVersions.v2024_05_01_preview) +union AssistantsApiToolChoiceOptionMode { + string, + + /** The model will not call a function and instead generates a message. */ + none: "none", + + /** The model can pick between generating a message or calling a function. */ + auto: "auto", +} +/** Specifies a tool the model should use. Use to force the model to call a specific tool. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model AssistantsNamedToolChoice { + /** the type of tool. If type is `function`, the function name must be set. */ + type: AssistantsNamedToolChoiceType; + + /** The name of the function to call */ + function?: FunctionName; +} + +/** Available tool types for assistants named tools. */ +@added(ServiceApiVersions.v2024_05_01_preview) +union AssistantsNamedToolChoiceType { + string, + + /** Tool type `function` */ + function: "function", + + /** Tool type `code_interpreter` */ + codeInterpreter: "code_interpreter", + + /** Tool type `file_search` */ + fileSearch: "file_search", +} + +/** The function name that will be used, if using the `funtion` tool */ +@added(ServiceApiVersions.v2024_05_01_preview) +model FunctionName { + /** The name of the function to call */ + name: string; +} diff --git a/specification/ai/OpenAI.Assistants/tools/tool_resources.tsp b/specification/ai/OpenAI.Assistants/tools/tool_resources.tsp new file mode 100644 index 000000000000..b3b5b81c9164 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/tools/tool_resources.tsp @@ -0,0 +1,164 @@ +import "@typespec/http"; +import "@typespec/versioning"; + +import "../main.tsp"; + +using TypeSpec.Http; +using TypeSpec.Versioning; + +namespace Azure.AI.OpenAI.Assistants; + +// +// Response objects +// + +/** + * A set of resources that are used by the assistant's tools. The resources are specific to the type of + * tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` + * tool requires a list of vector store IDs. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model ToolResources { + /** Resources to be used by the `code_interpreter tool` consisting of file IDs. */ + @encodedName("application/json", "code_interpreter") + codeInterpreter?: CodeInterpreterToolResource; + + /** Resources to be used by the `file_search` tool consisting of vector store IDs. */ + @encodedName("application/json", "file_search") + fileSearch?: FileSearchToolResource; +} + +/** + * A set of resources that are used by the `code_interpreter` tool. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model CodeInterpreterToolResource { + /** + * A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + * associated with the tool. + */ + @encodedName("application/json", "file_ids") + @maxItems(20) + fileIds: string[] = []; +} + +/** + * A set of resources that are used by the `file_search` tool. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model FileSearchToolResource { + /** + * The ID of the vector store attached to this assistant. There can be a maximum of 1 vector + * store attached to the assistant. + */ + @maxItems(1) + @encodedName("application/json", "vector_store_ids") + vectorStoreIds?: string[]; +} + +// +// Creation request objects +// + +/** + * Request object. A set of resources that are used by the assistant's tools. The resources are specific to the + * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` + * tool requires a list of vector store IDs. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model CreateToolResourcesOptions { + /** + * A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + * associated with the tool. + */ + @encodedName("application/json", "code_interpreter") + codeInterpreter?: CreateCodeInterpreterToolResourceOptions; + + /** A list of vector stores or their IDs made available to the `file_search` tool. */ + @encodedName("application/json", "file_search") + fileSearch?: CreateFileSearchToolResourceOptions; +} + +/** + * A set of resources that will be used by the `code_interpreter` tool. Request object. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model CreateCodeInterpreterToolResourceOptions { + /** A list of file IDs made available to the `code_interpreter` tool. */ + @maxItems(20) + @encodedName("application/json", "file_ids") + fileIds?: string[] = []; +} + +/** + * A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. + * For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + * a list of vector store IDs. + */ +#suppress "@azure-tools/typespec-autorest/union-unsupported" "This union is defined according to the OpenAI API" +@added(ServiceApiVersions.v2024_05_01_preview) +union CreateFileSearchToolResourceOptions { + /** The vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. */ + @encodedName("application/json", "vector_store_ids") + // @maxItems(1) // this can't be applied to string[] + vectorStoreIds: string[], + + /** A helper to create a vector store with file_ids and attach it to this assistant. There can be a maximum of 1 vector + * store attached to the assistant. */ + @encodedName("application/json", "vector_stores") + // @maxItems(1) // this can't be applied to string[] + vectorStores: CreateFileSearchToolResourceVectorStoreOptions[], +} + +/** File IDs associated to the vector store to be passed to the helper. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model CreateFileSearchToolResourceVectorStoreOptions { + /** A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store. */ + @encodedName("application/json", "file_ids") + @maxItems(10000) + fileIds: string[]; + + /** Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information + * about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of + * 512 characters long. */ + ...OptionalNullableMetadata; +} + +// +// Update request objects +// + +/** + * Request object. A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. + * For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of + * vector store IDs. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model UpdateToolResourcesOptions { + /** + * Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + * associated with the tool. + */ + @encodedName("application/json", "code_interpreter") + codeInterpreter?: UpdateCodeInterpreterToolResourceOptions; + + /** Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. */ + @encodedName("application/json", "file_search") + fileSearch?: UpdateFileSearchToolResourceOptions; +} + +/** Request object to update `code_interpreted` tool resources. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model UpdateCodeInterpreterToolResourceOptions { + /** A list of file IDs to override the current list of the assistant. */ + @maxItems(20) + fileIds?: string[]; +} + +/** Request object to update `file_search` tool resources. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model UpdateFileSearchToolResourceOptions { + /** A list of vector store IDs to override the current list of the assistant. */ + @maxItems(1) + vectorStoreIds?: string[]; +} diff --git a/specification/ai/OpenAI.Assistants/tspconfig.yaml b/specification/ai/OpenAI.Assistants/tspconfig.yaml index fc567429be5b..0fb0ba8bdd39 100644 --- a/specification/ai/OpenAI.Assistants/tspconfig.yaml +++ b/specification/ai/OpenAI.Assistants/tspconfig.yaml @@ -35,7 +35,7 @@ options: enable-sync-stack: true generate-tests: false custom-types-subpackage: "implementation.models" - custom-types: "FileListResponse,OpenAIPageableListOfAssistant,OpenAIPageableListOfAssistantFile,OpenAIPageableListOfMessageFile,OpenAIPageableListOfRunStep,OpenAIPageableListOfThreadMessage,OpenAIPageableListOfThreadRun" + custom-types: "FileListResponse,OpenAIPageableListOfAssistant,OpenAIPageableListOfRunStep,OpenAIPageableListOfThreadMessage,OpenAIPageableListOfThreadRun,OpenAIPageableListOfVectorStore,OpenAIPageableListOfVectorStoreFile" flavor: azure "@azure-tools/typespec-ts": package-dir: "openai" diff --git a/specification/ai/OpenAI.Assistants/vector_stores/file_batches/main.tsp b/specification/ai/OpenAI.Assistants/vector_stores/file_batches/main.tsp new file mode 100644 index 000000000000..3b662be82ec5 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/file_batches/main.tsp @@ -0,0 +1,2 @@ +import "./models.tsp"; +import "./routes.tsp"; diff --git a/specification/ai/OpenAI.Assistants/vector_stores/file_batches/models.tsp b/specification/ai/OpenAI.Assistants/vector_stores/file_batches/models.tsp new file mode 100644 index 000000000000..e5186371e912 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/file_batches/models.tsp @@ -0,0 +1,46 @@ +namespace Azure.AI.OpenAI.Assistants; + +using TypeSpec.Versioning; + +/** The status of the vector store file batch. */ +union VectorStoreFileBatchStatus { + string, + + /** The vector store is still processing this file batch. */ + inProgress: "in_progress", + + /** the vector store file batch is ready for use. */ + completed: "completed", + + /** The vector store file batch was cancelled. */ + cancelled: "cancelled", + + /** The vector store file batch failed to process. */ + failed: "failed", +} + +/** A batch of files attached to a vector store. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreFileBatch { + /** The identifier, which can be referenced in API endpoints. */ + id: string; + + /** The object type, which is always `vector_store.file_batch`. */ + object: "vector_store.files_batch"; + + /** The Unix timestamp (in seconds) for when the vector store files batch was created. */ + @encode("unixTimestamp", int32) + @encodedName("application/json", "created_at") + createdAt: utcDateTime; + + /** The ID of the vector store that the file is attached to. */ + @encodedName("application/json", "vector_store_id") + vectorStoreId: string; + + /** The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. */ + status: VectorStoreFileBatchStatus; + + /** Files count grouped by status processed or being processed by this vector store. */ + @encodedName("application/json", "file_counts") + fileCounts: VectorStoreFileCount; +} diff --git a/specification/ai/OpenAI.Assistants/vector_stores/file_batches/routes.tsp b/specification/ai/OpenAI.Assistants/vector_stores/file_batches/routes.tsp new file mode 100644 index 000000000000..f00e40b1b0d9 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/file_batches/routes.tsp @@ -0,0 +1,88 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@typespec/versioning"; + +import "../../main.tsp"; +import "../../common/models.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using TypeSpec.Versioning; + +namespace Azure.AI.OpenAI.Assistants; + +/** + * Create a vector store file batch. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@post +@route("/vector_stores/{vectorStoreId}/file_batches") +@added(ServiceApiVersions.v2024_05_01_preview) +op createVectorStoreFileBatch( + /** The ID of the vector store for which to create a File Batch. */ + @path vectorStoreId: string, + + /** A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files. */ + @minItems(1) + @maxItems(500) + @encodedName("application/json", "file_ids") + fileIds: string[], +): VectorStoreFileBatch; + +/** + * Retrieve a vector store file batch. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@get +@route("/vector_stores/{vectorStoreId}/file_batches/{batchId}") +@added(ServiceApiVersions.v2024_05_01_preview) +op getVectorStoreFileBatch( + /** The ID of the vector store that the file batch belongs to. */ + @path vectorStoreId: string, + + /** The ID of the file batch being retrieved. */ + @path batchId: string, +): VectorStoreFileBatch; + +/** + * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@post +@route("/vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel") +@added(ServiceApiVersions.v2024_05_01_preview) +op cancelVectorStoreFileBatch( + /** The ID of the vector store that the file batch belongs to. */ + @path vectorStoreId: string, + + /** The ID of the file batch to cancel. */ + @path batchId: string, +): VectorStoreFileBatch; + +/** + * Returns a list of vector store files in a batch. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@get +@route("/vector_stores/{vectorStoreId}/file_batches/{batchId}/files") +@added(ServiceApiVersions.v2024_05_01_preview) +op listVectorStoreFileBatchFiles( + /** The ID of the vector store that the file batch belongs to. */ + @path vectorStoreId: string, + + /** The ID of the file batch that the files belong to. */ + @path batchId: string, + + /** Filter by file status. */ + @query filter?: VectorStoreFileStatusFilter, + + ...OpenAIListRequestOptions, +): OpenAIPageableListOf; diff --git a/specification/ai/OpenAI.Assistants/vector_stores/files/main.tsp b/specification/ai/OpenAI.Assistants/vector_stores/files/main.tsp new file mode 100644 index 000000000000..3b662be82ec5 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/files/main.tsp @@ -0,0 +1,2 @@ +import "./models.tsp"; +import "./routes.tsp"; diff --git a/specification/ai/OpenAI.Assistants/vector_stores/files/models.tsp b/specification/ai/OpenAI.Assistants/vector_stores/files/models.tsp new file mode 100644 index 000000000000..0889b4d96b71 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/files/models.tsp @@ -0,0 +1,111 @@ +namespace Azure.AI.OpenAI.Assistants; + +using TypeSpec.Versioning; + +/** Query parameter filter for vector store file retrieval endpoint */ +@added(ServiceApiVersions.v2024_05_01_preview) +union VectorStoreFileStatusFilter { + string, + + /** Retrieve only files that are currently being processed */ + inProgress: "in_progress", + + /** Retrieve only files that have been successfully processed */ + completed: "completed", + + /** Retrieve only files that have failed to process */ + failed: "failed", + + /** Retrieve only files that were cancelled */ + cancelled: "cancelled", +} + +/** Vector store file status */ +@added(ServiceApiVersions.v2024_05_01_preview) +union VectorStoreFileStatus { + string, + + /** The file is currently being processed. */ + inProgress: "in_progress", + + /** The file has been successfully processed. */ + completed: "completed", + + /** The file has failed to process. */ + failed: "failed", + + /** The file was cancelled. */ + cancelled: "cancelled", +} + +/** Error code variants for vector store file processing */ +@added(ServiceApiVersions.v2024_05_01_preview) +union VectorStoreFileErrorCode { + string, + + /** An internal error occurred. */ + internalError: "internal_error", + + /** The file was not found. */ + fileNotFound: "file_not_found", + + /** The file could not be parsed. */ + parsingError: "parsing_error", + + /** The file has an unhandled mime type. */ + unhandledMimeType: "unhandled_mime_type", +} + +/** Details on the error that may have ocurred while processing a file for this vector store */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreFileError { + /** One of `server_error` or `rate_limit_exceeded`. */ + code: VectorStoreFileErrorCode; + + /** A human-readable description of the error. */ + message: string; +} + +/** Description of a file attached to a vector store. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreFile { + /** The identifier, which can be referenced in API endpoints. */ + id: string; + + /** The object type, which is always `vector_store.file`. */ + object: "vector_store.file"; + + /** + * The total vector store usage in bytes. Note that this may be different from the original file + * size. + */ + @encodedName("application/json", "usage_bytes") + usageBytes: int32; + + // Tool customization: _at and created are Unix encoded utcDateTime + /** The Unix timestamp (in seconds) for when the vector store file was created. */ + @encodedName("application/json", "created_at") + @encode("unixTimestamp", int32) + createdAt: utcDateTime; + + /** The ID of the vector store that the file is attached to. */ + @encodedName("application/json", "vector_store_id") + vectorStoreId: string; + + /** The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. */ + status: VectorStoreFileStatus; + + /** The last error associated with this vector store file. Will be `null` if there are no errors. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "last_error") + lastError: VectorStoreFileError | null; +} + +/** Response object for deleting a vector store file relationship. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreFileDeletionStatus { + ...DeletionStatus; + + /** The object type, which is always 'vector_store.deleted'. */ + object: "vector_store.file.deleted"; +} diff --git a/specification/ai/OpenAI.Assistants/vector_stores/files/routes.tsp b/specification/ai/OpenAI.Assistants/vector_stores/files/routes.tsp new file mode 100644 index 000000000000..2f0d81651415 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/files/routes.tsp @@ -0,0 +1,85 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@typespec/versioning"; + +import "../../main.tsp"; +import "../../common/models.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using TypeSpec.Versioning; + +namespace Azure.AI.OpenAI.Assistants; + +/** + * Returns a list of vector store files. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@get +@route("/vector_stores/{vectorStoreId}/files") +@added(ServiceApiVersions.v2024_05_01_preview) +op listVectorStoreFiles( + /** The ID of the vector store that the files belong to. */ + @path vectorStoreId: string, + + /** Filter by file status. */ + @query filter?: VectorStoreFileStatusFilter, + + ...OpenAIListRequestOptions, +): OpenAIPageableListOf; + +/** + * Create a vector store file by attaching a file to a vector store. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@post +@route("/vector_stores/{vectorStoreId}/files") +@added(ServiceApiVersions.v2024_05_01_preview) +op createVectorStoreFile( + /** The ID of the vector store for which to create a File. */ + @path vectorStoreId: string, + + /** A File ID that the vector store should use. Useful for tools like `file_search` that can access files. */ + @encodedName("application/json", "file_id") + @body + fileId: string, +): VectorStoreFile; + +/** + * Retrieves a vector store file. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@get +@route("/vector_stores/{vectorStoreId}/files/{fileId}") +@added(ServiceApiVersions.v2024_05_01_preview) +op getVectorStoreFile( + /** The ID of the vector store that the file belongs to. */ + @path vectorStoreId: string, + + /** The ID of the file being retrieved. */ + @path fileId: string, +): VectorStoreFile; + +/** + * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. + * To delete the file, use the delete file endpoint. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@delete +@route("/vector_stores/{vectorStoreId}/files/{fileId}") +@added(ServiceApiVersions.v2024_05_01_preview) +op deleteVectorStoreFile( + /** The ID of the vector store that the file belongs to. */ + @path vectorStoreId: string, + + /** The ID of the file to delete its relationship to the vector store. */ + @path fileId: string, +): VectorStoreFileDeletionStatus; diff --git a/specification/ai/OpenAI.Assistants/vector_stores/main.tsp b/specification/ai/OpenAI.Assistants/vector_stores/main.tsp new file mode 100644 index 000000000000..b10f4fb0fbec --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/main.tsp @@ -0,0 +1,5 @@ +import "./models.tsp"; +import "./routes.tsp"; + +import "./files/main.tsp"; +import "./file_batches/main.tsp"; diff --git a/specification/ai/OpenAI.Assistants/vector_stores/models.tsp b/specification/ai/OpenAI.Assistants/vector_stores/models.tsp new file mode 100644 index 000000000000..39242fb736a0 --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/models.tsp @@ -0,0 +1,161 @@ +namespace Azure.AI.OpenAI.Assistants; + +using TypeSpec.Versioning; + +/** The expiration policy for a vector store. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreExpirationPolicy { + /** Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`. */ + anchor: VectorStoreExpirationPolicyAnchor; + + /** The anchor timestamp after which the expiration policy applies. */ + @minValue(1) + @maxValue(365) + days: int32; +} + +/** Describes the relationship between the days and the expiration of this vector store */ +@added(ServiceApiVersions.v2024_05_01_preview) +union VectorStoreExpirationPolicyAnchor { + string, + + /** The expiration policy is based on the last time the vector store was active. */ + lastActiveAt: "last_active_at", +} + +/** Vector store possible status */ +@added(ServiceApiVersions.v2024_05_01_preview) +union VectorStoreStatus { + string, + + /** expired status indicates that this vector store has expired and is no longer available for use. */ + expired: "expired", + + /** in_progress status indicates that this vector store is still processing files. */ + inProgress: "in_progress", + + /** completed status indicates that this vector store is ready for use. */ + completed: "completed", +} + +/** Counts of files processed or being processed by this vector store grouped by status. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreFileCount { + /** The number of files that are currently being processed. */ + @encodedName("application/json", "in_progress") + inProgress: int32; + + /** The number of files that have been successfully processed. */ + completed: int32; + + /** The number of files that have failed to process. */ + failed: int32; + + /** The number of files that were cancelled. */ + cancelled: int32; + + /** The total number of files. */ + total: int32; +} + +/** + * A vector store is a collection of processed files can be used by the `file_search` tool. + */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStore { + /** The identifier, which can be referenced in API endpoints. */ + id: string; + + /** The object type, which is always `vector_store` */ + object: "vector_store"; + + // Tool customization: _at and created are Unix encoded utcDateTime + /** The Unix timestamp (in seconds) for when the vector store was created. */ + @encode("unixTimestamp", int32) + @encodedName("application/json", "created_at") + createdAt: utcDateTime; + + /** The name of the vector store. */ + name: string; + + /** The total number of bytes used by the files in the vector store. */ + @encodedName("application/json", "usage_bytes") + usageBytes: int32; + + /** Files count grouped by status processed or being processed by this vector store. */ + @encodedName("application/json", "file_counts") + fileCounts: VectorStoreFileCount; + + /** The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. */ + status: VectorStoreStatus; + + /** Details on when this vector store expires */ + @encodedName("application/json", "expires_after") + expiresAfter?: VectorStoreExpirationPolicy; + + /** The Unix timestamp (in seconds) for when the vector store will expire. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encode("unixTimestamp", int32) + @encodedName("application/json", "expires_at") + expiresAt?: utcDateTime | null; + + /** The Unix timestamp (in seconds) for when the vector store was last active. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encode("unixTimestamp", int32) + @encodedName("application/json", "last_active_at") + lastActiveAt: utcDateTime | null; + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + * additional information about the object in a structured format. Keys can be a maximum of 64 + * characters long and values can be a maximum of 512 characters long. + */ + ...RequiredNullableMetadata; +} + +/** Request object for creating a vector store. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreOptions { + /** A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. */ + @maxItems(500) + @encodedName("application/json", "file_ids") + fileIds?: string[]; + + /** The name of the vector store. */ + name?: string; + + /** Details on when this vector store expires */ + @encodedName("application/json", "expires_after") + expiresAfter?: VectorStoreExpirationPolicy; + + ...OptionalNullableMetadata; +} + +/** Request object for updating a vector store. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreUpdateOptions { + /** The name of the vector store. */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + name?: string | null; + + /** Details on when this vector store expires */ + #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" + @encodedName("application/json", "expires_after") + expiresAfter?: VectorStoreExpirationPolicy | null; + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + * additional information about the object in a structured format. Keys can be a maximum of 64 + * characters long and values can be a maximum of 512 characters long. + */ + ...OptionalNullableMetadata; +} + +/** Response object for deleting a vector store. */ +@added(ServiceApiVersions.v2024_05_01_preview) +model VectorStoreDeletionStatus { + ...DeletionStatus; + + /** The object type, which is always 'vector_store.deleted'. */ + object: "vector_store.deleted"; +} diff --git a/specification/ai/OpenAI.Assistants/vector_stores/routes.tsp b/specification/ai/OpenAI.Assistants/vector_stores/routes.tsp new file mode 100644 index 000000000000..a01dae88426f --- /dev/null +++ b/specification/ai/OpenAI.Assistants/vector_stores/routes.tsp @@ -0,0 +1,81 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@typespec/versioning"; + +import "../main.tsp"; +import "../common/models.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using TypeSpec.Versioning; + +namespace Azure.AI.OpenAI.Assistants; + +/** + * Returns a list of vector stores. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@get +@route("/vector_stores") +@added(ServiceApiVersions.v2024_05_01_preview) +op listVectorStores( + ...OpenAIListRequestOptions, +): OpenAIPageableListOf; + +/** + * Creates a vector store. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@post +@route("/vector_stores") +@added(ServiceApiVersions.v2024_05_01_preview) +op createVectorStore(...VectorStoreOptions): VectorStore; + +/** + * Returns the vector store object matching the specified ID. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@get +@route("/vector_stores/{vectorStoreId}") +@added(ServiceApiVersions.v2024_05_01_preview) +op getVectorStore( + /** The ID of the vector store to retrieve. */ + @path vectorStoreId: string, +): VectorStore; + +/** + * The ID of the vector store to modify. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@post +@route("/vector_stores/{vectorStoreId}") +@added(ServiceApiVersions.v2024_05_01_preview) +op modifyVectorStore( + /** The ID of the vector store to modify. */ + @path vectorStoreId: string, + + ...VectorStoreUpdateOptions, +): VectorStore; + +/** + * Deletes the vector store object matching the specified ID. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API responds with a container" +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "not yet an Azure operation" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned" +@delete +@route("/vector_stores/{vectorStoreId}") +@added(ServiceApiVersions.v2024_05_01_preview) +op deleteVectorStore( + /** The ID of the vector store to delete. */ + @path vectorStoreId: string, +): VectorStoreDeletionStatus; 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 f9ebf70421c8..e1a20fe445e2 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 @@ -259,219 +259,6 @@ } } }, - "/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", @@ -716,28 +503,14 @@ "description": "Modifies an existing thread.", "parameters": [ { - "name": "threadId", - "in": "path", - "description": "The ID of the thread to modify.", - "required": true, - "type": "string" + "$ref": "#/parameters/UpdateAssistantThreadOptions.threadId" }, { "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" - } - } - } + "$ref": "#/definitions/UpdateAssistantThreadOptions" } } ], @@ -897,287 +670,89 @@ "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" - ] + "$ref": "#/definitions/ThreadMessage" } } } } }, - "/threads/{threadId}/messages/{messageId}/files/{fileId}": { + "/threads/{threadId}/messages/{messageId}": { "get": { - "operationId": "GetMessageFile", - "description": "Gets information about a file attachment to a message within a thread.", + "operationId": "GetMessage", + "description": "Gets an existing message from an existing thread.", "parameters": [ { "name": "threadId", "in": "path", - "description": "The ID of the thread containing the message to get information from.", + "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 get information from.", + "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": "fileId", + "name": "messageId", "in": "path", - "description": "The ID of the file to get information about.", + "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": "The requested file information.", + "description": "A representation of the modified message.", "schema": { - "$ref": "#/definitions/MessageFile" + "$ref": "#/definitions/ThreadMessage" } } } @@ -1730,15 +1305,6 @@ }, "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.", @@ -1757,7 +1323,6 @@ "model", "instructions", "tools", - "file_ids", "metadata" ] }, @@ -1793,15 +1358,6 @@ }, "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.", @@ -1844,72 +1400,6 @@ "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.", @@ -1954,14 +1444,6 @@ "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.", @@ -2252,43 +1734,6 @@ "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.", @@ -2323,6 +1768,19 @@ "file_id" ] }, + "MessageIncompleteDetails": { + "type": "object", + "description": "Information providing additional detail about a message entering an incomplete status.", + "properties": { + "reason": { + "$ref": "#/definitions/MessageIncompleteDetailsReason", + "description": "The provided reason describing why the message was marked as incomplete." + } + }, + "required": [ + "reason" + ] + }, "MessageIncompleteDetailsReason": { "type": "string", "description": "A set of reasons describing why a message is marked as incomplete.", @@ -2481,11 +1939,11 @@ }, "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.", + "description": "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the 'file_search' tool to search files.", "properties": { "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.", + "description": "A citation within the message that points to a specific quote from a specific file.\nGenerated when the assistant uses the \"file_search\" tool to search files.", "x-ms-client-name": "fileCitation" }, "start_index": { @@ -2693,19 +2151,9 @@ "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.", + "description": "Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).", "properties": { "completion_tokens": { "type": "integer", @@ -3208,28 +2656,6 @@ "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.", @@ -3404,41 +2830,6 @@ "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.", @@ -3473,9 +2864,14 @@ "description": "The status of the message." }, "incomplete_details": { - "$ref": "#/definitions/MessageIncompleteDetailsReason", + "type": "object", "description": "On an incomplete message, details about why the message is incomplete.", "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/MessageIncompleteDetails" + } + ], "x-ms-client-name": "incompleteDetails" }, "completed_at": { @@ -3507,21 +2903,15 @@ "assistant_id": { "type": "string", "description": "If applicable, the ID of the assistant that authored this message.", + "x-nullable": true, "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-nullable": true, "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.", @@ -3542,7 +2932,8 @@ "incomplete_at", "role", "content", - "file_ids", + "assistant_id", + "run_id", "metadata" ] }, @@ -3617,15 +3008,6 @@ }, "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", @@ -3702,7 +3084,6 @@ "model", "instructions", "tools", - "file_ids", "created_at", "expires_at", "started_at", @@ -3775,15 +3156,20 @@ }, "x-ms-identifiers": [] }, - "file_ids": { - "type": "array", - "description": "The modified list of previously uploaded fileIDs to attach to the assistant.", - "default": [], - "items": { + "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" - }, - "x-ms-client-name": "fileIds" - }, + } + } + } + }, + "UpdateAssistantThreadOptions": { + "type": "object", + "description": "The details used to update an existing assistant thread", + "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.", @@ -3803,6 +3189,14 @@ "required": true, "type": "string", "x-ms-parameter-location": "method" + }, + "UpdateAssistantThreadOptions.threadId": { + "name": "threadId", + "in": "path", + "description": "The ID of the thread to modify.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" } } } 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..3784be740a46 --- /dev/null +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV2/preview/2024-05-01-preview/assistants_generated.json @@ -0,0 +1,5184 @@ +{ + "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" + } + } + } + } + }, + "/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", + "batch", + "batch_output", + "vision" + ], + "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": "batch", + "value": "batch", + "description": "Indicates a file is used as input to ." + }, + { + "name": "batchOutput", + "value": "batch_output", + "description": "Indicates a file is used as output by a vector store batch operation." + }, + { + "name": "vision", + "value": "vision", + "description": "Indicates a file is used as input to a vision operation." + } + ] + } + } + ], + "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", + "batch", + "batch_output", + "vision" + ], + "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": "batch", + "value": "batch", + "description": "Indicates a file is used as input to ." + }, + { + "name": "batchOutput", + "value": "batch_output", + "description": "Indicates a file is used as output by a vector store batch operation." + }, + { + "name": "vision", + "value": "vision", + "description": "Indicates a file is used as input to a vision operation." + } + ] + } + }, + { + "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": [ + { + "$ref": "#/parameters/UpdateAssistantThreadOptions.threadId" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAssistantThreadOptions" + } + } + ], + "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": "runId", + "in": "query", + "description": "Filter messages by the run ID that generated them.", + "required": false, + "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": "threadMessageOptions", + "in": "body", + "description": "A single message within an assistant thread, as provided during that thread's creation for its initial state.", + "required": true, + "schema": { + "$ref": "#/definitions/ThreadMessageOptions" + } + } + ], + "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}/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" + } + } + } + } + }, + "/vector_stores": { + "get": { + "operationId": "ListVectorStores", + "description": "Returns a list of vector stores.", + "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 request has succeeded.", + "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/VectorStore" + } + }, + "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": "CreateVectorStore", + "description": "Creates a vector store.", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/VectorStoreOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStore" + } + } + } + } + }, + "/vector_stores/{vectorStoreId}": { + "get": { + "operationId": "GetVectorStore", + "description": "Returns the vector store object matching the specified ID.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store to retrieve.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStore" + } + } + } + }, + "post": { + "operationId": "ModifyVectorStore", + "description": "The ID of the vector store to modify.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store to modify.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/VectorStoreUpdateOptions" + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStore" + } + } + } + }, + "delete": { + "operationId": "DeleteVectorStore", + "description": "Deletes the vector store object matching the specified ID.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store to delete.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStoreDeletionStatus" + } + } + } + } + }, + "/vector_stores/{vectorStoreId}/file_batches": { + "post": { + "operationId": "CreateVectorStoreFileBatch", + "description": "Create a vector store file batch.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store for which to create a File Batch.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files.", + "minItems": 1, + "maxItems": 500, + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + } + }, + "required": [ + "file_ids" + ] + } + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStoreFileBatch" + } + } + } + } + }, + "/vector_stores/{vectorStoreId}/file_batches/{batchId}": { + "get": { + "operationId": "GetVectorStoreFileBatch", + "description": "Retrieve a vector store file batch.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store that the file batch belongs to.", + "required": true, + "type": "string" + }, + { + "name": "batchId", + "in": "path", + "description": "The ID of the file batch being retrieved.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStoreFileBatch" + } + } + } + } + }, + "/vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel": { + "post": { + "operationId": "CancelVectorStoreFileBatch", + "description": "Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store that the file batch belongs to.", + "required": true, + "type": "string" + }, + { + "name": "batchId", + "in": "path", + "description": "The ID of the file batch to cancel.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStoreFileBatch" + } + } + } + } + }, + "/vector_stores/{vectorStoreId}/file_batches/{batchId}/files": { + "get": { + "operationId": "ListVectorStoreFileBatchFiles", + "description": "Returns a list of vector store files in a batch.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store that the file batch belongs to.", + "required": true, + "type": "string" + }, + { + "name": "batchId", + "in": "path", + "description": "The ID of the file batch that the files belong to.", + "required": true, + "type": "string" + }, + { + "name": "filter", + "in": "query", + "description": "Filter by file status.", + "required": false, + "type": "string", + "enum": [ + "in_progress", + "completed", + "failed", + "cancelled" + ], + "x-ms-enum": { + "name": "VectorStoreFileStatusFilter", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "Retrieve only files that are currently being processed" + }, + { + "name": "completed", + "value": "completed", + "description": "Retrieve only files that have been successfully processed" + }, + { + "name": "failed", + "value": "failed", + "description": "Retrieve only files that have failed to process" + }, + { + "name": "cancelled", + "value": "cancelled", + "description": "Retrieve only files that were cancelled" + } + ] + } + }, + { + "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 request has succeeded.", + "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/VectorStoreFile" + } + }, + "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" + ] + } + } + } + } + }, + "/vector_stores/{vectorStoreId}/files": { + "get": { + "operationId": "ListVectorStoreFiles", + "description": "Returns a list of vector store files.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store that the files belong to.", + "required": true, + "type": "string" + }, + { + "name": "filter", + "in": "query", + "description": "Filter by file status.", + "required": false, + "type": "string", + "enum": [ + "in_progress", + "completed", + "failed", + "cancelled" + ], + "x-ms-enum": { + "name": "VectorStoreFileStatusFilter", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "Retrieve only files that are currently being processed" + }, + { + "name": "completed", + "value": "completed", + "description": "Retrieve only files that have been successfully processed" + }, + { + "name": "failed", + "value": "failed", + "description": "Retrieve only files that have failed to process" + }, + { + "name": "cancelled", + "value": "cancelled", + "description": "Retrieve only files that were cancelled" + } + ] + } + }, + { + "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 request has succeeded.", + "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/VectorStoreFile" + } + }, + "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": "CreateVectorStoreFile", + "description": "Create a vector store file by attaching a file to a vector store.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store for which to create a File.", + "required": true, + "type": "string" + }, + { + "name": "file_id", + "in": "body", + "description": "A File ID that the vector store should use. Useful for tools like `file_search` that can access files.", + "required": true, + "schema": { + "type": "string" + }, + "x-ms-client-name": "fileId" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStoreFile" + } + } + } + } + }, + "/vector_stores/{vectorStoreId}/files/{fileId}": { + "get": { + "operationId": "GetVectorStoreFile", + "description": "Retrieves a vector store file.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store that the file belongs to.", + "required": true, + "type": "string" + }, + { + "name": "fileId", + "in": "path", + "description": "The ID of the file being retrieved.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStoreFile" + } + } + } + }, + "delete": { + "operationId": "DeleteVectorStoreFile", + "description": "Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted.\nTo delete the file, use the delete file endpoint.", + "parameters": [ + { + "name": "vectorStoreId", + "in": "path", + "description": "The ID of the vector store that the file belongs to.", + "required": true, + "type": "string" + }, + { + "name": "fileId", + "in": "path", + "description": "The ID of the file to delete its relationship to the vector store.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/VectorStoreFileDeletionStatus" + } + } + } + } + } + }, + "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": [] + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter`\ntool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/ToolResources" + } + ], + "x-ms-client-name": "toolResources" + }, + "temperature": { + "type": "number", + "format": "float", + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,\nwhile lower values like 0.2 will make it more focused and deterministic.", + "default": 1, + "x-nullable": true + }, + "top_p": { + "type": "number", + "format": "float", + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.\nSo 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.", + "default": 1, + "x-nullable": true, + "x-ms-client-name": "topP" + }, + "response_format": { + "$ref": "#/definitions/AssistantsApiResponseFormatOption", + "description": "The response format of the tool calls used by this assistant.", + "x-nullable": true, + "x-ms-client-name": "responseFormat" + }, + "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", + "tool_resources", + "temperature", + "top_p", + "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": [] + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter`\ntool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/CreateToolResourcesOptions" + } + ], + "x-ms-client-name": "toolResources" + }, + "temperature": { + "type": "number", + "format": "float", + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,\nwhile lower values like 0.2 will make it more focused and deterministic.", + "default": 1, + "x-nullable": true + }, + "top_p": { + "type": "number", + "format": "float", + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.\nSo 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.", + "default": 1, + "x-nullable": true, + "x-ms-client-name": "topP" + }, + "response_format": { + "$ref": "#/definitions/AssistantsApiResponseFormatOption", + "description": "The response format of the tool calls used by this assistant.", + "x-nullable": true, + "x-ms-client-name": "responseFormat" + }, + "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" + ] + }, + "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" + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type\nof tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list\nof vector store IDs.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/ToolResources" + } + ], + "x-ms-client-name": "toolResources" + }, + "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", + "tool_resources", + "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/ThreadMessageOptions" + }, + "x-ms-identifiers": [] + }, + "tool_resources": { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the\ntype of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires\na list of vector store IDs.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/CreateToolResourcesOptions" + } + ], + "x-ms-client-name": "toolResources" + }, + "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" + } + } + } + }, + "AssistantsApiResponseFormatOption": {}, + "AssistantsApiToolChoiceOption": {}, + "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" + }, + "CodeInterpreterToolResource": { + "type": "object", + "description": "A set of resources that are used by the `code_interpreter` tool.", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files\nassociated with the tool.", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + } + }, + "required": [ + "file_ids" + ] + }, + "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": [] + }, + "tool_resources": { + "type": "object", + "description": "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/UpdateToolResourcesOptions" + } + ], + "x-ms-client-name": "toolResources" + }, + "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." + }, + "temperature": { + "type": "number", + "format": "float", + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output\nmore random, while lower values like 0.2 will make it more focused and deterministic.", + "default": 1, + "x-nullable": true + }, + "top_p": { + "type": "number", + "format": "float", + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model\nconsiders the results of the tokens with top_p probability mass. So 0.1 means only the tokens\ncomprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.", + "default": 1, + "x-nullable": true, + "x-ms-client-name": "topP" + }, + "max_prompt_tokens": { + "type": "integer", + "format": "int32", + "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only\nthe number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified,\nthe run will end with status `incomplete`. See `incomplete_details` for more info.", + "x-nullable": true, + "x-ms-client-name": "maxPromptTokens" + }, + "max_completion_tokens": { + "type": "integer", + "format": "int32", + "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only\nthe number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens\nspecified, the run will end with status `incomplete`. See `incomplete_details` for more info.", + "x-nullable": true, + "x-ms-client-name": "maxCompletionTokens" + }, + "truncation_strategy": { + "type": "object", + "description": "The strategy to use for dropping messages as the context windows moves forward.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/TruncationObject" + } + ], + "x-ms-client-name": "truncationStrategy" + }, + "tool_choice": { + "$ref": "#/definitions/AssistantsApiToolChoiceOption", + "description": "Controls whether or not and which tool is called by the model.", + "x-nullable": true, + "x-ms-client-name": "toolChoice" + }, + "response_format": { + "$ref": "#/definitions/AssistantsApiResponseFormatOption", + "description": "Specifies the format that the model must output.", + "x-nullable": true, + "x-ms-client-name": "responseFormat" + }, + "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" + ] + }, + "CreateCodeInterpreterToolResourceOptions": { + "type": "object", + "description": "A set of resources that will be used by the `code_interpreter` tool. Request object.", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of file IDs made available to the `code_interpreter` tool.", + "default": [], + "maxItems": 20, + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + } + } + }, + "CreateFileSearchToolResourceOptions": {}, + "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" + }, + "additional_messages": { + "type": "array", + "description": "Adds additional messages to the thread before creating the run.", + "x-nullable": true, + "items": { + "$ref": "#/definitions/ThreadMessage" + }, + "x-ms-client-name": "additionalMessages" + }, + "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." + }, + "temperature": { + "type": "number", + "format": "float", + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output\nmore random, while lower values like 0.2 will make it more focused and deterministic.", + "default": 1, + "x-nullable": true + }, + "top_p": { + "type": "number", + "format": "float", + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model\nconsiders the results of the tokens with top_p probability mass. So 0.1 means only the tokens\ncomprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.", + "default": 1, + "x-nullable": true, + "x-ms-client-name": "topP" + }, + "max_prompt_tokens": { + "type": "integer", + "format": "int32", + "description": "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only\nthe number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified,\nthe run will end with status `incomplete`. See `incomplete_details` for more info.", + "x-nullable": true, + "x-ms-client-name": "maxPromptTokens" + }, + "max_completion_tokens": { + "type": "integer", + "format": "int32", + "description": "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort\nto use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of\ncompletion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.", + "x-nullable": true, + "x-ms-client-name": "maxCompletionTokens" + }, + "truncation_strategy": { + "type": "object", + "description": "The strategy to use for dropping messages as the context windows moves forward.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/TruncationObject" + } + ], + "x-ms-client-name": "truncationStrategy" + }, + "tool_choice": { + "$ref": "#/definitions/AssistantsApiToolChoiceOption", + "description": "Controls whether or not and which tool is called by the model.", + "x-nullable": true, + "x-ms-client-name": "toolChoice" + }, + "response_format": { + "$ref": "#/definitions/AssistantsApiResponseFormatOption", + "description": "Specifies the format that the model must output.", + "x-nullable": true, + "x-ms-client-name": "responseFormat" + }, + "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" + ] + }, + "CreateToolResourcesOptions": { + "type": "object", + "description": "Request object. A set of resources that are used by the assistant's tools. The resources are specific to the\ntype of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search`\ntool requires a list of vector store IDs.", + "properties": { + "code_interpreter": { + "$ref": "#/definitions/CreateCodeInterpreterToolResourceOptions", + "description": "A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files\nassociated with the tool.", + "x-ms-client-name": "codeInterpreter" + }, + "file_search": { + "$ref": "#/definitions/CreateFileSearchToolResourceOptions", + "description": "A list of vector stores or their IDs made available to the `file_search` tool.", + "x-ms-client-name": "fileSearch" + } + } + }, + "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", + "batch", + "batch_output", + "vision" + ], + "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": "batch", + "value": "batch", + "description": "Indicates a file is used as input to ." + }, + { + "name": "batchOutput", + "value": "batch_output", + "description": "Indicates a file is used as output by a vector store batch operation." + }, + { + "name": "vision", + "value": "vision", + "description": "Indicates a file is used as input to a vision operation." + } + ] + } + }, + "FileSearchToolDefinition": { + "type": "object", + "description": "The input definition information for a file search tool as used to configure an assistant.", + "allOf": [ + { + "$ref": "#/definitions/ToolDefinition" + } + ], + "x-ms-discriminator-value": "file_search" + }, + "FileSearchToolResource": { + "type": "object", + "description": "A set of resources that are used by the `file_search` tool.", + "properties": { + "vector_store_ids": { + "type": "array", + "description": "The ID of the vector store attached to this assistant. There can be a maximum of 1 vector\nstore attached to the assistant.", + "maxItems": 1, + "items": { + "type": "string" + }, + "x-ms-client-name": "vectorStoreIds" + } + } + }, + "FileState": { + "type": "string", + "description": "The state of the file.", + "enum": [ + "uploaded", + "pending", + "running", + "processed", + "error", + "deleting", + "deleted" + ], + "x-ms-enum": { + "name": "FileState", + "modelAsString": true, + "values": [ + { + "name": "uploaded", + "value": "uploaded", + "description": "The file has been uploaded but it's not yet processed. This state is not returned by Azure OpenAI and exposed only for\ncompatibility. It can be categorized as an inactive state." + }, + { + "name": "pending", + "value": "pending", + "description": "The operation was created and is not queued to be processed in the future. It can be categorized as an inactive state." + }, + { + "name": "running", + "value": "running", + "description": "The operation has started to be processed. It can be categorized as an active state." + }, + { + "name": "processed", + "value": "processed", + "description": "The operation has successfully processed and is ready for consumption. It can be categorized as a terminal state." + }, + { + "name": "error", + "value": "error", + "description": "The operation has completed processing with a failure and cannot be further consumed. It can be categorized as a terminal state." + }, + { + "name": "deleting", + "value": "deleting", + "description": "The entity is in the process to be deleted. This state is not returned by Azure OpenAI and exposed only for compatibility.\nIt can be categorized as an active state." + }, + { + "name": "deleted", + "value": "deleted", + "description": "The entity has been deleted but may still be referenced by other entities predating the deletion. It can be categorized as a\nterminal state." + } + ] + } + }, + "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" + } + ] + } + }, + "MessageAttachment": { + "type": "object", + "description": "This describes to which tools a file has been attached.", + "properties": { + "file_id": { + "type": "string", + "description": "The ID of the file to attach to the message.", + "x-ms-client-name": "fileId" + }, + "tools": { + "type": "array", + "description": "The tools to add to this file.", + "items": { + "$ref": "#/definitions/MessageAttachmentToolDefinition" + } + } + }, + "required": [ + "file_id", + "tools" + ] + }, + "MessageAttachmentToolDefinition": { + "x-nullable": false + }, + "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" + ] + }, + "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" + ] + }, + "MessageIncompleteDetails": { + "type": "object", + "description": "Information providing additional detail about a message entering an incomplete status.", + "properties": { + "reason": { + "$ref": "#/definitions/MessageIncompleteDetailsReason", + "description": "The provided reason describing why the message was marked as incomplete." + } + }, + "required": [ + "reason" + ] + }, + "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 'file_search' 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 \"file_search\" 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." + }, + "status": { + "$ref": "#/definitions/FileState", + "description": "The state of the file. This field is available in Azure OpenAI only." + }, + "status_details": { + "type": "string", + "description": "The error message with details in case processing of this file failed. This field is available in Azure OpenAI only.", + "x-ms-client-name": "statusDetails" + } + }, + "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" + ] + }, + "RunCompletionUsage": { + "type": "object", + "description": "Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).", + "properties": { + "completion_tokens": { + "type": "integer", + "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." + } + ] + } + }, + "RunStepFileSearchToolCall": { + "type": "object", + "description": "A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents\nexecuted file search.", + "properties": { + "file_search": { + "type": "object", + "description": "Reserved for future use.", + "additionalProperties": { + "type": "string" + }, + "x-ms-client-name": "fileSearch" + } + }, + "required": [ + "file_search" + ], + "allOf": [ + { + "$ref": "#/definitions/RunStepToolCall" + } + ], + "x-ms-discriminator-value": "file_search" + }, + "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" + ] + }, + "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" + ] + }, + "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": { + "type": "object", + "description": "On an incomplete message, details about why the message is incomplete.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/MessageIncompleteDetails" + } + ], + "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-nullable": true, + "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-nullable": true, + "x-ms-client-name": "runId" + }, + "attachments": { + "type": "array", + "description": "A list of files attached to the message, and the tools they were added to.", + "x-nullable": true, + "items": { + "$ref": "#/definitions/MessageAttachment" + }, + "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" + } + } + }, + "required": [ + "id", + "object", + "created_at", + "thread_id", + "status", + "incomplete_details", + "completed_at", + "incomplete_at", + "role", + "content", + "assistant_id", + "run_id", + "attachments", + "metadata" + ] + }, + "ThreadMessageOptions": { + "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 of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into\nthe conversation." + }, + "content": { + "type": "string", + "description": "The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via\na separate call to the create message API." + }, + "attachments": { + "type": "array", + "description": "A list of files attached to the message, and the tools they should be added to.", + "x-nullable": true, + "items": { + "$ref": "#/definitions/MessageAttachment" + }, + "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" + } + } + }, + "required": [ + "role", + "content" + ] + }, + "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": [] + }, + "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" + } + ] + }, + "temperature": { + "type": "number", + "format": "float", + "description": "The sampling temperature used for this run. If not set, defaults to 1.", + "x-nullable": true + }, + "top_p": { + "type": "number", + "format": "float", + "description": "The nucleus sampling value used for this run. If not set, defaults to 1.", + "x-nullable": true, + "x-ms-client-name": "topP" + }, + "max_prompt_tokens": { + "type": "integer", + "format": "int32", + "description": "The maximum number of prompt tokens specified to have been used over the course of the run.", + "x-nullable": true, + "x-ms-client-name": "maxPromptTokens" + }, + "max_completion_tokens": { + "type": "integer", + "format": "int32", + "description": "The maximum number of completion tokens specified to have been used over the course of the run.", + "x-nullable": true, + "x-ms-client-name": "maxCompletionTokens" + }, + "truncation_strategy": { + "type": "object", + "description": "The strategy to use for dropping messages as the context windows moves forward.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/TruncationObject" + } + ], + "x-ms-client-name": "truncationStrategy" + }, + "tool_choice": { + "$ref": "#/definitions/AssistantsApiToolChoiceOption", + "description": "Controls whether or not and which tool is called by the model.", + "x-nullable": true, + "x-ms-client-name": "toolChoice" + }, + "response_format": { + "$ref": "#/definitions/AssistantsApiResponseFormatOption", + "description": "The response format of the tool calls used in this run.", + "x-nullable": true, + "x-ms-client-name": "responseFormat" + }, + "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", + "created_at", + "expires_at", + "started_at", + "completed_at", + "cancelled_at", + "failed_at", + "incomplete_details", + "usage", + "max_prompt_tokens", + "max_completion_tokens", + "truncation_strategy", + "tool_choice", + "response_format", + "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." + } + } + }, + "ToolResources": { + "type": "object", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of\ntool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search`\ntool requires a list of vector store IDs.", + "properties": { + "code_interpreter": { + "$ref": "#/definitions/CodeInterpreterToolResource", + "description": "Resources to be used by the `code_interpreter tool` consisting of file IDs.", + "x-ms-client-name": "codeInterpreter" + }, + "file_search": { + "$ref": "#/definitions/FileSearchToolResource", + "description": "Resources to be used by the `file_search` tool consisting of vector store IDs.", + "x-ms-client-name": "fileSearch" + } + } + }, + "TruncationObject": { + "type": "object", + "description": "Controls for how a thread will be truncated prior to the run. Use this to control the initial\ncontext window of the run.", + "properties": { + "type": { + "type": "string", + "description": "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will\nbe truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread\nwill be dropped to fit the context length of the model, `max_prompt_tokens`.", + "default": "auto", + "enum": [ + "auto", + "last_messages" + ], + "x-ms-enum": { + "name": "TruncationStrategy", + "modelAsString": true, + "values": [ + { + "name": "auto", + "value": "auto", + "description": "Default value. Messages in the middle of the thread will be dropped to fit the context length of the model." + }, + { + "name": "lastMessages", + "value": "last_messages", + "description": "The thread will truncate to the `lastMessages` count of recent messages." + } + ] + } + }, + "last_messages": { + "type": "integer", + "format": "int32", + "description": "The number of most recent messages from the thread when constructing the context for the run.", + "x-nullable": true, + "x-ms-client-name": "lastMessages" + } + }, + "required": [ + "type" + ] + }, + "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": [] + }, + "tool_resources": { + "$ref": "#/definitions/UpdateToolResourcesOptions", + "description": "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example,\nthe `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.", + "x-ms-client-name": "toolResources" + }, + "temperature": { + "type": "number", + "format": "float", + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,\nwhile lower values like 0.2 will make it more focused and deterministic.", + "default": 1, + "x-nullable": true + }, + "top_p": { + "type": "number", + "format": "float", + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.\nSo 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.", + "default": 1, + "x-nullable": true, + "x-ms-client-name": "topP" + }, + "response_format": { + "$ref": "#/definitions/AssistantsApiResponseFormatOption", + "description": "The response format of the tool calls used by this assistant.", + "x-nullable": true, + "x-ms-client-name": "responseFormat" + }, + "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" + } + } + } + }, + "UpdateAssistantThreadOptions": { + "type": "object", + "description": "The details used to update an existing assistant thread", + "properties": { + "tool_resources": { + "type": "object", + "description": "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the\ntype of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires\na list of vector store IDs", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/UpdateToolResourcesOptions" + } + ], + "x-ms-client-name": "toolResources" + }, + "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" + } + } + } + }, + "UpdateCodeInterpreterToolResourceOptions": { + "type": "object", + "description": "Request object to update `code_interpreted` tool resources.", + "properties": { + "fileIds": { + "type": "array", + "description": "A list of file IDs to override the current list of the assistant.", + "maxItems": 20, + "items": { + "type": "string" + } + } + } + }, + "UpdateFileSearchToolResourceOptions": { + "type": "object", + "description": "Request object to update `file_search` tool resources.", + "properties": { + "vectorStoreIds": { + "type": "array", + "description": "A list of vector store IDs to override the current list of the assistant.", + "maxItems": 1, + "items": { + "type": "string" + } + } + } + }, + "UpdateToolResourcesOptions": { + "type": "object", + "description": "Request object. A set of resources that are used by the assistant's tools. The resources are specific to the type of tool.\nFor example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of\nvector store IDs.", + "properties": { + "code_interpreter": { + "$ref": "#/definitions/UpdateCodeInterpreterToolResourceOptions", + "description": "Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files\nassociated with the tool.", + "x-ms-client-name": "codeInterpreter" + }, + "file_search": { + "$ref": "#/definitions/UpdateFileSearchToolResourceOptions", + "description": "Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.", + "x-ms-client-name": "fileSearch" + } + } + }, + "VectorStore": { + "type": "object", + "description": "A vector store is a collection of processed files can be used by the `file_search` tool.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always `vector_store`", + "enum": [ + "vector_store" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the vector store was created.", + "x-ms-client-name": "createdAt" + }, + "name": { + "type": "string", + "description": "The name of the vector store." + }, + "usage_bytes": { + "type": "integer", + "format": "int32", + "description": "The total number of bytes used by the files in the vector store.", + "x-ms-client-name": "usageBytes" + }, + "file_counts": { + "$ref": "#/definitions/VectorStoreFileCount", + "description": "Files count grouped by status processed or being processed by this vector store.", + "x-ms-client-name": "fileCounts" + }, + "status": { + "$ref": "#/definitions/VectorStoreStatus", + "description": "The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use." + }, + "expires_after": { + "$ref": "#/definitions/VectorStoreExpirationPolicy", + "description": "Details on when this vector store expires", + "x-ms-client-name": "expiresAfter" + }, + "expires_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the vector store will expire.", + "x-nullable": true, + "x-ms-client-name": "expiresAt" + }, + "last_active_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the vector store was last active.", + "x-nullable": true, + "x-ms-client-name": "lastActiveAt" + }, + "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", + "usage_bytes", + "file_counts", + "status", + "last_active_at", + "metadata" + ] + }, + "VectorStoreDeletionStatus": { + "type": "object", + "description": "Response object for deleting a vector store.", + "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 'vector_store.deleted'.", + "enum": [ + "vector_store.deleted" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "VectorStoreExpirationPolicy": { + "type": "object", + "description": "The expiration policy for a vector store.", + "properties": { + "anchor": { + "$ref": "#/definitions/VectorStoreExpirationPolicyAnchor", + "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`." + }, + "days": { + "type": "integer", + "format": "int32", + "description": "The anchor timestamp after which the expiration policy applies.", + "minimum": 1, + "maximum": 365 + } + }, + "required": [ + "anchor", + "days" + ] + }, + "VectorStoreExpirationPolicyAnchor": { + "type": "string", + "description": "Describes the relationship between the days and the expiration of this vector store", + "enum": [ + "last_active_at" + ], + "x-ms-enum": { + "name": "VectorStoreExpirationPolicyAnchor", + "modelAsString": true, + "values": [ + { + "name": "lastActiveAt", + "value": "last_active_at", + "description": "The expiration policy is based on the last time the vector store was active." + } + ] + } + }, + "VectorStoreFile": { + "type": "object", + "description": "Description of a file attached to a vector store.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always `vector_store.file`.", + "enum": [ + "vector_store.file" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "usage_bytes": { + "type": "integer", + "format": "int32", + "description": "The total vector store usage in bytes. Note that this may be different from the original file\nsize.", + "x-ms-client-name": "usageBytes" + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the vector store file was created.", + "x-ms-client-name": "createdAt" + }, + "vector_store_id": { + "type": "string", + "description": "The ID of the vector store that the file is attached to.", + "x-ms-client-name": "vectorStoreId" + }, + "status": { + "$ref": "#/definitions/VectorStoreFileStatus", + "description": "The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use." + }, + "last_error": { + "type": "object", + "description": "The last error associated with this vector store file. Will be `null` if there are no errors.", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/VectorStoreFileError" + } + ], + "x-ms-client-name": "lastError" + } + }, + "required": [ + "id", + "object", + "usage_bytes", + "created_at", + "vector_store_id", + "status", + "last_error" + ] + }, + "VectorStoreFileBatch": { + "type": "object", + "description": "A batch of files attached to a vector store.", + "properties": { + "id": { + "type": "string", + "description": "The identifier, which can be referenced in API endpoints." + }, + "object": { + "type": "string", + "description": "The object type, which is always `vector_store.file_batch`.", + "enum": [ + "vector_store.files_batch" + ], + "x-ms-enum": { + "modelAsString": false + } + }, + "created_at": { + "type": "integer", + "format": "unixtime", + "description": "The Unix timestamp (in seconds) for when the vector store files batch was created.", + "x-ms-client-name": "createdAt" + }, + "vector_store_id": { + "type": "string", + "description": "The ID of the vector store that the file is attached to.", + "x-ms-client-name": "vectorStoreId" + }, + "status": { + "$ref": "#/definitions/VectorStoreFileBatchStatus", + "description": "The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`." + }, + "file_counts": { + "$ref": "#/definitions/VectorStoreFileCount", + "description": "Files count grouped by status processed or being processed by this vector store.", + "x-ms-client-name": "fileCounts" + } + }, + "required": [ + "id", + "object", + "created_at", + "vector_store_id", + "status", + "file_counts" + ] + }, + "VectorStoreFileBatchStatus": { + "type": "string", + "description": "The status of the vector store file batch.", + "enum": [ + "in_progress", + "completed", + "cancelled", + "failed" + ], + "x-ms-enum": { + "name": "VectorStoreFileBatchStatus", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "The vector store is still processing this file batch." + }, + { + "name": "completed", + "value": "completed", + "description": "the vector store file batch is ready for use." + }, + { + "name": "cancelled", + "value": "cancelled", + "description": "The vector store file batch was cancelled." + }, + { + "name": "failed", + "value": "failed", + "description": "The vector store file batch failed to process." + } + ] + } + }, + "VectorStoreFileCount": { + "type": "object", + "description": "Counts of files processed or being processed by this vector store grouped by status.", + "properties": { + "in_progress": { + "type": "integer", + "format": "int32", + "description": "The number of files that are currently being processed.", + "x-ms-client-name": "inProgress" + }, + "completed": { + "type": "integer", + "format": "int32", + "description": "The number of files that have been successfully processed." + }, + "failed": { + "type": "integer", + "format": "int32", + "description": "The number of files that have failed to process." + }, + "cancelled": { + "type": "integer", + "format": "int32", + "description": "The number of files that were cancelled." + }, + "total": { + "type": "integer", + "format": "int32", + "description": "The total number of files." + } + }, + "required": [ + "in_progress", + "completed", + "failed", + "cancelled", + "total" + ] + }, + "VectorStoreFileDeletionStatus": { + "type": "object", + "description": "Response object for deleting a vector store file relationship.", + "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 'vector_store.deleted'.", + "enum": [ + "vector_store.file.deleted" + ], + "x-ms-enum": { + "modelAsString": false + } + } + }, + "required": [ + "id", + "deleted", + "object" + ] + }, + "VectorStoreFileError": { + "type": "object", + "description": "Details on the error that may have ocurred while processing a file for this vector store", + "properties": { + "code": { + "$ref": "#/definitions/VectorStoreFileErrorCode", + "description": "One of `server_error` or `rate_limit_exceeded`." + }, + "message": { + "type": "string", + "description": "A human-readable description of the error." + } + }, + "required": [ + "code", + "message" + ] + }, + "VectorStoreFileErrorCode": { + "type": "string", + "description": "Error code variants for vector store file processing", + "enum": [ + "internal_error", + "file_not_found", + "parsing_error", + "unhandled_mime_type" + ], + "x-ms-enum": { + "name": "VectorStoreFileErrorCode", + "modelAsString": true, + "values": [ + { + "name": "internalError", + "value": "internal_error", + "description": "An internal error occurred." + }, + { + "name": "fileNotFound", + "value": "file_not_found", + "description": "The file was not found." + }, + { + "name": "parsingError", + "value": "parsing_error", + "description": "The file could not be parsed." + }, + { + "name": "unhandledMimeType", + "value": "unhandled_mime_type", + "description": "The file has an unhandled mime type." + } + ] + } + }, + "VectorStoreFileStatus": { + "type": "string", + "description": "Vector store file status", + "enum": [ + "in_progress", + "completed", + "failed", + "cancelled" + ], + "x-ms-enum": { + "name": "VectorStoreFileStatus", + "modelAsString": true, + "values": [ + { + "name": "inProgress", + "value": "in_progress", + "description": "The file is currently being processed." + }, + { + "name": "completed", + "value": "completed", + "description": "The file has been successfully processed." + }, + { + "name": "failed", + "value": "failed", + "description": "The file has failed to process." + }, + { + "name": "cancelled", + "value": "cancelled", + "description": "The file was cancelled." + } + ] + } + }, + "VectorStoreOptions": { + "type": "object", + "description": "Request object for creating a vector store.", + "properties": { + "file_ids": { + "type": "array", + "description": "A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files.", + "maxItems": 500, + "items": { + "type": "string" + }, + "x-ms-client-name": "fileIds" + }, + "name": { + "type": "string", + "description": "The name of the vector store." + }, + "expires_after": { + "$ref": "#/definitions/VectorStoreExpirationPolicy", + "description": "Details on when this vector store expires", + "x-ms-client-name": "expiresAfter" + }, + "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" + } + } + } + }, + "VectorStoreStatus": { + "type": "string", + "description": "Vector store possible status", + "enum": [ + "expired", + "in_progress", + "completed" + ], + "x-ms-enum": { + "name": "VectorStoreStatus", + "modelAsString": true, + "values": [ + { + "name": "expired", + "value": "expired", + "description": "expired status indicates that this vector store has expired and is no longer available for use." + }, + { + "name": "inProgress", + "value": "in_progress", + "description": "in_progress status indicates that this vector store is still processing files." + }, + { + "name": "completed", + "value": "completed", + "description": "completed status indicates that this vector store is ready for use." + } + ] + } + }, + "VectorStoreUpdateOptions": { + "type": "object", + "description": "Request object for updating a vector store.", + "properties": { + "name": { + "type": "string", + "description": "The name of the vector store.", + "x-nullable": true + }, + "expires_after": { + "type": "object", + "description": "Details on when this vector store expires", + "x-nullable": true, + "allOf": [ + { + "$ref": "#/definitions/VectorStoreExpirationPolicy" + } + ], + "x-ms-client-name": "expiresAfter" + }, + "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" + }, + "UpdateAssistantThreadOptions.threadId": { + "name": "threadId", + "in": "path", + "description": "The ID of the thread 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 dad7788dcc2c..5d101eb1cb50 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 @@ -141,156 +141,6 @@ paths: 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 @@ -452,12 +302,7 @@ paths: 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 + - $ref: '#/components/parameters/UpdateAssistantThreadOptions.threadId' responses: '200': description: Information about the modified thread. @@ -470,14 +315,7 @@ paths: 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. + $ref: '#/components/schemas/UpdateAssistantThreadOptions' delete: operationId: deleteThread description: Deletes an existing thread. @@ -513,34 +351,6 @@ paths: 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. @@ -672,114 +482,6 @@ paths: 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 @@ -1123,6 +825,13 @@ components: description: The ID of the assistant to modify. schema: type: string + UpdateAssistantThreadOptions.threadId: + name: threadId + in: path + required: true + description: The ID of the thread to modify. + schema: + type: string schemas: Assistant: type: object @@ -1135,7 +844,6 @@ components: - model - instructions - tools - - file_ids - metadata properties: id: @@ -1171,12 +879,6 @@ components: $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: @@ -1210,12 +912,6 @@ components: $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: @@ -1242,49 +938,6 @@ components: - 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: - type: string @@ -1342,11 +995,6 @@ components: 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: @@ -1768,30 +1416,6 @@ components: 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: @@ -1935,7 +1559,7 @@ components: - $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. + Generated when the assistant uses the "file_search" tool to search files. start_index: type: integer format: int32 @@ -1946,7 +1570,7 @@ components: 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. + description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the 'file_search' tool to search files. MessageTextFileCitationDetails: type: object required: @@ -2090,19 +1714,6 @@ components: 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: @@ -2122,7 +1733,7 @@ components: type: integer format: int64 description: Total number of tokens used (prompt + completion). - description: Usage statistics related to the run. + 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.). RunError: type: object required: @@ -2542,24 +2153,6 @@ components: 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: @@ -2581,7 +2174,6 @@ components: 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: @@ -2704,27 +2296,6 @@ components: 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 @@ -2765,7 +2336,6 @@ components: 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: @@ -2814,6 +2384,7 @@ components: type: string enum: - 2024-02-15-preview + - 2024-05-01-preview description: The known set of supported API versions. SubmitToolOutputsAction: type: object @@ -2863,34 +2434,6 @@ components: - 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: @@ -2904,7 +2447,8 @@ components: - incomplete_at - role - content - - file_ids + - assistant_id + - run_id - metadata properties: id: @@ -2927,8 +2471,9 @@ components: - $ref: '#/components/schemas/MessageStatus' description: The status of the message. incomplete_details: - oneOf: - - $ref: '#/components/schemas/MessageIncompleteDetailsReason' + type: object + allOf: + - $ref: '#/components/schemas/MessageIncompleteDetails' nullable: true description: On an incomplete message, details about why the message is incomplete. completed_at: @@ -2952,17 +2497,12 @@ components: description: The list of content items associated with the assistant thread message. assistant_id: type: string + nullable: true description: If applicable, the ID of the assistant that authored this message. run_id: type: string + nullable: true 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: @@ -2982,7 +2522,6 @@ components: - model - instructions - tools - - file_ids - created_at - expires_at - started_at @@ -3035,12 +2574,6 @@ components: $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 @@ -3107,7 +2640,6 @@ components: 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: @@ -3144,12 +2676,6 @@ components: $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: @@ -3157,6 +2683,26 @@ 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 request details to use when modifying an existing assistant. + UpdateAssistantThreadOptions: + 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. + description: The details used to update an existing assistant thread + VectorStoreFileBatchStatus: + anyOf: + - type: string + - type: string + enum: + - in_progress + - completed + - cancelled + - failed + description: The status of the vector store file batch. securitySchemes: ApiKeyAuth: type: apiKey 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..c4bafc803e41 --- /dev/null +++ b/specification/ai/data-plane/OpenAI.Assistants/OpenApiV3/2024-05-01-preview/assistants_generated.yaml @@ -0,0 +1,4225 @@ +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' + /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: + - $ref: '#/components/parameters/UpdateAssistantThreadOptions.threadId' + responses: + '200': + description: Information about the modified thread. + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantThread' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAssistantThreadOptions' + 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: + description: A single message within an assistant thread, as provided during that thread's creation for its initial state. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ThreadMessageOptions' + 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: runId + in: query + required: false + description: Filter messages by the run ID that generated them. + 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}/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 + /vector_stores: + get: + operationId: listVectorStores + description: Returns a list of vector stores. + 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 request has succeeded. + 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/VectorStore' + 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. + post: + operationId: createVectorStore + description: Creates a vector store. + parameters: [] + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStore' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreOptions' + /vector_stores/{vectorStoreId}: + get: + operationId: getVectorStore + description: Returns the vector store object matching the specified ID. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store to retrieve. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStore' + post: + operationId: modifyVectorStore + description: The ID of the vector store to modify. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store to modify. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStore' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreUpdateOptions' + delete: + operationId: deleteVectorStore + description: Deletes the vector store object matching the specified ID. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store to delete. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreDeletionStatus' + /vector_stores/{vectorStoreId}/file_batches: + post: + operationId: createVectorStoreFileBatch + description: Create a vector store file batch. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store for which to create a File Batch. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatch' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + file_ids: + type: array + items: + type: string + minItems: 1 + maxItems: 500 + description: A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files. + required: + - file_ids + /vector_stores/{vectorStoreId}/file_batches/{batchId}: + get: + operationId: getVectorStoreFileBatch + description: Retrieve a vector store file batch. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store that the file batch belongs to. + schema: + type: string + - name: batchId + in: path + required: true + description: The ID of the file batch being retrieved. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatch' + /vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel: + post: + operationId: cancelVectorStoreFileBatch + description: Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store that the file batch belongs to. + schema: + type: string + - name: batchId + in: path + required: true + description: The ID of the file batch to cancel. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileBatch' + /vector_stores/{vectorStoreId}/file_batches/{batchId}/files: + get: + operationId: listVectorStoreFileBatchFiles + description: Returns a list of vector store files in a batch. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store that the file batch belongs to. + schema: + type: string + - name: batchId + in: path + required: true + description: The ID of the file batch that the files belong to. + schema: + type: string + - name: filter + in: query + required: false + description: Filter by file status. + schema: + $ref: '#/components/schemas/VectorStoreFileStatusFilter' + - 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 request has succeeded. + 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/VectorStoreFile' + 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. + /vector_stores/{vectorStoreId}/files: + get: + operationId: listVectorStoreFiles + description: Returns a list of vector store files. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store that the files belong to. + schema: + type: string + - name: filter + in: query + required: false + description: Filter by file status. + schema: + $ref: '#/components/schemas/VectorStoreFileStatusFilter' + - 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 request has succeeded. + 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/VectorStoreFile' + 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. + post: + operationId: createVectorStoreFile + description: Create a vector store file by attaching a file to a vector store. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store for which to create a File. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFile' + requestBody: + description: A File ID that the vector store should use. Useful for tools like `file_search` that can access files. + required: true + content: + application/json: + schema: + type: string + /vector_stores/{vectorStoreId}/files/{fileId}: + get: + operationId: getVectorStoreFile + description: Retrieves a vector store file. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store that the file belongs to. + schema: + type: string + - name: fileId + in: path + required: true + description: The ID of the file being retrieved. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFile' + delete: + operationId: deleteVectorStoreFile + description: |- + Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. + To delete the file, use the delete file endpoint. + parameters: + - name: vectorStoreId + in: path + required: true + description: The ID of the vector store that the file belongs to. + schema: + type: string + - name: fileId + in: path + required: true + description: The ID of the file to delete its relationship to the vector store. + schema: + type: string + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/VectorStoreFileDeletionStatus' +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 + UpdateAssistantThreadOptions.threadId: + name: threadId + in: path + required: true + description: The ID of the thread to modify. + schema: + type: string + schemas: + ApiResponseFormat: + anyOf: + - type: string + - type: string + enum: + - text + - json_object + description: Possible API response formats. + Assistant: + type: object + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - tool_resources + - temperature + - top_p + - 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: [] + tool_resources: + type: object + allOf: + - $ref: '#/components/schemas/ToolResources' + nullable: true + description: |- + A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + while lower values like 0.2 will make it more focused and deterministic. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + default: 1 + response_format: + oneOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + description: The response format of the tool calls used by this assistant. + 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: [] + tool_resources: + type: object + allOf: + - $ref: '#/components/schemas/CreateToolResourcesOptions' + nullable: true + description: |- + A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` + tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + while lower values like 0.2 will make it more focused and deterministic. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + default: 1 + response_format: + oneOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + description: The response format of the tool calls used by this assistant. + 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. + AssistantStreamEvent: + anyOf: + - 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: + + ``` + 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 + - tool_resources + - 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. + tool_resources: + type: object + allOf: + - $ref: '#/components/schemas/ToolResources' + nullable: true + description: |- + A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type + of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list + of vector store IDs. + 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/ThreadMessageOptions' + description: The initial messages to associate with the new thread. + tool_resources: + type: object + allOf: + - $ref: '#/components/schemas/CreateToolResourcesOptions' + nullable: true + description: |- + A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the + type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + a list of vector store IDs. + 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. + AssistantsApiResponseFormat: + type: object + properties: + type: + allOf: + - $ref: '#/components/schemas/ApiResponseFormat' + description: Must be one of `text` or `json_object`. + default: text + description: |- + An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. + If `text` the model can return text or any value needed. + AssistantsApiResponseFormatMode: + anyOf: + - type: string + - type: string + enum: + - auto + - none + description: Represents the mode in which the model will handle the return format of a tool call. + AssistantsApiResponseFormatOption: + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantsApiResponseFormatMode' + - $ref: '#/components/schemas/AssistantsApiResponseFormat' + description: |- + Specifies the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. + + Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. + Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, + resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off + if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. + AssistantsApiToolChoiceOption: + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantsApiToolChoiceOptionMode' + - $ref: '#/components/schemas/AssistantsNamedToolChoice' + description: |- + Controls which (if any) tool is called by the model. + - `none` means the model will not call any tools and instead generates a message. + - `auto` is the default value and means the model can pick between generating a message or calling a tool. + Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` + forces the model to call that tool. + AssistantsApiToolChoiceOptionMode: + anyOf: + - type: string + - type: string + enum: + - none + - auto + description: Specifies how the tool choice will be used + AssistantsNamedToolChoice: + type: object + required: + - type + properties: + type: + allOf: + - $ref: '#/components/schemas/AssistantsNamedToolChoiceType' + description: the type of tool. If type is `function`, the function name must be set. + function: + allOf: + - $ref: '#/components/schemas/FunctionName' + description: The name of the function to call + description: Specifies a tool the model should use. Use to force the model to call a specific tool. + AssistantsNamedToolChoiceType: + anyOf: + - type: string + - type: string + enum: + - function + - code_interpreter + - file_search + description: Available tool types for assistants named tools. + 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. + CodeInterpreterToolResource: + type: object + required: + - file_ids + properties: + file_ids: + type: array + items: + type: string + maxItems: 20 + description: |- + A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + associated with the tool. + default: [] + description: A set of resources that are used by the `code_interpreter` tool. + 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. + tool_resources: + type: object + allOf: + - $ref: '#/components/schemas/UpdateToolResourcesOptions' + nullable: true + description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + 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. + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + more random, while lower values like 0.2 will make it more focused and deterministic. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, where the model + considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + default: 1 + max_prompt_tokens: + type: integer + format: int32 + nullable: true + minimum: 256 + description: |- + The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + the run will end with status `incomplete`. See `incomplete_details` for more info. + max_completion_tokens: + type: integer + format: int32 + nullable: true + minimum: 256 + description: |- + The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only + the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens + specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + truncation_strategy: + type: object + allOf: + - $ref: '#/components/schemas/TruncationObject' + nullable: true + description: The strategy to use for dropping messages as the context windows moves forward. + tool_choice: + oneOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + nullable: true + description: Controls whether or not and which tool is called by the model. + response_format: + oneOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + description: Specifies the format that the model must output. + 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. + CreateCodeInterpreterToolResourceOptions: + type: object + properties: + file_ids: + type: array + items: + type: string + maxItems: 20 + description: A list of file IDs made available to the `code_interpreter` tool. + default: [] + description: A set of resources that will be used by the `code_interpreter` tool. Request object. + CreateFileSearchToolResourceOptions: + anyOf: + - type: array + items: + type: string + - type: array + items: + $ref: '#/components/schemas/CreateFileSearchToolResourceVectorStoreOptions' + description: |- + A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. + For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + a list of vector store IDs. + CreateFileSearchToolResourceVectorStoreOptions: + type: object + required: + - file_ids + properties: + file_ids: + type: array + items: + type: string + maxItems: 10000 + description: A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store. + 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: File IDs associated to the vector store to be passed to the helper. + 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. + additional_messages: + type: array + items: + $ref: '#/components/schemas/ThreadMessage' + nullable: true + description: Adds additional messages to the thread before creating the run. + 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. + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output + more random, while lower values like 0.2 will make it more focused and deterministic. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, where the model + considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens + comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + default: 1 + max_prompt_tokens: + type: integer + format: int32 + nullable: true + minimum: 256 + description: |- + The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only + the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, + the run will end with status `incomplete`. See `incomplete_details` for more info. + max_completion_tokens: + type: integer + format: int32 + nullable: true + minimum: 256 + description: |- + The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort + to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of + completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + truncation_strategy: + type: object + allOf: + - $ref: '#/components/schemas/TruncationObject' + nullable: true + description: The strategy to use for dropping messages as the context windows moves forward. + tool_choice: + oneOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + nullable: true + description: Controls whether or not and which tool is called by the model. + response_format: + oneOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + description: Specifies the format that the model must output. + 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. + CreateToolResourcesOptions: + type: object + properties: + code_interpreter: + allOf: + - $ref: '#/components/schemas/CreateCodeInterpreterToolResourceOptions' + description: |- + A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + associated with the tool. + file_search: + allOf: + - $ref: '#/components/schemas/CreateFileSearchToolResourceOptions' + description: A list of vector stores or their IDs made available to the `file_search` tool. + description: |- + Request object. A set of resources that are used by the assistant's tools. The resources are specific to the + type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` + tool requires a list of vector store IDs. + 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 + - batch + - batch_output + - vision + description: The possible values denoting the intended usage of a file. + FileSearchToolDefinition: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_search + description: The object type, which is always 'file_search'. + allOf: + - $ref: '#/components/schemas/ToolDefinition' + description: The input definition information for a file search tool as used to configure an assistant. + FileSearchToolResource: + type: object + properties: + vector_store_ids: + type: array + items: + type: string + maxItems: 1 + description: |- + The ID of the vector store attached to this assistant. There can be a maximum of 1 vector + store attached to the assistant. + description: A set of resources that are used by the `file_search` tool. + FileState: + anyOf: + - type: string + - type: string + enum: + - uploaded + - pending + - running + - processed + - error + - deleting + - deleted + description: The state of the 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. + FunctionName: + type: object + required: + - name + properties: + name: + type: string + description: The name of the function to call + description: The function name that will be used, if using the `funtion` tool + 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. + MessageAttachment: + type: object + required: + - file_id + - tools + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + type: array + items: + $ref: '#/components/schemas/MessageAttachmentToolDefinition' + description: The tools to add to this file. + description: This describes to which tools a file has been attached. + MessageAttachmentToolDefinition: + anyOf: + - $ref: '#/components/schemas/CodeInterpreterToolDefinition' + - $ref: '#/components/schemas/FileSearchToolDefinition' + description: The possible tools to which files will be added by this message + 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. + 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 "file_search" 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 'file_search' 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. + status: + allOf: + - $ref: '#/components/schemas/FileState' + description: The state of the file. This field is available in Azure OpenAI only. + status_details: + type: string + description: The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. + 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. + 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. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + 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. + RunStepDeltaFileSearchToolCall: + type: object + required: + - type + properties: + type: + type: string + enum: + - file_search + description: The object type, which is always "file_search." + file_search: + type: object + additionalProperties: + type: string + description: Reserved for future use. + allOf: + - $ref: '#/components/schemas/RunStepDeltaToolCall' + description: Represents a file search tool call within a streaming run step's tool call details. + 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. + 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' + file_search: '#/components/schemas/RunStepDeltaFileSearchToolCall' + 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. + RunStepFileSearchToolCall: + type: object + required: + - type + - file_search + properties: + type: + type: string + enum: + - file_search + description: The object type, which is always 'file_search'. + file_search: + type: object + additionalProperties: + type: string + description: Reserved for future use. + allOf: + - $ref: '#/components/schemas/RunStepToolCall' + description: |- + A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents + executed file search. + 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. + 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' + file_search: '#/components/schemas/RunStepFileSearchToolCall' + 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. + ThreadMessage: + type: object + required: + - id + - object + - created_at + - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at + - role + - content + - assistant_id + - run_id + - attachments + - 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: + type: object + allOf: + - $ref: '#/components/schemas/MessageIncompleteDetails' + 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 + nullable: true + description: If applicable, the ID of the assistant that authored this message. + run_id: + type: string + nullable: true + description: If applicable, the ID of the run associated with the authoring of this message. + attachments: + type: array + items: + $ref: '#/components/schemas/MessageAttachment' + nullable: true + description: A list of files attached to the message, and the tools they were added to. + 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. + ThreadMessageOptions: + type: object + required: + - role + - content + properties: + role: + allOf: + - $ref: '#/components/schemas/MessageRole' + description: |- + The role of the entity that is creating the message. Allowed values include: + - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into + the conversation. + content: + type: string + 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. + attachments: + type: array + items: + $ref: '#/components/schemas/MessageAttachment' + nullable: true + description: A list of files attached to the message, and the tools they should be added to. + 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. + ThreadRun: + type: object + required: + - id + - object + - thread_id + - assistant_id + - status + - last_error + - model + - instructions + - tools + - created_at + - expires_at + - started_at + - completed_at + - cancelled_at + - failed_at + - incomplete_details + - usage + - max_prompt_tokens + - max_completion_tokens + - truncation_strategy + - tool_choice + - response_format + - 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: [] + 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.). + temperature: + type: number + format: float + nullable: true + description: The sampling temperature used for this run. If not set, defaults to 1. + top_p: + type: number + format: float + nullable: true + description: The nucleus sampling value used for this run. If not set, defaults to 1. + max_prompt_tokens: + type: integer + format: int32 + nullable: true + minimum: 256 + description: The maximum number of prompt tokens specified to have been used over the course of the run. + max_completion_tokens: + type: integer + format: int32 + nullable: true + minimum: 256 + description: The maximum number of completion tokens specified to have been used over the course of the run. + truncation_strategy: + type: object + allOf: + - $ref: '#/components/schemas/TruncationObject' + nullable: true + description: The strategy to use for dropping messages as the context windows moves forward. + tool_choice: + oneOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + nullable: true + description: Controls whether or not and which tool is called by the model. + response_format: + oneOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + description: The response format of the tool calls used in this run. + 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' + file_search: '#/components/schemas/FileSearchToolDefinition' + 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. + ToolResources: + type: object + properties: + code_interpreter: + allOf: + - $ref: '#/components/schemas/CodeInterpreterToolResource' + description: Resources to be used by the `code_interpreter tool` consisting of file IDs. + file_search: + allOf: + - $ref: '#/components/schemas/FileSearchToolResource' + description: Resources to be used by the `file_search` tool consisting of vector store IDs. + description: |- + A set of resources that are used by the assistant's tools. The resources are specific to the type of + tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` + tool requires a list of vector store IDs. + TruncationObject: + type: object + required: + - type + properties: + type: + allOf: + - $ref: '#/components/schemas/TruncationStrategy' + description: |- + The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will + be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread + will be dropped to fit the context length of the model, `max_prompt_tokens`. + default: auto + last_messages: + type: integer + format: int32 + nullable: true + minimum: 1 + description: The number of most recent messages from the thread when constructing the context for the run. + description: |- + Controls for how a thread will be truncated prior to the run. Use this to control the initial + context window of the run. + TruncationStrategy: + anyOf: + - type: string + - type: string + enum: + - auto + - last_messages + description: Possible truncation strategies for the thread. + 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: [] + tool_resources: + allOf: + - $ref: '#/components/schemas/UpdateToolResourcesOptions' + description: |- + A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, + the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + temperature: + type: number + format: float + nullable: true + minimum: 0 + maximum: 2 + description: |- + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, + while lower values like 0.2 will make it more focused and deterministic. + default: 1 + top_p: + type: number + format: float + nullable: true + minimum: 0 + maximum: 1 + description: |- + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. + So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + default: 1 + response_format: + oneOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + description: The response format of the tool calls used by this assistant. + 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. + UpdateAssistantThreadOptions: + type: object + properties: + tool_resources: + type: object + allOf: + - $ref: '#/components/schemas/UpdateToolResourcesOptions' + nullable: true + description: |- + A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the + type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires + a list of vector store IDs + 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 update an existing assistant thread + UpdateCodeInterpreterToolResourceOptions: + type: object + properties: + fileIds: + type: array + items: + type: string + maxItems: 20 + description: A list of file IDs to override the current list of the assistant. + description: Request object to update `code_interpreted` tool resources. + UpdateFileSearchToolResourceOptions: + type: object + properties: + vectorStoreIds: + type: array + items: + type: string + maxItems: 1 + description: A list of vector store IDs to override the current list of the assistant. + description: Request object to update `file_search` tool resources. + UpdateToolResourcesOptions: + type: object + properties: + code_interpreter: + allOf: + - $ref: '#/components/schemas/UpdateCodeInterpreterToolResourceOptions' + description: |- + Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files + associated with the tool. + file_search: + allOf: + - $ref: '#/components/schemas/UpdateFileSearchToolResourceOptions' + description: Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + description: |- + Request object. A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. + For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of + vector store IDs. + VectorStore: + type: object + required: + - id + - object + - created_at + - name + - usage_bytes + - file_counts + - status + - last_active_at + - metadata + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - vector_store + description: The object type, which is always `vector_store` + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the vector store was created. + name: + type: string + description: The name of the vector store. + usage_bytes: + type: integer + format: int32 + description: The total number of bytes used by the files in the vector store. + file_counts: + allOf: + - $ref: '#/components/schemas/VectorStoreFileCount' + description: Files count grouped by status processed or being processed by this vector store. + status: + allOf: + - $ref: '#/components/schemas/VectorStoreStatus' + description: The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. + expires_after: + allOf: + - $ref: '#/components/schemas/VectorStoreExpirationPolicy' + description: Details on when this vector store expires + expires_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the vector store will expire. + last_active_at: + type: integer + format: unixtime + nullable: true + description: The Unix timestamp (in seconds) for when the vector store was last active. + 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 vector store is a collection of processed files can be used by the `file_search` tool. + VectorStoreDeletionStatus: + 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: + - vector_store.deleted + description: The object type, which is always 'vector_store.deleted'. + description: Response object for deleting a vector store. + VectorStoreExpirationPolicy: + type: object + required: + - anchor + - days + properties: + anchor: + allOf: + - $ref: '#/components/schemas/VectorStoreExpirationPolicyAnchor' + description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.' + days: + type: integer + format: int32 + minimum: 1 + maximum: 365 + description: The anchor timestamp after which the expiration policy applies. + description: The expiration policy for a vector store. + VectorStoreExpirationPolicyAnchor: + anyOf: + - type: string + - type: string + enum: + - last_active_at + description: Describes the relationship between the days and the expiration of this vector store + VectorStoreFile: + type: object + required: + - id + - object + - usage_bytes + - created_at + - vector_store_id + - status + - last_error + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - vector_store.file + description: The object type, which is always `vector_store.file`. + usage_bytes: + type: integer + format: int32 + description: |- + The total vector store usage in bytes. Note that this may be different from the original file + size. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the vector store file was created. + vector_store_id: + type: string + description: The ID of the vector store that the file is attached to. + status: + allOf: + - $ref: '#/components/schemas/VectorStoreFileStatus' + description: The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. + last_error: + type: object + allOf: + - $ref: '#/components/schemas/VectorStoreFileError' + nullable: true + description: The last error associated with this vector store file. Will be `null` if there are no errors. + description: Description of a file attached to a vector store. + VectorStoreFileBatch: + type: object + required: + - id + - object + - created_at + - vector_store_id + - status + - file_counts + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - vector_store.files_batch + description: The object type, which is always `vector_store.file_batch`. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the vector store files batch was created. + vector_store_id: + type: string + description: The ID of the vector store that the file is attached to. + status: + allOf: + - $ref: '#/components/schemas/VectorStoreFileBatchStatus' + description: The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. + file_counts: + allOf: + - $ref: '#/components/schemas/VectorStoreFileCount' + description: Files count grouped by status processed or being processed by this vector store. + description: A batch of files attached to a vector store. + VectorStoreFileBatchStatus: + anyOf: + - type: string + - type: string + enum: + - in_progress + - completed + - cancelled + - failed + description: The status of the vector store file batch. + VectorStoreFileCount: + type: object + required: + - in_progress + - completed + - failed + - cancelled + - total + properties: + in_progress: + type: integer + format: int32 + description: The number of files that are currently being processed. + completed: + type: integer + format: int32 + description: The number of files that have been successfully processed. + failed: + type: integer + format: int32 + description: The number of files that have failed to process. + cancelled: + type: integer + format: int32 + description: The number of files that were cancelled. + total: + type: integer + format: int32 + description: The total number of files. + description: Counts of files processed or being processed by this vector store grouped by status. + VectorStoreFileDeletionStatus: + 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: + - vector_store.file.deleted + description: The object type, which is always 'vector_store.deleted'. + description: Response object for deleting a vector store file relationship. + VectorStoreFileError: + type: object + required: + - code + - message + properties: + code: + allOf: + - $ref: '#/components/schemas/VectorStoreFileErrorCode' + description: One of `server_error` or `rate_limit_exceeded`. + message: + type: string + description: A human-readable description of the error. + description: Details on the error that may have ocurred while processing a file for this vector store + VectorStoreFileErrorCode: + anyOf: + - type: string + - type: string + enum: + - internal_error + - file_not_found + - parsing_error + - unhandled_mime_type + description: Error code variants for vector store file processing + VectorStoreFileStatus: + anyOf: + - type: string + - type: string + enum: + - in_progress + - completed + - failed + - cancelled + description: Vector store file status + VectorStoreFileStatusFilter: + anyOf: + - type: string + - type: string + enum: + - in_progress + - completed + - failed + - cancelled + description: Query parameter filter for vector store file retrieval endpoint + VectorStoreOptions: + type: object + properties: + file_ids: + type: array + items: + type: string + maxItems: 500 + description: A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. + name: + type: string + description: The name of the vector store. + expires_after: + allOf: + - $ref: '#/components/schemas/VectorStoreExpirationPolicy' + description: Details on when this vector store expires + 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: Request object for creating a vector store. + VectorStoreStatus: + anyOf: + - type: string + - type: string + enum: + - expired + - in_progress + - completed + description: Vector store possible status + VectorStoreUpdateOptions: + type: object + properties: + name: + type: string + nullable: true + description: The name of the vector store. + expires_after: + type: object + allOf: + - $ref: '#/components/schemas/VectorStoreExpirationPolicy' + nullable: true + description: Details on when this vector store expires + 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: Request object for updating a vector store. + 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.