specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-05-01-preview/inference.yaml [4662:5394]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      type: object
      title: FileSearch tool
      properties:
        type:
          type: string
          description: 'The type of tool being defined: `file_search`'
          enum:
            - file_search
          x-ms-enum:
            name: assistantToolsFileSearchType
            modelAsString: true
            values:
              - value: file_search
      required:
        - type

    assistantToolsFunction:
      type: object
      title: Function tool
      properties:
        type:
          type: string
          description: 'The type of tool being defined: `function`'
          enum:
            - function
          x-ms-enum:
            name: assistantToolsFunction
            modelAsString: true
            values:
              - value: function
        function:
          type: object
          description: The function definition.
          properties:
            description:
              type: string
              description: A description of what the function does, used by the model to choose when and how to call the function.
            name:
              type: string
              description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
            parameters:
              $ref: '#/components/schemas/chatCompletionFunctionParameters'
          required:
            - name
            - parameters
            - description
      required:
        - type
        - function
    
    truncationObject:
      type: object
      title: Thread Truncation Controls
      description: Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
      properties:
        type:
          type: string
          description: The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
          enum: ["auto", "last_messages"]
          x-ms-enum:
            name: TruncationType
            modelAsString: true
            values:
              - value: auto
              - value: last_messages
        last_messages:
          type: integer
          description: The number of most recent messages from the thread when constructing the context for the run.
          minimum: 1
          nullable: true
      required:
        - type

    assistantsApiToolChoiceOption:
      description: |
        Controls which (if any) tool is called by the model.
        `none` means the model will not call any tools and instead generates a message.
        `auto` is the default value and means the model can pick between generating a message or calling a tool.
        Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
      oneOf:
        - type: string
          description: >
            `none` means the model will not call a function and instead generates a message.
            `auto` means the model can pick between generating a message or calling a function.
          enum: [none, auto]
          x-ms-enum:
            name: AssistantsApiToolChoiceOption
            modelAsString: true
            values:
              - value: none
              - value: auto
        - $ref: "#/components/schemas/assistantsNamedToolChoice"

    assistantsNamedToolChoice:
      type: object
      description: Specifies a tool the model should use. Use to force the model to call a specific tool.
      properties:
        type:
          type: string
          enum: ["function", "code_interpreter", "file_search"]
          description: The type of the tool. If type is `function`, the function name must be set
          x-ms-enum:
            name: AssistantsNamedToolChoiceType
            modelAsString: true
            values:
              - value: function
              - value: code_interpreter
              - value: file_search
        function:
          type: object
          properties:
            name:
              type: string
              description: The name of the function to call.
          required:
            - name
      required:
        - type

    runObject:
      type: object
      title: A run on a thread
      description: Represents an execution run on a [thread](/docs/api-reference/threads).
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `thread.run`.
          type: string
          enum:
            - thread.run
          x-ms-enum:
            name: runObjectType
            modelAsString: true
            values:
              - value: thread.run
                description: The run object type which is always thread.run
        created_at:
          description: The Unix timestamp (in seconds) for when the run was created.
          type: integer
        thread_id:
          description: The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run.
          type: string
        assistant_id:
          description: The ID of the assistant used for execution of this run.
          type: string
        status:
          description: The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or `expired`.
          type: string
          enum:
            - queued
            - in_progress
            - requires_action
            - cancelling
            - cancelled
            - failed
            - completed
            - expired
          x-ms-enum:
            name: RunObjectStatus
            modelAsString: true
            values:
              - value: queued
                description: The queued state
              - value: in_progress
                description: The in_progress state
              - value: requires_action
                description: The required_action state
              - value: cancelling
                description: The cancelling state
              - value: cancelled
                description: The cancelled state
              - value: failed
                description: The failed state
              - value: completed
                description: The completed state
              - value: expired
                description: The expired state
        required_action:
          type: object
          description: Details on the action required to continue the run. Will be `null` if no action is required.
          nullable: true
          properties:
            type:
              description: For now, this is always `submit_tool_outputs`.
              type: string
              enum:
                - submit_tool_outputs
            submit_tool_outputs:
              type: object
              description: Details on the tool outputs needed for this run to continue.
              properties:
                tool_calls:
                  type: array
                  description: A list of the relevant tool calls.
                  items:
                    $ref: '#/components/schemas/runToolCallObject'
              required:
                - tool_calls
          required:
            - type
            - submit_tool_outputs
        last_error:
          type: object
          description: The last error associated with this run. Will be `null` if there are no errors.
          nullable: true
          properties:
            code:
              type: string
              description: One of `server_error` or `rate_limit_exceeded`.
              enum:
                - server_error
                - rate_limit_exceeded
              x-ms-enum:
                name: LastErrorCode
                modelAsString: true
                values:
                  - value: server_error
                    description: The server failed to respond to request due to server error
                  - value: rate_limit_exceeded
                    description: The server failed to respond to request due to rate limit exceeded
            message:
              type: string
              description: A human-readable description of the error.
          required:
            - code
            - message
        expires_at:
          description: The Unix timestamp (in seconds) for when the run will expire.
          type: integer
        started_at:
          description: The Unix timestamp (in seconds) for when the run was started.
          type: integer
          nullable: true
        cancelled_at:
          description: The Unix timestamp (in seconds) for when the run was cancelled.
          type: integer
          nullable: true
        failed_at:
          description: The Unix timestamp (in seconds) for when the run failed.
          type: integer
          nullable: true
        completed_at:
          description: The Unix timestamp (in seconds) for when the run was completed.
          type: integer
          nullable: true
        incomplete_details:
          description: Details on why the run is incomplete. Will be `null` if the run is not incomplete.
          type: object
          nullable: true
          properties:
            reason:
              description: The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.
              type: string
              enum: ["max_completion_tokens", "max_prompt_tokens"]
              x-ms-enum:
                name: IncompleteDetailsReason
                modelAsString: true
                values:
                  - value: max_completion_tokens
                  - value: max_prompt_tokens
        model:
          description: The model that the assistant used for this run.
          type: string
        instructions:
          description: The instructions that the assistant used for this run.
          type: string
        tools:
          description: The list of tools that the assistant used for this run.
          default: []
          type: array
          maxItems: 20
          items:
            oneOf:
              - $ref: '#/components/schemas/assistantToolsCode'
              - $ref: '#/components/schemas/assistantToolsFileSearch'
              - $ref: '#/components/schemas/assistantToolsFunction'            
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        usage:
          $ref: "#/components/schemas/runCompletionUsage"
        temperature:
          description: The sampling temperature used for this run. If not set, defaults to 1.
          type: number
          nullable: true
        top_p:
          description: The nucleus sampling value used for this run. If not set, defaults to 1.
          type: number
          nullable: true
        max_prompt_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of prompt tokens specified to have been used over the course of the run.
          minimum: 256
        max_completion_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of completion tokens specified to have been used over the course of the run.
          minimum: 256
        truncation_strategy:
          $ref: "#/components/schemas/truncationObject"
          nullable: true
        tool_choice:
          $ref: "#/components/schemas/assistantsApiToolChoiceOption"
          nullable: true
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - id
        - object
        - created_at
        - thread_id
        - assistant_id
        - status
        - required_action
        - last_error
        - expires_at
        - started_at
        - cancelled_at
        - failed_at
        - completed_at
        - model
        - instructions
        - tools
        - metadata
        - usage
        - incomplete_details
        - max_prompt_tokens
        - max_completion_tokens
        - truncation_strategy
        - tool_choice
        - response_format

    createRunRequest:
      type: object
      additionalProperties: false
      properties:
        assistant_id:
          description: The ID of the assistant to use to execute this run.
          type: string
        model:
          description: The ID of the Model to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
          type: string
          nullable: true
        instructions:
          description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
          type: string
          nullable: true
        additional_instructions:
          description: Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.
          type: string
          nullable: true
        additional_messages:
          description: Adds additional messages to the thread before creating the run.
          type: array
          items:
            $ref: "#/components/schemas/createMessageRequest"
          nullable: true
        tools:
          description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
          nullable: true
          type: array
          maxItems: 20
          items:
            oneOf:
              - $ref: '#/components/schemas/assistantToolsCode'
              - $ref: '#/components/schemas/assistantToolsFileSearch'
              - $ref: '#/components/schemas/assistantToolsFunction'
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
          description: *run_temperature_description
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: *run_top_p_description
        stream:
          type: boolean
          nullable: true
          description: |
            If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
        max_prompt_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
          minimum: 256
        max_completion_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
          minimum: 256
        truncation_strategy:
          $ref: "#/components/schemas/truncationObject"
          nullable: true
        tool_choice:
          $ref: "#/components/schemas/assistantsApiToolChoiceOption"
          nullable: true
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - thread_id
        - assistant_id

    listRunsResponse:
      type: object
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: '#/components/schemas/runObject'
        first_id:
          type: string
          example: run_hLBK7PXBv5Lr2NQT7KLY0ag1
        last_id:
          type: string
          example: run_QLoItBbqwyAJEzlTy4y9kOMM
        has_more:
          type: boolean
          example: false
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more

    modifyRunRequest:
      type: object
      additionalProperties: false
      properties:
        metadata:
          description: *metadata_description
          type: object
          nullable: true

    submitToolOutputsRunRequest:
      type: object
      additionalProperties: false
      properties:
        tool_outputs:
          description: A list of tools for which the outputs are being submitted.
          type: array
          items:
            type: object
            properties:
              tool_call_id:
                type: string
                description: The ID of the tool call in the `required_action` object within the run object the output is being submitted for.
              output:
                type: string
                description: The output of the tool call to be submitted to continue the run.
        stream:
          type: boolean
          nullable: true
          description: |
            If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
      required:
        - tool_outputs

    runToolCallObject:
      type: object
      description: Tool call objects
      properties:
        id:
          type: string
          description: The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint.
        type:
          type: string
          description: The type of tool call the output is required for. For now, this is always `function`.
          enum:
            - function
          x-ms-enum:
            name: RunToolCallObjectType
            modelAsString: true
            values:
              - value: function    
        function:
          type: object
          description: The function definition.
          properties:
            name:
              type: string
              description: The name of the function.
            arguments:
              type: string
              description: The arguments that the model expects you to pass to the function.
          required:
            - name
            - arguments
      required:
        - id
        - type
        - function

    createThreadAndRunRequest:
      type: object
      additionalProperties: false
      properties:
        assistant_id:
          description: The ID of the assistant to use to execute this run.
          type: string
        thread:
          $ref: '#/components/schemas/createThreadRequest'
          description: If no thread is provided, an empty thread will be created.
        model:
          description: The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
          type: string
          nullable: true
        instructions:
          description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
          type: string
          nullable: true
        tools:
          description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
          nullable: true
          type: array
          maxItems: 20
          items:
            oneOf:
              - $ref: '#/components/schemas/assistantToolsCode'
              - $ref: '#/components/schemas/assistantToolsFileSearch'
              - $ref: '#/components/schemas/assistantToolsFunction'
        tool_resources:
          type: object
          description: |
            A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: string
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
          description: *run_temperature_description
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: *run_top_p_description
        stream:
          type: boolean
          nullable: true
          description: |
            If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
        max_prompt_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
          minimum: 256
        max_completion_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
          minimum: 256
        truncation_strategy:
          $ref: "#/components/schemas/truncationObject"
          nullable: true
        tool_choice:
          $ref: "#/components/schemas/assistantsApiToolChoiceOption"
          nullable: true
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - thread_id
        - assistant_id

    threadObject:
      type: object
      title: Thread
      description: Represents a thread that contains [messages](/docs/api-reference/messages).
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `thread`.
          type: string
          enum:
            - thread
          x-ms-enum:
            name: ThreadObjectType
            modelAsString: true
            values:
              - value: thread
                description: The type of thread object which is always `thread`
        created_at:
          description: The Unix timestamp (in seconds) for when the thread was created.
          type: integer
        tool_resources:
          type: object
          description: |
            A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: string
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
      required:
        - id
        - object
        - created_at
        - tool_resources
        - metadata
        
    createThreadRequest:
      type: object
      additionalProperties: false
      properties:
        messages:
          description: A list of messages to start the thread with.
          type: array
          items:
            $ref: '#/components/schemas/createMessageRequest'
        tool_resources:
          type: object
          description: |
            A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: string
                vector_stores:
                  type: array
                  description: |
                    A helper to create a vector store with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: object
                    properties:
                      file_ids:
                        type: array
                        description: |
                          A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
                        maxItems: 10000
                        items:
                          type: string
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-07-01-preview/inference.yaml [4766:5499]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      type: object
      title: FileSearch tool
      properties:
        type:
          type: string
          description: 'The type of tool being defined: `file_search`'
          enum:
            - file_search
          x-ms-enum:
            name: assistantToolsFileSearchType
            modelAsString: true
            values:
              - value: file_search
      required:
        - type


    assistantToolsFunction:
      type: object
      title: Function tool
      properties:
        type:
          type: string
          description: 'The type of tool being defined: `function`'
          enum:
            - function
          x-ms-enum:
            name: assistantToolsFunction
            modelAsString: true
            values:
              - value: function
        function:
          type: object
          description: The function definition.
          properties:
            description:
              type: string
              description: A description of what the function does, used by the model to choose when and how to call the function.
            name:
              type: string
              description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
            parameters:
              $ref: '#/components/schemas/chatCompletionFunctionParameters'
          required:
            - name
            - parameters
            - description
      required:
        - type
        - function
    
    truncationObject:
      type: object
      title: Thread Truncation Controls
      description: Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
      properties:
        type:
          type: string
          description: The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
          enum: ["auto", "last_messages"]
          x-ms-enum:
            name: TruncationType
            modelAsString: true
            values:
              - value: auto
              - value: last_messages
        last_messages:
          type: integer
          description: The number of most recent messages from the thread when constructing the context for the run.
          minimum: 1
          nullable: true
      required:
        - type

    assistantsApiToolChoiceOption:
      description: |
        Controls which (if any) tool is called by the model.
        `none` means the model will not call any tools and instead generates a message.
        `auto` is the default value and means the model can pick between generating a message or calling a tool.
        Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
      oneOf:
        - type: string
          description: >
            `none` means the model will not call a function and instead generates a message.
            `auto` means the model can pick between generating a message or calling a function.
          enum: [none, auto]
          x-ms-enum:
            name: AssistantsApiToolChoiceOption
            modelAsString: true
            values:
              - value: none
              - value: auto
        - $ref: "#/components/schemas/assistantsNamedToolChoice"

    assistantsNamedToolChoice:
      type: object
      description: Specifies a tool the model should use. Use to force the model to call a specific tool.
      properties:
        type:
          type: string
          enum: ["function", "code_interpreter", "file_search"]
          description: The type of the tool. If type is `function`, the function name must be set
          x-ms-enum:
            name: AssistantsNamedToolChoiceType
            modelAsString: true
            values:
              - value: function
              - value: code_interpreter
              - value: file_search
        function:
          type: object
          properties:
            name:
              type: string
              description: The name of the function to call.
          required:
            - name
      required:
        - type

    runObject:
      type: object
      title: A run on a thread
      description: Represents an execution run on a [thread](/docs/api-reference/threads).
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `thread.run`.
          type: string
          enum:
            - thread.run
          x-ms-enum:
            name: runObjectType
            modelAsString: true
            values:
              - value: thread.run
                description: The run object type which is always thread.run
        created_at:
          description: The Unix timestamp (in seconds) for when the run was created.
          type: integer
        thread_id:
          description: The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run.
          type: string
        assistant_id:
          description: The ID of the assistant used for execution of this run.
          type: string
        status:
          description: The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or `expired`.
          type: string
          enum:
            - queued
            - in_progress
            - requires_action
            - cancelling
            - cancelled
            - failed
            - completed
            - expired
          x-ms-enum:
            name: RunObjectStatus
            modelAsString: true
            values:
              - value: queued
                description: The queued state
              - value: in_progress
                description: The in_progress state
              - value: requires_action
                description: The required_action state
              - value: cancelling
                description: The cancelling state
              - value: cancelled
                description: The cancelled state
              - value: failed
                description: The failed state
              - value: completed
                description: The completed state
              - value: expired
                description: The expired state
        required_action:
          type: object
          description: Details on the action required to continue the run. Will be `null` if no action is required.
          nullable: true
          properties:
            type:
              description: For now, this is always `submit_tool_outputs`.
              type: string
              enum:
                - submit_tool_outputs
            submit_tool_outputs:
              type: object
              description: Details on the tool outputs needed for this run to continue.
              properties:
                tool_calls:
                  type: array
                  description: A list of the relevant tool calls.
                  items:
                    $ref: '#/components/schemas/runToolCallObject'
              required:
                - tool_calls
          required:
            - type
            - submit_tool_outputs
        last_error:
          type: object
          description: The last error associated with this run. Will be `null` if there are no errors.
          nullable: true
          properties:
            code:
              type: string
              description: One of `server_error` or `rate_limit_exceeded`.
              enum:
                - server_error
                - rate_limit_exceeded
              x-ms-enum:
                name: LastErrorCode
                modelAsString: true
                values:
                  - value: server_error
                    description: The server failed to respond to request due to server error
                  - value: rate_limit_exceeded
                    description: The server failed to respond to request due to rate limit exceeded
            message:
              type: string
              description: A human-readable description of the error.
          required:
            - code
            - message
        expires_at:
          description: The Unix timestamp (in seconds) for when the run will expire.
          type: integer
        started_at:
          description: The Unix timestamp (in seconds) for when the run was started.
          type: integer
          nullable: true
        cancelled_at:
          description: The Unix timestamp (in seconds) for when the run was cancelled.
          type: integer
          nullable: true
        failed_at:
          description: The Unix timestamp (in seconds) for when the run failed.
          type: integer
          nullable: true
        completed_at:
          description: The Unix timestamp (in seconds) for when the run was completed.
          type: integer
          nullable: true
        incomplete_details:
          description: Details on why the run is incomplete. Will be `null` if the run is not incomplete.
          type: object
          nullable: true
          properties:
            reason:
              description: The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.
              type: string
              enum: ["max_completion_tokens", "max_prompt_tokens"]
              x-ms-enum:
                name: IncompleteDetailsReason
                modelAsString: true
                values:
                  - value: max_completion_tokens
                  - value: max_prompt_tokens
        model:
          description: The model that the assistant used for this run.
          type: string
        instructions:
          description: The instructions that the assistant used for this run.
          type: string
        tools:
          description: The list of tools that the assistant used for this run.
          default: []
          type: array
          maxItems: 20
          items:
            oneOf:
              - $ref: '#/components/schemas/assistantToolsCode'
              - $ref: '#/components/schemas/assistantToolsFileSearch'
              - $ref: '#/components/schemas/assistantToolsFunction'            
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        usage:
          $ref: "#/components/schemas/runCompletionUsage"
        temperature:
          description: The sampling temperature used for this run. If not set, defaults to 1.
          type: number
          nullable: true
        top_p:
          description: The nucleus sampling value used for this run. If not set, defaults to 1.
          type: number
          nullable: true
        max_prompt_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of prompt tokens specified to have been used over the course of the run.
          minimum: 256
        max_completion_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of completion tokens specified to have been used over the course of the run.
          minimum: 256
        truncation_strategy:
          $ref: "#/components/schemas/truncationObject"
          nullable: true
        tool_choice:
          $ref: "#/components/schemas/assistantsApiToolChoiceOption"
          nullable: true
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - id
        - object
        - created_at
        - thread_id
        - assistant_id
        - status
        - required_action
        - last_error
        - expires_at
        - started_at
        - cancelled_at
        - failed_at
        - completed_at
        - model
        - instructions
        - tools
        - metadata
        - usage
        - incomplete_details
        - max_prompt_tokens
        - max_completion_tokens
        - truncation_strategy
        - tool_choice
        - response_format

    createRunRequest:
      type: object
      additionalProperties: false
      properties:
        assistant_id:
          description: The ID of the assistant to use to execute this run.
          type: string
        model:
          description: The ID of the Model to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
          type: string
          nullable: true
        instructions:
          description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
          type: string
          nullable: true
        additional_instructions:
          description: Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.
          type: string
          nullable: true
        additional_messages:
          description: Adds additional messages to the thread before creating the run.
          type: array
          items:
            $ref: "#/components/schemas/createMessageRequest"
          nullable: true
        tools:
          description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
          nullable: true
          type: array
          maxItems: 20
          items:
            oneOf:
              - $ref: '#/components/schemas/assistantToolsCode'
              - $ref: '#/components/schemas/assistantToolsFileSearch'
              - $ref: '#/components/schemas/assistantToolsFunction'
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
          description: *run_temperature_description
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: *run_top_p_description
        stream:
          type: boolean
          nullable: true
          description: |
            If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
        max_prompt_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
          minimum: 256
        max_completion_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
          minimum: 256
        truncation_strategy:
          $ref: "#/components/schemas/truncationObject"
          nullable: true
        tool_choice:
          $ref: "#/components/schemas/assistantsApiToolChoiceOption"
          nullable: true
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - thread_id
        - assistant_id

    listRunsResponse:
      type: object
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: '#/components/schemas/runObject'
        first_id:
          type: string
          example: run_hLBK7PXBv5Lr2NQT7KLY0ag1
        last_id:
          type: string
          example: run_QLoItBbqwyAJEzlTy4y9kOMM
        has_more:
          type: boolean
          example: false
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more

    modifyRunRequest:
      type: object
      additionalProperties: false
      properties:
        metadata:
          description: *metadata_description
          type: object
          nullable: true

    submitToolOutputsRunRequest:
      type: object
      additionalProperties: false
      properties:
        tool_outputs:
          description: A list of tools for which the outputs are being submitted.
          type: array
          items:
            type: object
            properties:
              tool_call_id:
                type: string
                description: The ID of the tool call in the `required_action` object within the run object the output is being submitted for.
              output:
                type: string
                description: The output of the tool call to be submitted to continue the run.
        stream:
          type: boolean
          nullable: true
          description: |
            If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
      required:
        - tool_outputs

    runToolCallObject:
      type: object
      description: Tool call objects
      properties:
        id:
          type: string
          description: The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint.
        type:
          type: string
          description: The type of tool call the output is required for. For now, this is always `function`.
          enum:
            - function
          x-ms-enum:
            name: RunToolCallObjectType
            modelAsString: true
            values:
              - value: function    
        function:
          type: object
          description: The function definition.
          properties:
            name:
              type: string
              description: The name of the function.
            arguments:
              type: string
              description: The arguments that the model expects you to pass to the function.
          required:
            - name
            - arguments
      required:
        - id
        - type
        - function

    createThreadAndRunRequest:
      type: object
      additionalProperties: false
      properties:
        assistant_id:
          description: The ID of the assistant to use to execute this run.
          type: string
        thread:
          $ref: '#/components/schemas/createThreadRequest'
          description: If no thread is provided, an empty thread will be created.
        model:
          description: The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
          type: string
          nullable: true
        instructions:
          description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
          type: string
          nullable: true
        tools:
          description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
          nullable: true
          type: array
          maxItems: 20
          items:
            oneOf:
              - $ref: '#/components/schemas/assistantToolsCode'
              - $ref: '#/components/schemas/assistantToolsFileSearch'
              - $ref: '#/components/schemas/assistantToolsFunction'
        tool_resources:
          type: object
          description: |
            A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: string
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
          description: *run_temperature_description
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: *run_top_p_description
        stream:
          type: boolean
          nullable: true
          description: |
            If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.
        max_prompt_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
          minimum: 256
        max_completion_tokens:
          type: integer
          nullable: true
          description: |
            The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.
          minimum: 256
        truncation_strategy:
          $ref: "#/components/schemas/truncationObject"
          nullable: true
        tool_choice:
          $ref: "#/components/schemas/assistantsApiToolChoiceOption"
          nullable: true
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - thread_id
        - assistant_id

    threadObject:
      type: object
      title: Thread
      description: Represents a thread that contains [messages](/docs/api-reference/messages).
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `thread`.
          type: string
          enum:
            - thread
          x-ms-enum:
            name: ThreadObjectType
            modelAsString: true
            values:
              - value: thread
                description: The type of thread object which is always `thread`
        created_at:
          description: The Unix timestamp (in seconds) for when the thread was created.
          type: integer
        tool_resources:
          type: object
          description: |
            A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: string
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
      required:
        - id
        - object
        - created_at
        - tool_resources
        - metadata
        
    createThreadRequest:
      type: object
      additionalProperties: false
      properties:
        messages:
          description: A list of messages to start the thread with.
          type: array
          items:
            $ref: '#/components/schemas/createMessageRequest'
        tool_resources:
          type: object
          description: |
            A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: string
                vector_stores:
                  type: array
                  description: |
                    A helper to create a vector store with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: object
                    properties:
                      file_ids:
                        type: array
                        description: |
                          A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
                        maxItems: 10000
                        items:
                          type: string
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



