specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-09-01-preview/inference.yaml [4272:6728]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        completion_tokens_details:
          type: object
          description: Breakdown of tokens used in a completion.
          properties:
            reasoning_tokens:
              type: integer
              description: Tokens generated by the model for reasoning.
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
    chatCompletionTool:
      type: object
      properties:
        type:
          type: string
          enum: ["function"]
          description: The type of the tool. Currently, only `function` is supported.
        function:
          $ref: "#/components/schemas/FunctionObject"
      required:
        - type
        - function

    FunctionParameters:
      type: object
      description: "The parameters the functions accepts, described as a JSON Schema object. See the guide](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list."
      additionalProperties: true

    FunctionObject:
      type: object
      properties:
        description:
          type: string
          description: A description of what the function does, used by the model to choose when and how to call the function.
        name:
          type: string
          description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
        parameters:
          $ref: "#/components/schemas/FunctionParameters"
        strict:
          type: boolean
          nullable: true
          default: false
          description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
      required:
        - name

    ResponseFormatText:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `text`"
          enum: ["text"]
      required:
        - type

    ResponseFormatJsonObject:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `json_object`"
          enum: ["json_object"]
      required:
        - type

    ResponseFormatJsonSchemaSchema:
      type: object
      description: "The schema for the response format, described as a JSON Schema object."
      additionalProperties: true

    ResponseFormatJsonSchema:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `json_schema`"
          enum: ["json_schema"]
        json_schema:
          type: object
          properties:
            description:
              type: string
              description: A description of what the response format is for, used by the model to determine how to respond in the format.
            name:
              type: string
              description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
            schema:
              $ref: "#/components/schemas/ResponseFormatJsonSchemaSchema"
            strict:
              type: boolean
              nullable: true
              default: false
              description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.
          required:
            - type
            - name
      required:
        - type
        - json_schema

    chatCompletionChoiceCommon:
      type: object
      properties:
        index:
          type: integer
        finish_reason:
          type: string
    createTranslationRequest:
      type: object
      description: Translation request.
      properties:
        file:
          type: string
          description: The audio file to translate.
          format: binary
        prompt:
          type: string
          description: An optional text to guide the model's style or continue a previous audio segment. The prompt should be in English.
        response_format:
          $ref: "#/components/schemas/audioResponseFormat"
        temperature:
          type: number
          default: 0
          description: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
      required:
        - file
    audioResponse:
      description: Translation or transcription response when response_format was json
      type: object
      properties:
        text:
          type: string
          description: Translated or transcribed text.
      required:
        - text
    audioVerboseResponse:
      description: Translation or transcription response when response_format was verbose_json
      type: object
      allOf:
        - $ref: "#/components/schemas/audioResponse"
        - properties:
            task:
              type: string
              description: Type of audio task.
              enum:
                - transcribe
                - translate
              x-ms-enum:
                modelAsString: true
            language:
              type: string
              description: Language.
            duration:
              type: number
              description: Duration.
            segments:
              type: array
              items:
                $ref: "#/components/schemas/audioSegment"
            words:
              type: array
              items:
                $ref: "#/components/schemas/audioWord"

      required:
        - text
    audioResponseFormat:
      title: AudioResponseFormat
      description: Defines the format of the output.
      enum:
        - json
        - text
        - srt
        - verbose_json
        - vtt
      type: string
      x-ms-enum:
        modelAsString: true
    createTranscriptionRequest:
      type: object
      description: Transcription request.
      properties:
        file:
          type: string
          description: The audio file object to transcribe.
          format: binary
        prompt:
          type: string
          description: An optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language.
        response_format:
          $ref: "#/components/schemas/audioResponseFormat"
        temperature:
          type: number
          default: 0
          description: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
        language:
          type: string
          description: The language of the input audio. Supplying the input language in ISO-639-1 format will improve accuracy and latency.
        timestamp_granularities[]:
          description: |
            The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.
          type: array
          items:
            type: string
            enum:
              - word
              - segment
          default: [segment]
      required:
        - file
    audioSegment:
      type: object
      description: Transcription or translation segment.
      properties:
        id:
          type: integer
          description: Segment identifier.
        seek:
          type: number
          description: Offset of the segment.
        start:
          type: number
          description: Segment start offset.
        end:
          type: number
          description: Segment end offset.
        text:
          type: string
          description: Segment text.
        tokens:
          type: array
          items:
            type: number
            nullable: false
          description: Tokens of the text.
        temperature:
          type: number
          description: Temperature.
        avg_logprob:
          type: number
          description: Average log probability.
        compression_ratio:
          type: number
          description: Compression ratio.
        no_speech_prob:
          type: number
          description: Probability of 'no speech'.
    audioWord:
      type: object
      description: Transcription or translation word.
      properties:
        word:
          type: string
          description: Word
        start:
          type: number
          description: Word start offset.
        end:
          type: number
          description: Word end offset.
    createSpeechRequest:
      type: object
      description: Speech request.
      properties:
        input:
          type: string
          description: The text to synthesize audio for. The maximum length is 4096 characters.
          maxLength: 4096
        voice:
          type: string
          description: The voice to use for speech synthesis.
          enum:
            - alloy
            - echo
            - fable
            - onyx
            - nova
            - shimmer
        response_format:
          type: string
          description: The format to synthesize the audio in.
          enum:
            - mp3
            - opus
            - aac
            - flac
            - wav
            - pcm
        speed:
          description: The speed of the synthesize audio. Select a value from `0.25` to `4.0`. `1.0` is the default.
          type: number
          default: 1
          minimum: 0.25
          maximum: 4
      required:
        - input
        - voice
    imageQuality:
      description: The quality of the image that will be generated.
      type: string
      enum:
        - standard
        - hd
      default: standard
      x-ms-enum:
        name: Quality
        modelAsString: true
        values:
          - value: standard
            description: Standard quality creates images with standard quality.
            name: Standard
          - value: hd
            description: HD quality creates images with finer details and greater consistency across the image.
            name: HD
    imagesResponseFormat:
      description: The format in which the generated images are returned.
      type: string
      enum:
        - url
        - b64_json
      default: url
      x-ms-enum:
        name: ImagesResponseFormat
        modelAsString: true
        values:
          - value: url
            description: The URL that provides temporary access to download the generated images.
            name: Url
          - value: b64_json
            description: The generated images are returned as base64 encoded string.
            name: Base64Json
    imageSize:
      description: The size of the generated images.
      type: string
      enum:
        - 256x256
        - 512x512
        - 1792x1024
        - 1024x1792
        - 1024x1024
      default: 1024x1024
      x-ms-enum:
        name: Size
        modelAsString: true
        values:
          - value: 256x256
            description: The desired size of the generated image is 256x256 pixels. Only supported for dall-e-2.
            name: Size256x256
          - value: 512x512
            description: The desired size of the generated image is 512x512 pixels. Only supported for dall-e-2.
            name: Size512x512
          - value: 1792x1024
            description: The desired size of the generated image is 1792x1024 pixels. Only supported for dall-e-3.
            name: Size1792x1024
          - value: 1024x1792
            description: The desired size of the generated image is 1024x1792 pixels. Only supported for dall-e-3.
            name: Size1024x1792
          - value: 1024x1024
            description: The desired size of the generated image is 1024x1024 pixels.
            name: Size1024x1024
    imageStyle:
      description: The style of the generated images.
      type: string
      enum:
        - vivid
        - natural
      default: vivid
      x-ms-enum:
        name: Style
        modelAsString: true
        values:
          - value: vivid
            description: Vivid creates images that are hyper-realistic and dramatic.
            name: Vivid
          - value: natural
            description: Natural creates images that are more natural and less hyper-realistic.
            name: Natural
    imageGenerationsRequest:
      type: object
      properties:
        prompt:
          description: A text description of the desired image(s). The maximum length is 4000 characters.
          type: string
          format: string
          example: a corgi in a field
          minLength: 1
        "n":
          description: The number of images to generate.
          type: integer
          minimum: 1
          maximum: 1
          default: 1
        size:
          $ref: "#/components/schemas/imageSize"
        response_format:
          $ref: "#/components/schemas/imagesResponseFormat"
        user:
          description: A unique identifier representing your end-user, which can help to monitor and detect abuse.
          type: string
          format: string
          example: user123456
        quality:
          $ref: "#/components/schemas/imageQuality"
        style:
          $ref: "#/components/schemas/imageStyle"
      required:
        - prompt
    generateImagesResponse:
      type: object
      properties:
        created:
          type: integer
          format: unixtime
          description: The unix timestamp when the operation was created.
          example: "1676540381"
        data:
          type: array
          description: The result data of the operation, if successful
          items:
            $ref: "#/components/schemas/imageResult"
      required:
        - created
        - data
    imageResult:
      type: object
      description: The image url or encoded image if successful, and an error otherwise.
      properties:
        url:
          type: string
          description: The image url.
          example: https://www.contoso.com
        b64_json:
          type: string
          description: The base64 encoded image
        content_filter_results:
          $ref: "#/components/schemas/dalleContentFilterResults"
        revised_prompt:
          type: string
          description: The prompt that was used to generate the image, if there was any revision to the prompt.
        prompt_filter_results:
          $ref: "#/components/schemas/dalleFilterResults"
    line:
      type: object
      description: A content line object consisting of an adjacent sequence of content elements, such as words and selection marks.
      properties:
        text:
          type: string
        spans:
          type: array
          description: An array of spans that represent detected objects and its bounding box information.
          items:
            $ref: "#/components/schemas/span"
      required:
        - text
        - spans
    span:
      type: object
      description: A span object that represents a detected object and its bounding box information.
      properties:
        text:
          type: string
          description: The text content of the span that represents the detected object.
        offset:
          type: integer
          description: The character offset within the text where the span begins. This offset is defined as the position of the first character of the span, counting from the start of the text as Unicode codepoints.
        length:
          type: integer
          description: The length of the span in characters, measured in Unicode codepoints.
        polygon:
          type: array
          description: An array of objects representing points in the polygon that encloses the detected object.
          items:
            type: object
            properties:
              x:
                type: number
                description: The x-coordinate of the point.
              "y":
                type: number
                description: The y-coordinate of the point.
      required:
        - text
        - offset
        - length
        - polygon

    runCompletionUsage:
      type: object
      description: Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).
      properties:
        completion_tokens:
          type: integer
          description: Number of completion tokens used over the course of the run.
        prompt_tokens:
          type: integer
          description: Number of prompt tokens used over the course of the run.
        total_tokens:
          type: integer
          description: Total number of tokens used (prompt + completion).
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
      nullable: true

    runStepCompletionUsage:
      type: object
      description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.
      properties:
        completion_tokens:
          type: integer
          description: Number of completion tokens used over the course of the run step.
        prompt_tokens:
          type: integer
          description: Number of prompt tokens used over the course of the run step.
        total_tokens:
          type: integer
          description: Total number of tokens used (prompt + completion).
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
      nullable: true

    assistantsApiResponseFormatOption:
      description: |
        Specifies the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

        Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON.

        **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.
      oneOf:
        - type: string
          description: >
            `auto` is the default value
          enum: [none, auto]
          x-ms-enum:
            name: AssistantsApiResponseFormatOption
            modelAsString: true
            values:
              - value: none
              - value: auto
        - $ref: "#/components/schemas/assistantsApiResponseFormat"

    assistantsApiResponseFormat:
      type: object
      description: |
        An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. If `text` the model can return text or any value needed.
      properties:
        type:
          type: string
          enum: ["text", "json_object"]
          x-ms-enum:
            name: AssistantsApiResponseFormat
            modelAsString: true
            values:
              - value: text
              - value: json_object
          example: "json_object"
          default: "text"
          description: Must be one of `text` or `json_object`.

    assistantObject:
      type: object
      title: Assistant
      description: Represents an `assistant` that can call the model and use tools.
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `assistant`.
          type: string
          enum:
            - assistant
          x-ms-enum:
            name: AssistantObjectType
            modelAsString: true
            values:
              - value: assistant
        created_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the assistant was created.
        name:
          description: &assistant_name_param_description |
            The name of the assistant. The maximum length is 256 characters.
          type: string
          maxLength: 256
          nullable: true
        description:
          description: &assistant_description_param_description |
            The description of the assistant. The maximum length is 512 characters.
          type: string
          maxLength: 512
          nullable: true
        model:
          description: |
            ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.
          type: string
        instructions:
          description: &assistant_instructions_param_description |
            The system instructions that the assistant uses. The maximum length is 256,000 characters.
          type: string
          maxLength: 256000
          nullable: true
        tools:
          description: &assistant_tools_param_description |
            A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
          default: []
          type: array
          maxItems: 128
          items:
            oneOf:
              - $ref: "#/components/schemas/assistantToolsCode"
              - $ref: "#/components/schemas/assistantToolsFileSearch"
              - $ref: "#/components/schemas/assistantToolsFunction"
        tool_resources:
          type: object
          description: |
            A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: string
        metadata:
          description: &metadata_description |
            Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
          type: object
          nullable: true
        temperature:
          description: &run_temperature_description |
            What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: &run_top_p_description |
            An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

            We generally recommend altering this or temperature but not both.
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - id
        - object
        - created_at
        - name
        - description
        - model
        - instructions
        - tools
        - metadata

    createAssistantRequest:
      type: object
      additionalProperties: false
      properties:
        model:
          description: |
            ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.
          anyOf:
            - type: string
        name:
          description: *assistant_name_param_description
          type: string
          nullable: true
          maxLength: 256
        description:
          description: *assistant_description_param_description
          type: string
          nullable: true
          maxLength: 512
        instructions:
          description: *assistant_instructions_param_description
          type: string
          nullable: true
          maxLength: 256000
        tools:
          description: *assistant_tools_param_description
          default: []
          type: array
          maxItems: 128
          items:
            oneOf:
              - $ref: "#/components/schemas/assistantToolsCode"
              - $ref: "#/components/schemas/assistantToolsFileSearch"
              - $ref: "#/components/schemas/assistantToolsFunction"
        tool_resources:
          type: object
          description: |
            A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: string
                vector_stores:
                  type: array
                  description: |
                    A helper to create a vector store with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: object
                    properties:
                      file_ids:
                        type: array
                        description: |
                          A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
                        maxItems: 10000
                        items:
                          type: string
                      chunking_strategy:
                        # Ideally we'd reuse the chunking strategy schema here, but it doesn't expand properly
                        type: object
                        description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
                        oneOf:
                          - type: object
                            title: Auto Chunking Strategy
                            description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
                            additionalProperties: false
                            properties:
                              type:
                                type: string
                                description: Always `auto`.
                                enum: ["auto"]
                                x-ms-enum:
                                  name: AutoChunkingStrategyType
                                  modelAsString: true
                                  values:
                                    - value: auto
                            required:
                              - type
                          - type: object
                            title: Static Chunking Strategy
                            additionalProperties: false
                            properties:
                              type:
                                type: string
                                description: Always `static`.
                                enum: ["static"]
                                x-ms-enum:
                                  name: StaticChunkingStrategyType
                                  modelAsString: true
                                  values:
                                    - value: static
                              static:
                                type: object
                                additionalProperties: false
                                properties:
                                  max_chunk_size_tokens:
                                    type: integer
                                    minimum: 100
                                    maximum: 4096
                                    description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
                                  chunk_overlap_tokens:
                                    type: integer
                                    description: |
                                      The number of tokens that overlap between chunks. The default value is `400`.

                                      Note that the overlap must not exceed half of `max_chunk_size_tokens`.
                                required:
                                  - max_chunk_size_tokens
                                  - chunk_overlap_tokens
                            required:
                              - type
                              - static
                      metadata:
                        type: object
                        description: |
                          Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
              oneOf:
                - required: [vector_store_ids]
                - required: [vector_stores]
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        temperature:
          description: *run_temperature_description
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: *run_top_p_description
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - model

    modifyAssistantRequest:
      type: object
      additionalProperties: false
      properties:
        model:
          description: |
            ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.
          anyOf:
            - type: string
        name:
          description: |
            The name of the assistant. The maximum length is 256 characters.
          type: string
          nullable: true
          maxLength: 256
        description:
          description: |
            The description of the assistant. The maximum length is 512 characters.
          type: string
          nullable: true
          maxLength: 512
        instructions:
          description: |
            The system instructions that the assistant uses. The maximum length is 32768 characters.
          type: string
          nullable: true
          maxLength: 32768
        tools:
          description: |
            A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
          default: []
          type: array
          maxItems: 128
          items:
            oneOf:
              - $ref: "#/components/schemas/assistantToolsCode"
              - $ref: "#/components/schemas/assistantToolsFileSearch"
              - $ref: "#/components/schemas/assistantToolsFunction"
        tool_resources:
          type: object
          description: |
            A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: string
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        temperature:
          description: *run_temperature_description
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: *run_top_p_description
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true

    deleteAssistantResponse:
      type: object
      properties:
        id:
          type: string
        deleted:
          type: boolean
        object:
          type: string
          enum:
            - assistant.deleted
          x-ms-enum:
            name: DeleteAssistantResponseState
            modelAsString: true
            values:
              - value: assistant.deleted
      required:
        - id
        - object
        - deleted

    listAssistantsResponse:
      type: object
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: "#/components/schemas/assistantObject"
        first_id:
          type: string
          example: asst_hLBK7PXBv5Lr2NQT7KLY0ag1
        last_id:
          type: string
          example: asst_QLoItBbqwyAJEzlTy4y9kOMM
        has_more:
          type: boolean
          example: false
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more

    assistantToolsCode:
      type: object
      title: Code interpreter tool
      properties:
        type:
          type: string
          description: "The type of tool being defined: `code_interpreter`"
          enum:
            - code_interpreter
          x-ms-enum:
            name: assistantToolsCodeType
            modelAsString: true
            values:
              - value: code_interpreter
      required:
        - type

    assistantToolsFileSearch:
      type: object
      title: FileSearch tool
      properties:
        type:
          type: string
          description: "The type of tool being defined: `file_search`"
          enum:
            - file_search
          x-ms-enum:
            name: assistantToolsFileSearchType
            modelAsString: true
            values:
              - value: file_search
        file_search:
          type: object
          description: Overrides for the file search tool.
          properties:
            max_num_results:
              type: integer
              minimum: 1
              maximum: 50
              description: |
                The maximum number of results the file search tool should output. The
                default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number
                should be between 1 and 50 inclusive.


                Note that the file search tool may output fewer than `max_num_results`
                results. See the [file search tool
                documentation](/docs/assistants/tools/file-search/number-of-chunks-returned)
                for more information.
      required:
        - type

    assistantToolsFileSearchTypeOnly:
      type: object
      title: FileSearch tool
      properties:
        type:
          type: string
          description: "The type of tool being defined: `file_search`"
          enum:
            - file_search
          x-ms-enum:
            name: assistantToolsFileSearchType
            modelAsString: true
            values:
              - value: file_search
      required:
        - type

    assistantToolsFunction:
      type: object
      title: Function tool
      properties:
        type:
          type: string
          description: "The type of tool being defined: `function`"
          enum:
            - function
          x-ms-enum:
            name: assistantToolsFunction
            modelAsString: true
            values:
              - value: function
        function:
          type: object
          description: The function definition.
          properties:
            description:
              type: string
              description: A description of what the function does, used by the model to choose when and how to call the function.
            name:
              type: string
              description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
            parameters:
              $ref: "#/components/schemas/chatCompletionFunctionParameters"
          required:
            - name
            - parameters
            - description
      required:
        - type
        - function

    truncationObject:
      type: object
      title: Thread Truncation Controls
      description: Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
      properties:
        type:
          type: string
          description: The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
          enum: ["auto", "last_messages"]
          x-ms-enum:
            name: TruncationType
            modelAsString: true
            values:
              - value: auto
              - value: last_messages
        last_messages:
          type: integer
          description: The number of most recent messages from the thread when constructing the context for the run.
          minimum: 1
          nullable: true
      required:
        - type

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

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

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

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

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

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

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

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

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

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

    createThreadRequest:
      type: object
      additionalProperties: false
      properties:
        messages:
          description: A list of messages to start the thread with.
          type: array
          items:
            $ref: "#/components/schemas/createMessageRequest"
        tool_resources:
          type: object
          description: |
            A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: string
                vector_stores:
                  type: array
                  description: |
                    A helper to create a vector store with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: object
                    properties:
                      file_ids:
                        type: array
                        description: |
                          A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
                        maxItems: 10000
                        items:
                          type: string
                      chunking_strategy:
                        # Ideally we'd reuse the chunking strategy schema here, but it doesn't expand properly
                        type: object
                        description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
                        oneOf:
                          - type: object
                            title: Auto Chunking Strategy
                            description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
                            additionalProperties: false
                            properties:
                              type:
                                type: string
                                description: Always `auto`.
                                enum: ["auto"]
                                x-ms-enum:
                                  name: AutoChunkingStrategyType
                                  modelAsString: true
                                  values:
                                    - value: auto
                            required:
                              - type
                          - type: object
                            title: Static Chunking Strategy
                            additionalProperties: false
                            properties:
                              type:
                                type: string
                                description: Always `static`.
                                enum: ["static"]
                                x-ms-enum:
                                  name: StaticChunkingStrategyType
                                  modelAsString: true
                                  values:
                                    - value: static
                              static:
                                type: object
                                additionalProperties: false
                                properties:
                                  max_chunk_size_tokens:
                                    type: integer
                                    minimum: 100
                                    maximum: 4096
                                    description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
                                  chunk_overlap_tokens:
                                    type: integer
                                    description: |
                                      The number of tokens that overlap between chunks. The default value is `400`.

                                      Note that the overlap must not exceed half of `max_chunk_size_tokens`.
                                required:
                                  - max_chunk_size_tokens
                                  - chunk_overlap_tokens
                            required:
                              - type
                              - static
                      metadata:
                        type: object
                        description: |
                          Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
              oneOf:
                - required: [vector_store_ids]
                - required: [vector_stores]
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true

    modifyThreadRequest:
      type: object
      additionalProperties: false
      properties:
        tool_resources:
          type: object
          description: |
            A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of File IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: string
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true

    deleteThreadResponse:
      type: object
      properties:
        id:
          type: string
        deleted:
          type: boolean
        object:
          type: string
          enum:
            - thread.deleted
          x-ms-enum:
            name: DeleteThreadResponseObjectState
            modelAsString: true
            values:
              - value: thread.deleted
                description: The delete thread response object state which is `thread.deleted`
      required:
        - id
        - object
        - deleted

    listThreadsResponse:
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: "#/components/schemas/threadObject"
        first_id:
          type: string
          example: asst_hLBK7PXBv5Lr2NQT7KLY0ag1
        last_id:
          type: string
          example: asst_QLoItBbqwyAJEzlTy4y9kOMM
        has_more:
          type: boolean
          example: false
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more

    messageObject:
      type: object
      title: The message object
      description: Represents a message within a [thread](/docs/api-reference/threads).
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `thread.message`.
          type: string
          enum:
            - thread.message
          x-ms-enum:
            name: MessageObjectType
            modelAsString: true
            values:
              - value: thread.message
                description: The message object type which is `thread.message`
        created_at:
          description: The Unix timestamp (in seconds) for when the message was created.
          type: integer
        thread_id:
          description: The [thread](/docs/api-reference/threads) ID that this message belongs to.
          type: string
        status:
          description: The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.
          type: string
          enum: ["in_progress", "incomplete", "completed"]
          x-ms-enum:
            name: MessageObjectStatus
            modelAsString: true
            values:
              - value: in_progress
              - value: incomplete
              - value: completed
        incomplete_details:
          description: On an incomplete message, details about why the message is incomplete.
          type: object
          properties:
            reason:
              type: string
              description: The reason the message is incomplete.
              enum:
                [
                  "content_filter",
                  "max_tokens",
                  "run_cancelled",
                  "run_expired",
                  "run_failed",
                ]
              x-ms-enum:
                name: MessageObjectIncompleteReason
                modelAsString: true
                values:
                  - value: content_filter
                  - value: max_tokens
                  - value: run_cancelled
                  - value: run_expired
                  - value: run_failed
          nullable: true
          required:
            - reason
        completed_at:
          description: The Unix timestamp (in seconds) for when the message was completed.
          type: integer
          nullable: true
        incomplete_at:
          description: The Unix timestamp (in seconds) for when the message was marked as incomplete.
          type: integer
          nullable: true
        role:
          description: The entity that produced the message. One of `user` or `assistant`.
          type: string
          enum:
            - user
            - assistant
          x-ms-enum:
            name: MessageObjectRole
            modelAsString: true
            values:
              - value: user
              - value: assistant
        content:
          description: The content of the message in array of text and/or images.
          type: array
          items:
            oneOf:
              - $ref: "#/components/schemas/messageContentImageFileObject"
              - $ref: "#/components/schemas/messageContentTextObject"
        assistant_id:
          description: If applicable, the ID of the assistant that authored this message.
          type: string
          nullable: true
        run_id:
          description: If applicable, the ID of the [run](/docs/api-reference/runs) associated with the authoring of this message.
          type: string
          nullable: true
        attachments:
          type: array
          items:
            type: object
            properties:
              file_id:
                type: string
                description: The ID of the file to attach to the message.
              tools:
                description: The tools to add this file to.
                type: array
                items:
                  oneOf:
                    - $ref: "#/components/schemas/assistantToolsCode"
                    - $ref: "#/components/schemas/assistantToolsFileSearchTypeOnly"
          description: A list of files attached to the message, and the tools they were added to.
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
      required:
        - id
        - object
        - created_at
        - thread_id
        - status
        - incomplete_details
        - completed_at
        - incomplete_at
        - role
        - content
        - assistant_id
        - run_id
        - attachments
        - metadata

    messageDeltaObject:
      type: object
      title: Message delta object
      description: |
        Represents a message delta i.e. any changed fields on a message during streaming.
      properties:
        id:
          description: The identifier of the message, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `thread.message.delta`.
          type: string
          enum: ["thread.message.delta"]
          x-ms-enum:
            name: MessageDeltaObjectType
            modelAsString: true
            values:
              - value: thread.message.delta
        delta:
          description: The delta containing the fields that have changed on the Message.
          type: object
          properties:
            role:
              description: The entity that produced the message. One of `user` or `assistant`.
              type: string
              enum: ["user", "assistant"]
              x-ms-enum:
                name: MessageDeltaObjectDeltaRole
                modelAsString: true
                values:
                  - value: user
                  - value: assistant
            content:
              description: The content of the message in array of text and/or images.
              type: array
              items:
                oneOf:
                  - $ref: "#/components/schemas/messageDeltaContentImageFileObject"
                  - $ref: "#/components/schemas/messageDeltaContentTextObject"
      required:
        - id
        - object
        - delta

    createMessageRequest:
      type: object
      additionalProperties: false
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          x-ms-enum:
            name: CreateMessageRequestRole
            modelAsString: true
            values:
              - value: user
              - value: assistant
          description: |
            The role of the entity that is creating the message. Allowed values include:
            - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
            - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.
        content:
          type: string
          minLength: 1
          maxLength: 256000
          description: The content of the message.
        attachments:
          type: array
          items:
            type: object
            properties:
              file_id:
                type: string
                description: The ID of the file to attach to the message.
              tools:
                description: The tools to add this file to.
                type: array
                items:
                  oneOf:
                    - $ref: "#/components/schemas/assistantToolsCode"
                    - $ref: "#/components/schemas/assistantToolsFileSearchTypeOnly"
                  x-oaiExpandable: true
          description: A list of files attached to the message, and the tools they should be added to.
          required:
            - file_id
            - tools
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
    modifyMessageRequest:
      type: object
      additionalProperties: false
      properties:
        metadata:
          description: *metadata_description
          type: object
          nullable: true
    deleteMessageResponse:
      type: object
      properties:
        id:
          type: string
        deleted:
          type: boolean
        object:
          type: string
          enum:
            - thread.message.deleted
          x-ms-enum:
            name: DeleteMessageResponseObject
            modelAsString: true
            values:
              - value: thread.message.deleted
                description: The delete message response object state
      required:
        - id
        - object
        - deleted
    listMessagesResponse:
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: "#/components/schemas/messageObject"
        first_id:
          type: string
          example: msg_hLBK7PXBv5Lr2NQT7KLY0ag1
        last_id:
          type: string
          example: msg_QLoItBbqwyAJEzlTy4y9kOMM
        has_more:
          type: boolean
          example: false
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more

    messageContentImageFileObject:
      title: Image file
      type: object
      description: References an image file in the content of a message.
      properties:
        type:
          description: Always `image_file`.
          type: string
          enum:
            - image_file
          x-ms-enum:
            name: MessageContentImageFileObjectType
            modelAsString: true
            values:
              - value: image_file
                description: The message content image file type
        image_file:
          type: object
          properties:
            file_id:
              description: The file ID of the image in the message content.
              type: string
          required:
            - file_id
      required:
        - type
        - image_file

    messageContentTextObject:
      title: Text
      type: object
      description: The text content that is part of a message.
      properties:
        type:
          description: Always `text`.
          type: string
          enum:
            - text
          x-ms-enum:
            name: messageContentTextObjectType
            modelAsString: true
            values:
              - value: text
                description: The message content text Object type
        text:
          type: object
          properties:
            value:
              description: The data that makes up the text.
              type: string
            annotations:
              type: array
              items:
                oneOf:
                  - $ref: "#/components/schemas/messageContentTextAnnotationsFileCitationObject"
                  - $ref: "#/components/schemas/messageContentTextAnnotationsFilePathObject"
          required:
            - value
            - annotations
      required:
        - type
        - text

    messageContentTextAnnotationsFileCitationObject:
      title: File citation
      type: object
      description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "retrieval" tool to search files.
      properties:
        type:
          description: Always `file_citation`.
          type: string
          enum:
            - file_citation
          x-ms-enum:
            name: FileCitationObjectType
            modelAsString: true
            values:
              - value: file_citation
                description: The file citation object type
        text:
          description: The text in the message content that needs to be replaced.
          type: string
        file_citation:
          type: object
          properties:
            file_id:
              description: The ID of the specific File the citation is from.
              type: string
          required:
            - file_id
        start_index:
          type: integer
          minimum: 0
        end_index:
          type: integer
          minimum: 0
      required:
        - type
        - text
        - file_citation
        - start_index
        - end_index

    messageContentTextAnnotationsFilePathObject:
      title: File path
      type: object
      description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.
      properties:
        type:
          description: Always `file_path`.
          type: string
          enum:
            - file_path
          x-ms-enum:
            name: FilePathObjectType
            modelAsString: true
            values:
              - value: file_path
                description: The file path object type
        text:
          description: The text in the message content that needs to be replaced.
          type: string
        file_path:
          type: object
          properties:
            file_id:
              description: The ID of the file that was generated.
              type: string
          required:
            - file_id
        start_index:
          type: integer
          minimum: 0
        end_index:
          type: integer
          minimum: 0
      required:
        - type
        - text
        - file_path
        - start_index
        - end_index

    messageDeltaContentImageFileObject:
      title: Image file
      type: object
      description: References an image File in the content of a message.
      properties:
        index:
          type: integer
          description: The index of the content part in the message.
        type:
          description: Always `image_file`.
          type: string
          enum: ["image_file"]
          x-ms-enum:
            name: MessageDeltaContentImageFileObjectType
            modelAsString: true
            values:
              - value: image_file
        image_file:
          type: object
          properties:
            file_id:
              description: The File ID of the image in the message content.
              type: string
      required:
        - index
        - type

    messageDeltaContentTextObject:
      title: Text
      type: object
      description: The text content that is part of a message.
      properties:
        index:
          type: integer
          description: The index of the content part in the message.
        type:
          description: Always `text`.
          type: string
          enum: ["text"]
          x-ms-enum:
            name: MessageDeltaContentTextObjectType
            modelAsString: true
            values:
              - value: text
        text:
          type: object
          properties:
            value:
              description: The data that makes up the text.
              type: string
            annotations:
              type: array
              items:
                oneOf:
                  - $ref: "#/components/schemas/messageDeltaContentTextAnnotationsFileCitationObject"
                  - $ref: "#/components/schemas/messageDeltaContentTextAnnotationsFilePathObject"
      required:
        - index
        - type

    messageDeltaContentTextAnnotationsFileCitationObject:
      title: File citation
      type: object
      description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.
      properties:
        index:
          type: integer
          description: The index of the annotation in the text content part.
        type:
          description: Always `file_citation`.
          type: string
          enum: ["file_citation"]
          x-ms-enum:
            name: MessageDeltaContentTextAnnotationsFileCitationObjectType
            modelAsString: true
            values:
              - value: file_citation
        text:
          description: The text in the message content that needs to be replaced.
          type: string
        file_citation:
          type: object
          properties:
            file_id:
              description: The ID of the specific File the citation is from.
              type: string
            quote:
              description: The specific quote in the file.
              type: string
        start_index:
          type: integer
          minimum: 0
        end_index:
          type: integer
          minimum: 0
      required:
        - index
        - type

    messageDeltaContentTextAnnotationsFilePathObject:
      title: File path
      type: object
      description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-10-01-preview/inference.yaml [4308:6764]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        completion_tokens_details:
          type: object
          description: Breakdown of tokens used in a completion.
          properties:
            reasoning_tokens:
              type: integer
              description: Tokens generated by the model for reasoning.
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
    chatCompletionTool:
      type: object
      properties:
        type:
          type: string
          enum: ["function"]
          description: The type of the tool. Currently, only `function` is supported.
        function:
          $ref: "#/components/schemas/FunctionObject"
      required:
        - type
        - function

    FunctionParameters:
      type: object
      description: "The parameters the functions accepts, described as a JSON Schema object. See the guide](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list."
      additionalProperties: true

    FunctionObject:
      type: object
      properties:
        description:
          type: string
          description: A description of what the function does, used by the model to choose when and how to call the function.
        name:
          type: string
          description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
        parameters:
          $ref: "#/components/schemas/FunctionParameters"
        strict:
          type: boolean
          nullable: true
          default: false
          description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
      required:
        - name

    ResponseFormatText:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `text`"
          enum: ["text"]
      required:
        - type

    ResponseFormatJsonObject:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `json_object`"
          enum: ["json_object"]
      required:
        - type

    ResponseFormatJsonSchemaSchema:
      type: object
      description: "The schema for the response format, described as a JSON Schema object."
      additionalProperties: true

    ResponseFormatJsonSchema:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `json_schema`"
          enum: ["json_schema"]
        json_schema:
          type: object
          properties:
            description:
              type: string
              description: A description of what the response format is for, used by the model to determine how to respond in the format.
            name:
              type: string
              description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
            schema:
              $ref: "#/components/schemas/ResponseFormatJsonSchemaSchema"
            strict:
              type: boolean
              nullable: true
              default: false
              description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`.
          required:
            - type
            - name
      required:
        - type
        - json_schema

    chatCompletionChoiceCommon:
      type: object
      properties:
        index:
          type: integer
        finish_reason:
          type: string
    createTranslationRequest:
      type: object
      description: Translation request.
      properties:
        file:
          type: string
          description: The audio file to translate.
          format: binary
        prompt:
          type: string
          description: An optional text to guide the model's style or continue a previous audio segment. The prompt should be in English.
        response_format:
          $ref: "#/components/schemas/audioResponseFormat"
        temperature:
          type: number
          default: 0
          description: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
      required:
        - file
    audioResponse:
      description: Translation or transcription response when response_format was json
      type: object
      properties:
        text:
          type: string
          description: Translated or transcribed text.
      required:
        - text
    audioVerboseResponse:
      description: Translation or transcription response when response_format was verbose_json
      type: object
      allOf:
        - $ref: "#/components/schemas/audioResponse"
        - properties:
            task:
              type: string
              description: Type of audio task.
              enum:
                - transcribe
                - translate
              x-ms-enum:
                modelAsString: true
            language:
              type: string
              description: Language.
            duration:
              type: number
              description: Duration.
            segments:
              type: array
              items:
                $ref: "#/components/schemas/audioSegment"
            words:
              type: array
              items:
                $ref: "#/components/schemas/audioWord"

      required:
        - text
    audioResponseFormat:
      title: AudioResponseFormat
      description: Defines the format of the output.
      enum:
        - json
        - text
        - srt
        - verbose_json
        - vtt
      type: string
      x-ms-enum:
        modelAsString: true
    createTranscriptionRequest:
      type: object
      description: Transcription request.
      properties:
        file:
          type: string
          description: The audio file object to transcribe.
          format: binary
        prompt:
          type: string
          description: An optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language.
        response_format:
          $ref: "#/components/schemas/audioResponseFormat"
        temperature:
          type: number
          default: 0
          description: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
        language:
          type: string
          description: The language of the input audio. Supplying the input language in ISO-639-1 format will improve accuracy and latency.
        timestamp_granularities[]:
          description: |
            The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.
          type: array
          items:
            type: string
            enum:
              - word
              - segment
          default: [segment]
      required:
        - file
    audioSegment:
      type: object
      description: Transcription or translation segment.
      properties:
        id:
          type: integer
          description: Segment identifier.
        seek:
          type: number
          description: Offset of the segment.
        start:
          type: number
          description: Segment start offset.
        end:
          type: number
          description: Segment end offset.
        text:
          type: string
          description: Segment text.
        tokens:
          type: array
          items:
            type: number
            nullable: false
          description: Tokens of the text.
        temperature:
          type: number
          description: Temperature.
        avg_logprob:
          type: number
          description: Average log probability.
        compression_ratio:
          type: number
          description: Compression ratio.
        no_speech_prob:
          type: number
          description: Probability of 'no speech'.
    audioWord:
      type: object
      description: Transcription or translation word.
      properties:
        word:
          type: string
          description: Word
        start:
          type: number
          description: Word start offset.
        end:
          type: number
          description: Word end offset.
    createSpeechRequest:
      type: object
      description: Speech request.
      properties:
        input:
          type: string
          description: The text to synthesize audio for. The maximum length is 4096 characters.
          maxLength: 4096
        voice:
          type: string
          description: The voice to use for speech synthesis.
          enum:
            - alloy
            - echo
            - fable
            - onyx
            - nova
            - shimmer
        response_format:
          type: string
          description: The format to synthesize the audio in.
          enum:
            - mp3
            - opus
            - aac
            - flac
            - wav
            - pcm
        speed:
          description: The speed of the synthesize audio. Select a value from `0.25` to `4.0`. `1.0` is the default.
          type: number
          default: 1
          minimum: 0.25
          maximum: 4
      required:
        - input
        - voice
    imageQuality:
      description: The quality of the image that will be generated.
      type: string
      enum:
        - standard
        - hd
      default: standard
      x-ms-enum:
        name: Quality
        modelAsString: true
        values:
          - value: standard
            description: Standard quality creates images with standard quality.
            name: Standard
          - value: hd
            description: HD quality creates images with finer details and greater consistency across the image.
            name: HD
    imagesResponseFormat:
      description: The format in which the generated images are returned.
      type: string
      enum:
        - url
        - b64_json
      default: url
      x-ms-enum:
        name: ImagesResponseFormat
        modelAsString: true
        values:
          - value: url
            description: The URL that provides temporary access to download the generated images.
            name: Url
          - value: b64_json
            description: The generated images are returned as base64 encoded string.
            name: Base64Json
    imageSize:
      description: The size of the generated images.
      type: string
      enum:
        - 256x256
        - 512x512
        - 1792x1024
        - 1024x1792
        - 1024x1024
      default: 1024x1024
      x-ms-enum:
        name: Size
        modelAsString: true
        values:
          - value: 256x256
            description: The desired size of the generated image is 256x256 pixels. Only supported for dall-e-2.
            name: Size256x256
          - value: 512x512
            description: The desired size of the generated image is 512x512 pixels. Only supported for dall-e-2.
            name: Size512x512
          - value: 1792x1024
            description: The desired size of the generated image is 1792x1024 pixels. Only supported for dall-e-3.
            name: Size1792x1024
          - value: 1024x1792
            description: The desired size of the generated image is 1024x1792 pixels. Only supported for dall-e-3.
            name: Size1024x1792
          - value: 1024x1024
            description: The desired size of the generated image is 1024x1024 pixels.
            name: Size1024x1024
    imageStyle:
      description: The style of the generated images.
      type: string
      enum:
        - vivid
        - natural
      default: vivid
      x-ms-enum:
        name: Style
        modelAsString: true
        values:
          - value: vivid
            description: Vivid creates images that are hyper-realistic and dramatic.
            name: Vivid
          - value: natural
            description: Natural creates images that are more natural and less hyper-realistic.
            name: Natural
    imageGenerationsRequest:
      type: object
      properties:
        prompt:
          description: A text description of the desired image(s). The maximum length is 4000 characters.
          type: string
          format: string
          example: a corgi in a field
          minLength: 1
        "n":
          description: The number of images to generate.
          type: integer
          minimum: 1
          maximum: 1
          default: 1
        size:
          $ref: "#/components/schemas/imageSize"
        response_format:
          $ref: "#/components/schemas/imagesResponseFormat"
        user:
          description: A unique identifier representing your end-user, which can help to monitor and detect abuse.
          type: string
          format: string
          example: user123456
        quality:
          $ref: "#/components/schemas/imageQuality"
        style:
          $ref: "#/components/schemas/imageStyle"
      required:
        - prompt
    generateImagesResponse:
      type: object
      properties:
        created:
          type: integer
          format: unixtime
          description: The unix timestamp when the operation was created.
          example: "1676540381"
        data:
          type: array
          description: The result data of the operation, if successful
          items:
            $ref: "#/components/schemas/imageResult"
      required:
        - created
        - data
    imageResult:
      type: object
      description: The image url or encoded image if successful, and an error otherwise.
      properties:
        url:
          type: string
          description: The image url.
          example: https://www.contoso.com
        b64_json:
          type: string
          description: The base64 encoded image
        content_filter_results:
          $ref: "#/components/schemas/dalleContentFilterResults"
        revised_prompt:
          type: string
          description: The prompt that was used to generate the image, if there was any revision to the prompt.
        prompt_filter_results:
          $ref: "#/components/schemas/dalleFilterResults"
    line:
      type: object
      description: A content line object consisting of an adjacent sequence of content elements, such as words and selection marks.
      properties:
        text:
          type: string
        spans:
          type: array
          description: An array of spans that represent detected objects and its bounding box information.
          items:
            $ref: "#/components/schemas/span"
      required:
        - text
        - spans
    span:
      type: object
      description: A span object that represents a detected object and its bounding box information.
      properties:
        text:
          type: string
          description: The text content of the span that represents the detected object.
        offset:
          type: integer
          description: The character offset within the text where the span begins. This offset is defined as the position of the first character of the span, counting from the start of the text as Unicode codepoints.
        length:
          type: integer
          description: The length of the span in characters, measured in Unicode codepoints.
        polygon:
          type: array
          description: An array of objects representing points in the polygon that encloses the detected object.
          items:
            type: object
            properties:
              x:
                type: number
                description: The x-coordinate of the point.
              "y":
                type: number
                description: The y-coordinate of the point.
      required:
        - text
        - offset
        - length
        - polygon

    runCompletionUsage:
      type: object
      description: Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).
      properties:
        completion_tokens:
          type: integer
          description: Number of completion tokens used over the course of the run.
        prompt_tokens:
          type: integer
          description: Number of prompt tokens used over the course of the run.
        total_tokens:
          type: integer
          description: Total number of tokens used (prompt + completion).
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
      nullable: true

    runStepCompletionUsage:
      type: object
      description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.
      properties:
        completion_tokens:
          type: integer
          description: Number of completion tokens used over the course of the run step.
        prompt_tokens:
          type: integer
          description: Number of prompt tokens used over the course of the run step.
        total_tokens:
          type: integer
          description: Total number of tokens used (prompt + completion).
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
      nullable: true

    assistantsApiResponseFormatOption:
      description: |
        Specifies the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

        Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON.

        **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.
      oneOf:
        - type: string
          description: >
            `auto` is the default value
          enum: [none, auto]
          x-ms-enum:
            name: AssistantsApiResponseFormatOption
            modelAsString: true
            values:
              - value: none
              - value: auto
        - $ref: "#/components/schemas/assistantsApiResponseFormat"

    assistantsApiResponseFormat:
      type: object
      description: |
        An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. If `text` the model can return text or any value needed.
      properties:
        type:
          type: string
          enum: ["text", "json_object"]
          x-ms-enum:
            name: AssistantsApiResponseFormat
            modelAsString: true
            values:
              - value: text
              - value: json_object
          example: "json_object"
          default: "text"
          description: Must be one of `text` or `json_object`.

    assistantObject:
      type: object
      title: Assistant
      description: Represents an `assistant` that can call the model and use tools.
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `assistant`.
          type: string
          enum:
            - assistant
          x-ms-enum:
            name: AssistantObjectType
            modelAsString: true
            values:
              - value: assistant
        created_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the assistant was created.
        name:
          description: &assistant_name_param_description |
            The name of the assistant. The maximum length is 256 characters.
          type: string
          maxLength: 256
          nullable: true
        description:
          description: &assistant_description_param_description |
            The description of the assistant. The maximum length is 512 characters.
          type: string
          maxLength: 512
          nullable: true
        model:
          description: |
            ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.
          type: string
        instructions:
          description: &assistant_instructions_param_description |
            The system instructions that the assistant uses. The maximum length is 256,000 characters.
          type: string
          maxLength: 256000
          nullable: true
        tools:
          description: &assistant_tools_param_description |
            A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
          default: []
          type: array
          maxItems: 128
          items:
            oneOf:
              - $ref: "#/components/schemas/assistantToolsCode"
              - $ref: "#/components/schemas/assistantToolsFileSearch"
              - $ref: "#/components/schemas/assistantToolsFunction"
        tool_resources:
          type: object
          description: |
            A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: string
        metadata:
          description: &metadata_description |
            Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
          type: object
          nullable: true
        temperature:
          description: &run_temperature_description |
            What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: &run_top_p_description |
            An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

            We generally recommend altering this or temperature but not both.
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - id
        - object
        - created_at
        - name
        - description
        - model
        - instructions
        - tools
        - metadata

    createAssistantRequest:
      type: object
      additionalProperties: false
      properties:
        model:
          description: |
            ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.
          anyOf:
            - type: string
        name:
          description: *assistant_name_param_description
          type: string
          nullable: true
          maxLength: 256
        description:
          description: *assistant_description_param_description
          type: string
          nullable: true
          maxLength: 512
        instructions:
          description: *assistant_instructions_param_description
          type: string
          nullable: true
          maxLength: 256000
        tools:
          description: *assistant_tools_param_description
          default: []
          type: array
          maxItems: 128
          items:
            oneOf:
              - $ref: "#/components/schemas/assistantToolsCode"
              - $ref: "#/components/schemas/assistantToolsFileSearch"
              - $ref: "#/components/schemas/assistantToolsFunction"
        tool_resources:
          type: object
          description: |
            A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: string
                vector_stores:
                  type: array
                  description: |
                    A helper to create a vector store with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: object
                    properties:
                      file_ids:
                        type: array
                        description: |
                          A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
                        maxItems: 10000
                        items:
                          type: string
                      chunking_strategy:
                        # Ideally we'd reuse the chunking strategy schema here, but it doesn't expand properly
                        type: object
                        description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
                        oneOf:
                          - type: object
                            title: Auto Chunking Strategy
                            description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
                            additionalProperties: false
                            properties:
                              type:
                                type: string
                                description: Always `auto`.
                                enum: ["auto"]
                                x-ms-enum:
                                  name: AutoChunkingStrategyType
                                  modelAsString: true
                                  values:
                                    - value: auto
                            required:
                              - type
                          - type: object
                            title: Static Chunking Strategy
                            additionalProperties: false
                            properties:
                              type:
                                type: string
                                description: Always `static`.
                                enum: ["static"]
                                x-ms-enum:
                                  name: StaticChunkingStrategyType
                                  modelAsString: true
                                  values:
                                    - value: static
                              static:
                                type: object
                                additionalProperties: false
                                properties:
                                  max_chunk_size_tokens:
                                    type: integer
                                    minimum: 100
                                    maximum: 4096
                                    description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
                                  chunk_overlap_tokens:
                                    type: integer
                                    description: |
                                      The number of tokens that overlap between chunks. The default value is `400`.

                                      Note that the overlap must not exceed half of `max_chunk_size_tokens`.
                                required:
                                  - max_chunk_size_tokens
                                  - chunk_overlap_tokens
                            required:
                              - type
                              - static
                      metadata:
                        type: object
                        description: |
                          Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
              oneOf:
                - required: [vector_store_ids]
                - required: [vector_stores]
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        temperature:
          description: *run_temperature_description
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: *run_top_p_description
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true
      required:
        - model

    modifyAssistantRequest:
      type: object
      additionalProperties: false
      properties:
        model:
          description: |
            ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.
          anyOf:
            - type: string
        name:
          description: |
            The name of the assistant. The maximum length is 256 characters.
          type: string
          nullable: true
          maxLength: 256
        description:
          description: |
            The description of the assistant. The maximum length is 512 characters.
          type: string
          nullable: true
          maxLength: 512
        instructions:
          description: |
            The system instructions that the assistant uses. The maximum length is 32768 characters.
          type: string
          nullable: true
          maxLength: 32768
        tools:
          description: |
            A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
          default: []
          type: array
          maxItems: 128
          items:
            oneOf:
              - $ref: "#/components/schemas/assistantToolsCode"
              - $ref: "#/components/schemas/assistantToolsFileSearch"
              - $ref: "#/components/schemas/assistantToolsFunction"
        tool_resources:
          type: object
          description: |
            A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
                  maxItems: 1
                  items:
                    type: string
        metadata:
          description: *metadata_description
          type: object
          nullable: true
        temperature:
          description: *run_temperature_description
          type: number
          minimum: 0
          maximum: 2
          default: 1
          example: 1
          nullable: true
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          example: 1
          nullable: true
          description: *run_top_p_description
        response_format:
          $ref: "#/components/schemas/assistantsApiResponseFormatOption"
          nullable: true

    deleteAssistantResponse:
      type: object
      properties:
        id:
          type: string
        deleted:
          type: boolean
        object:
          type: string
          enum:
            - assistant.deleted
          x-ms-enum:
            name: DeleteAssistantResponseState
            modelAsString: true
            values:
              - value: assistant.deleted
      required:
        - id
        - object
        - deleted

    listAssistantsResponse:
      type: object
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: "#/components/schemas/assistantObject"
        first_id:
          type: string
          example: asst_hLBK7PXBv5Lr2NQT7KLY0ag1
        last_id:
          type: string
          example: asst_QLoItBbqwyAJEzlTy4y9kOMM
        has_more:
          type: boolean
          example: false
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more

    assistantToolsCode:
      type: object
      title: Code interpreter tool
      properties:
        type:
          type: string
          description: "The type of tool being defined: `code_interpreter`"
          enum:
            - code_interpreter
          x-ms-enum:
            name: assistantToolsCodeType
            modelAsString: true
            values:
              - value: code_interpreter
      required:
        - type

    assistantToolsFileSearch:
      type: object
      title: FileSearch tool
      properties:
        type:
          type: string
          description: "The type of tool being defined: `file_search`"
          enum:
            - file_search
          x-ms-enum:
            name: assistantToolsFileSearchType
            modelAsString: true
            values:
              - value: file_search
        file_search:
          type: object
          description: Overrides for the file search tool.
          properties:
            max_num_results:
              type: integer
              minimum: 1
              maximum: 50
              description: |
                The maximum number of results the file search tool should output. The
                default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number
                should be between 1 and 50 inclusive.


                Note that the file search tool may output fewer than `max_num_results`
                results. See the [file search tool
                documentation](/docs/assistants/tools/file-search/number-of-chunks-returned)
                for more information.
      required:
        - type

    assistantToolsFileSearchTypeOnly:
      type: object
      title: FileSearch tool
      properties:
        type:
          type: string
          description: "The type of tool being defined: `file_search`"
          enum:
            - file_search
          x-ms-enum:
            name: assistantToolsFileSearchType
            modelAsString: true
            values:
              - value: file_search
      required:
        - type

    assistantToolsFunction:
      type: object
      title: Function tool
      properties:
        type:
          type: string
          description: "The type of tool being defined: `function`"
          enum:
            - function
          x-ms-enum:
            name: assistantToolsFunction
            modelAsString: true
            values:
              - value: function
        function:
          type: object
          description: The function definition.
          properties:
            description:
              type: string
              description: A description of what the function does, used by the model to choose when and how to call the function.
            name:
              type: string
              description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
            parameters:
              $ref: "#/components/schemas/chatCompletionFunctionParameters"
          required:
            - name
            - parameters
            - description
      required:
        - type
        - function

    truncationObject:
      type: object
      title: Thread Truncation Controls
      description: Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
      properties:
        type:
          type: string
          description: The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
          enum: ["auto", "last_messages"]
          x-ms-enum:
            name: TruncationType
            modelAsString: true
            values:
              - value: auto
              - value: last_messages
        last_messages:
          type: integer
          description: The number of most recent messages from the thread when constructing the context for the run.
          minimum: 1
          nullable: true
      required:
        - type

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

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

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

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

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

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

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

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

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

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

    createThreadRequest:
      type: object
      additionalProperties: false
      properties:
        messages:
          description: A list of messages to start the thread with.
          type: array
          items:
            $ref: "#/components/schemas/createMessageRequest"
        tool_resources:
          type: object
          description: |
            A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: string
                vector_stores:
                  type: array
                  description: |
                    A helper to create a vector store with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: object
                    properties:
                      file_ids:
                        type: array
                        description: |
                          A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
                        maxItems: 10000
                        items:
                          type: string
                      chunking_strategy:
                        # Ideally we'd reuse the chunking strategy schema here, but it doesn't expand properly
                        type: object
                        description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
                        oneOf:
                          - type: object
                            title: Auto Chunking Strategy
                            description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
                            additionalProperties: false
                            properties:
                              type:
                                type: string
                                description: Always `auto`.
                                enum: ["auto"]
                                x-ms-enum:
                                  name: AutoChunkingStrategyType
                                  modelAsString: true
                                  values:
                                    - value: auto
                            required:
                              - type
                          - type: object
                            title: Static Chunking Strategy
                            additionalProperties: false
                            properties:
                              type:
                                type: string
                                description: Always `static`.
                                enum: ["static"]
                                x-ms-enum:
                                  name: StaticChunkingStrategyType
                                  modelAsString: true
                                  values:
                                    - value: static
                              static:
                                type: object
                                additionalProperties: false
                                properties:
                                  max_chunk_size_tokens:
                                    type: integer
                                    minimum: 100
                                    maximum: 4096
                                    description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
                                  chunk_overlap_tokens:
                                    type: integer
                                    description: |
                                      The number of tokens that overlap between chunks. The default value is `400`.

                                      Note that the overlap must not exceed half of `max_chunk_size_tokens`.
                                required:
                                  - max_chunk_size_tokens
                                  - chunk_overlap_tokens
                            required:
                              - type
                              - static
                      metadata:
                        type: object
                        description: |
                          Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
              oneOf:
                - required: [vector_store_ids]
                - required: [vector_stores]
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true

    modifyThreadRequest:
      type: object
      additionalProperties: false
      properties:
        tool_resources:
          type: object
          description: |
            A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
          properties:
            code_interpreter:
              type: object
              properties:
                file_ids:
                  type: array
                  description: |
                    A list of File IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.
                  default: []
                  maxItems: 20
                  items:
                    type: string
            file_search:
              type: object
              properties:
                vector_store_ids:
                  type: array
                  description: |
                    The vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
                  maxItems: 1
                  items:
                    type: string
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true

    deleteThreadResponse:
      type: object
      properties:
        id:
          type: string
        deleted:
          type: boolean
        object:
          type: string
          enum:
            - thread.deleted
          x-ms-enum:
            name: DeleteThreadResponseObjectState
            modelAsString: true
            values:
              - value: thread.deleted
                description: The delete thread response object state which is `thread.deleted`
      required:
        - id
        - object
        - deleted

    listThreadsResponse:
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: "#/components/schemas/threadObject"
        first_id:
          type: string
          example: asst_hLBK7PXBv5Lr2NQT7KLY0ag1
        last_id:
          type: string
          example: asst_QLoItBbqwyAJEzlTy4y9kOMM
        has_more:
          type: boolean
          example: false
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more

    messageObject:
      type: object
      title: The message object
      description: Represents a message within a [thread](/docs/api-reference/threads).
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `thread.message`.
          type: string
          enum:
            - thread.message
          x-ms-enum:
            name: MessageObjectType
            modelAsString: true
            values:
              - value: thread.message
                description: The message object type which is `thread.message`
        created_at:
          description: The Unix timestamp (in seconds) for when the message was created.
          type: integer
        thread_id:
          description: The [thread](/docs/api-reference/threads) ID that this message belongs to.
          type: string
        status:
          description: The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.
          type: string
          enum: ["in_progress", "incomplete", "completed"]
          x-ms-enum:
            name: MessageObjectStatus
            modelAsString: true
            values:
              - value: in_progress
              - value: incomplete
              - value: completed
        incomplete_details:
          description: On an incomplete message, details about why the message is incomplete.
          type: object
          properties:
            reason:
              type: string
              description: The reason the message is incomplete.
              enum:
                [
                  "content_filter",
                  "max_tokens",
                  "run_cancelled",
                  "run_expired",
                  "run_failed",
                ]
              x-ms-enum:
                name: MessageObjectIncompleteReason
                modelAsString: true
                values:
                  - value: content_filter
                  - value: max_tokens
                  - value: run_cancelled
                  - value: run_expired
                  - value: run_failed
          nullable: true
          required:
            - reason
        completed_at:
          description: The Unix timestamp (in seconds) for when the message was completed.
          type: integer
          nullable: true
        incomplete_at:
          description: The Unix timestamp (in seconds) for when the message was marked as incomplete.
          type: integer
          nullable: true
        role:
          description: The entity that produced the message. One of `user` or `assistant`.
          type: string
          enum:
            - user
            - assistant
          x-ms-enum:
            name: MessageObjectRole
            modelAsString: true
            values:
              - value: user
              - value: assistant
        content:
          description: The content of the message in array of text and/or images.
          type: array
          items:
            oneOf:
              - $ref: "#/components/schemas/messageContentImageFileObject"
              - $ref: "#/components/schemas/messageContentTextObject"
        assistant_id:
          description: If applicable, the ID of the assistant that authored this message.
          type: string
          nullable: true
        run_id:
          description: If applicable, the ID of the [run](/docs/api-reference/runs) associated with the authoring of this message.
          type: string
          nullable: true
        attachments:
          type: array
          items:
            type: object
            properties:
              file_id:
                type: string
                description: The ID of the file to attach to the message.
              tools:
                description: The tools to add this file to.
                type: array
                items:
                  oneOf:
                    - $ref: "#/components/schemas/assistantToolsCode"
                    - $ref: "#/components/schemas/assistantToolsFileSearchTypeOnly"
          description: A list of files attached to the message, and the tools they were added to.
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
      required:
        - id
        - object
        - created_at
        - thread_id
        - status
        - incomplete_details
        - completed_at
        - incomplete_at
        - role
        - content
        - assistant_id
        - run_id
        - attachments
        - metadata

    messageDeltaObject:
      type: object
      title: Message delta object
      description: |
        Represents a message delta i.e. any changed fields on a message during streaming.
      properties:
        id:
          description: The identifier of the message, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `thread.message.delta`.
          type: string
          enum: ["thread.message.delta"]
          x-ms-enum:
            name: MessageDeltaObjectType
            modelAsString: true
            values:
              - value: thread.message.delta
        delta:
          description: The delta containing the fields that have changed on the Message.
          type: object
          properties:
            role:
              description: The entity that produced the message. One of `user` or `assistant`.
              type: string
              enum: ["user", "assistant"]
              x-ms-enum:
                name: MessageDeltaObjectDeltaRole
                modelAsString: true
                values:
                  - value: user
                  - value: assistant
            content:
              description: The content of the message in array of text and/or images.
              type: array
              items:
                oneOf:
                  - $ref: "#/components/schemas/messageDeltaContentImageFileObject"
                  - $ref: "#/components/schemas/messageDeltaContentTextObject"
      required:
        - id
        - object
        - delta

    createMessageRequest:
      type: object
      additionalProperties: false
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          x-ms-enum:
            name: CreateMessageRequestRole
            modelAsString: true
            values:
              - value: user
              - value: assistant
          description: |
            The role of the entity that is creating the message. Allowed values include:
            - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
            - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.
        content:
          type: string
          minLength: 1
          maxLength: 256000
          description: The content of the message.
        attachments:
          type: array
          items:
            type: object
            properties:
              file_id:
                type: string
                description: The ID of the file to attach to the message.
              tools:
                description: The tools to add this file to.
                type: array
                items:
                  oneOf:
                    - $ref: "#/components/schemas/assistantToolsCode"
                    - $ref: "#/components/schemas/assistantToolsFileSearchTypeOnly"
                  x-oaiExpandable: true
          description: A list of files attached to the message, and the tools they should be added to.
          required:
            - file_id
            - tools
          nullable: true
        metadata:
          description: *metadata_description
          type: object
          nullable: true
    modifyMessageRequest:
      type: object
      additionalProperties: false
      properties:
        metadata:
          description: *metadata_description
          type: object
          nullable: true
    deleteMessageResponse:
      type: object
      properties:
        id:
          type: string
        deleted:
          type: boolean
        object:
          type: string
          enum:
            - thread.message.deleted
          x-ms-enum:
            name: DeleteMessageResponseObject
            modelAsString: true
            values:
              - value: thread.message.deleted
                description: The delete message response object state
      required:
        - id
        - object
        - deleted
    listMessagesResponse:
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: "#/components/schemas/messageObject"
        first_id:
          type: string
          example: msg_hLBK7PXBv5Lr2NQT7KLY0ag1
        last_id:
          type: string
          example: msg_QLoItBbqwyAJEzlTy4y9kOMM
        has_more:
          type: boolean
          example: false
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more

    messageContentImageFileObject:
      title: Image file
      type: object
      description: References an image file in the content of a message.
      properties:
        type:
          description: Always `image_file`.
          type: string
          enum:
            - image_file
          x-ms-enum:
            name: MessageContentImageFileObjectType
            modelAsString: true
            values:
              - value: image_file
                description: The message content image file type
        image_file:
          type: object
          properties:
            file_id:
              description: The file ID of the image in the message content.
              type: string
          required:
            - file_id
      required:
        - type
        - image_file

    messageContentTextObject:
      title: Text
      type: object
      description: The text content that is part of a message.
      properties:
        type:
          description: Always `text`.
          type: string
          enum:
            - text
          x-ms-enum:
            name: messageContentTextObjectType
            modelAsString: true
            values:
              - value: text
                description: The message content text Object type
        text:
          type: object
          properties:
            value:
              description: The data that makes up the text.
              type: string
            annotations:
              type: array
              items:
                oneOf:
                  - $ref: "#/components/schemas/messageContentTextAnnotationsFileCitationObject"
                  - $ref: "#/components/schemas/messageContentTextAnnotationsFilePathObject"
          required:
            - value
            - annotations
      required:
        - type
        - text

    messageContentTextAnnotationsFileCitationObject:
      title: File citation
      type: object
      description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "retrieval" tool to search files.
      properties:
        type:
          description: Always `file_citation`.
          type: string
          enum:
            - file_citation
          x-ms-enum:
            name: FileCitationObjectType
            modelAsString: true
            values:
              - value: file_citation
                description: The file citation object type
        text:
          description: The text in the message content that needs to be replaced.
          type: string
        file_citation:
          type: object
          properties:
            file_id:
              description: The ID of the specific File the citation is from.
              type: string
          required:
            - file_id
        start_index:
          type: integer
          minimum: 0
        end_index:
          type: integer
          minimum: 0
      required:
        - type
        - text
        - file_citation
        - start_index
        - end_index

    messageContentTextAnnotationsFilePathObject:
      title: File path
      type: object
      description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.
      properties:
        type:
          description: Always `file_path`.
          type: string
          enum:
            - file_path
          x-ms-enum:
            name: FilePathObjectType
            modelAsString: true
            values:
              - value: file_path
                description: The file path object type
        text:
          description: The text in the message content that needs to be replaced.
          type: string
        file_path:
          type: object
          properties:
            file_id:
              description: The ID of the file that was generated.
              type: string
          required:
            - file_id
        start_index:
          type: integer
          minimum: 0
        end_index:
          type: integer
          minimum: 0
      required:
        - type
        - text
        - file_path
        - start_index
        - end_index

    messageDeltaContentImageFileObject:
      title: Image file
      type: object
      description: References an image File in the content of a message.
      properties:
        index:
          type: integer
          description: The index of the content part in the message.
        type:
          description: Always `image_file`.
          type: string
          enum: ["image_file"]
          x-ms-enum:
            name: MessageDeltaContentImageFileObjectType
            modelAsString: true
            values:
              - value: image_file
        image_file:
          type: object
          properties:
            file_id:
              description: The File ID of the image in the message content.
              type: string
      required:
        - index
        - type

    messageDeltaContentTextObject:
      title: Text
      type: object
      description: The text content that is part of a message.
      properties:
        index:
          type: integer
          description: The index of the content part in the message.
        type:
          description: Always `text`.
          type: string
          enum: ["text"]
          x-ms-enum:
            name: MessageDeltaContentTextObjectType
            modelAsString: true
            values:
              - value: text
        text:
          type: object
          properties:
            value:
              description: The data that makes up the text.
              type: string
            annotations:
              type: array
              items:
                oneOf:
                  - $ref: "#/components/schemas/messageDeltaContentTextAnnotationsFileCitationObject"
                  - $ref: "#/components/schemas/messageDeltaContentTextAnnotationsFilePathObject"
      required:
        - index
        - type

    messageDeltaContentTextAnnotationsFileCitationObject:
      title: File citation
      type: object
      description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.
      properties:
        index:
          type: integer
          description: The index of the annotation in the text content part.
        type:
          description: Always `file_citation`.
          type: string
          enum: ["file_citation"]
          x-ms-enum:
            name: MessageDeltaContentTextAnnotationsFileCitationObjectType
            modelAsString: true
            values:
              - value: file_citation
        text:
          description: The text in the message content that needs to be replaced.
          type: string
        file_citation:
          type: object
          properties:
            file_id:
              description: The ID of the specific File the citation is from.
              type: string
            quote:
              description: The specific quote in the file.
              type: string
        start_index:
          type: integer
          minimum: 0
        end_index:
          type: integer
          minimum: 0
      required:
        - index
        - type

    messageDeltaContentTextAnnotationsFilePathObject:
      title: File path
      type: object
      description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



