diff --git a/.castiron.stats.yml b/.castiron.stats.yml index bd10f3211..d897c9e86 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,7 +1,7 @@ schema_version: 1 -generation_id: dfd43ede-47aa-4010-85a7-902500e246d3 -openapi_spec_hash: d57efec7c76a156447c9ab739b446dc1 -openapi_transformed_spec_hash: 834e733aeb5425eae15cc1643c7e67cb +generation_id: 0312a4df-b818-4c52-bba2-575facfe906e +openapi_spec_hash: 51b199ef7fd5542bc4910765f9becd60 +openapi_transformed_spec_hash: 3ed525c2ff2947704b4142ce7de0a0f5 config_hash: 1d0b20f04f1b5fe5edc8b60dbad7a7d9 -codegen_sha: 95b1337ab8409a20ab2d5e3ce321bdb23ec6c18c -codegen_hash: 51771b70d1cefb3ce7562a0b0857a64d6585b338458d3b8de951b8e40c6c5391 +codegen_sha: d8ee30af62c00c93eebb8a33188493b78c2ba689 +codegen_hash: cb274b63ade7e28186fe37b8e98cd41c6b933e620b09eb7fc4a9cded9ff2f615 diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index e3527aadf..1594b63e1 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -1348,6 +1348,7 @@ paths: /audio/translations: post: operationId: createTranslation + deprecated: true tags: - Audio summary: Create translation @@ -1477,7 +1478,6 @@ paths: { "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?" } - deprecated: true /audio/voice_consents: post: operationId: createVoiceConsent @@ -26747,6 +26747,125 @@ paths: "error_type": "potentially_unintended_data_access", "reason": "Potentially unintended data access." } + /organization/external_keys: + post: + summary: Add an external key config for an organization + description: Add an external key config for an organization + operationId: Addanexternalkeyconfigforanorganization + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/V1OrganizationExternalKeysPostRequest' + required: true + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ExternalKeyResource' + security: + - AdminApiKeyAuth: [] + get: + summary: List the external key configs registered on the user's organization + description: List the external key configs registered on the user's organization + operationId: Listtheexternalkeyconfigsregisteredontheuser'sorganization + parameters: + - name: limit + in: query + required: false + schema: + type: integer + minimum: 0 + maximum: 100 + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/OrderEnum' + - name: after + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + - name: purpose + in: query + description: Filter by key purpose. When omitted, returns keys of all purposes. + required: false + schema: + $ref: '#/components/schemas/ExternalKeyPurpose' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ListExternalKeysResource' + security: + - AdminApiKeyAuth: [] + /organization/external_keys/{external_key_id}: + get: + summary: Retrieve an external key registration + description: Retrieve a stored external key registration for the user's organization. + operationId: Retrieveanexternalkeyregistration + parameters: + - name: external_key_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ExternalKeyResource' + security: + - AdminApiKeyAuth: [] + delete: + summary: Delete an external key config for the user's organization + description: Delete an external key config for the user's organization + operationId: Deleteanexternalkeyconfigfortheuser'sorganization + parameters: + - name: external_key_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ExternalKeyResource' + security: + - AdminApiKeyAuth: [] + /organization/external_keys/{external_key_id}/validate: + post: + summary: Validate an external key config for the user's organization + description: Validate an external key config for the user's organization + operationId: Validateanexternalkeyconfigfortheuser'sorganization + parameters: + - name: external_key_id + in: path + required: true + schema: + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/ValidateExternalKeyResource' + security: + - AdminApiKeyAuth: [] /live/sessions/{session_id}/content: get: tags: @@ -37559,125 +37678,6 @@ paths: "object": "response.input_tokens", "input_tokens": 11 } - /organization/external_keys: - post: - summary: Add an external key config for an organization - description: Add an external key config for an organization - operationId: Addanexternalkeyconfigforanorganization - parameters: [] - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/V1OrganizationExternalKeysPostRequest' - required: true - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/ExternalKeyResource' - security: - - AdminApiKeyAuth: [] - get: - summary: List the external key configs registered on the user's organization - description: List the external key configs registered on the user's organization - operationId: Listtheexternalkeyconfigsregisteredontheuser'sorganization - parameters: - - name: limit - in: query - required: false - schema: - type: integer - minimum: 0 - maximum: 100 - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/OrderEnum' - - name: after - in: query - required: false - schema: - anyOf: - - type: string - - type: 'null' - - name: purpose - in: query - description: Filter by key purpose. When omitted, returns keys of all purposes. - required: false - schema: - $ref: '#/components/schemas/ExternalKeyPurpose' - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/ListExternalKeysResource' - security: - - AdminApiKeyAuth: [] - /organization/external_keys/{external_key_id}: - get: - summary: Retrieve an external key registration - description: Retrieve a stored external key registration for the user's organization. - operationId: Retrieveanexternalkeyregistration - parameters: - - name: external_key_id - in: path - required: true - schema: - type: string - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/ExternalKeyResource' - security: - - AdminApiKeyAuth: [] - delete: - summary: Delete an external key config for the user's organization - description: Delete an external key config for the user's organization - operationId: Deleteanexternalkeyconfigfortheuser'sorganization - parameters: - - name: external_key_id - in: path - required: true - schema: - type: string - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/ExternalKeyResource' - security: - - AdminApiKeyAuth: [] - /organization/external_keys/{external_key_id}/validate: - post: - summary: Validate an external key config for the user's organization - description: Validate an external key config for the user's organization - operationId: Validateanexternalkeyconfigfortheuser'sorganization - parameters: - - name: external_key_id - in: path - required: true - schema: - type: string - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/ValidateExternalKeyResource' - security: - - AdminApiKeyAuth: [] webhooks: agent_environment_expired: post: @@ -38555,14 +38555,6 @@ components: - gpt-3.5-turbo-0125 - gpt-3.5-turbo-16k-0613 x-openai-enum-deprecations: - gpt-4.1: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4.1-mini: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-mini: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' gpt-5: message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' gpt-5-mini: @@ -38575,6 +38567,14 @@ components: message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' gpt-5-nano-2025-08-07: message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4.1: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4.1-mini: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-mini: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' AssistantToolsCode: type: object title: Code interpreter tool @@ -44307,6 +44307,8 @@ components: format: binary x-oaiMeta: exampleFilePath: mask.png + markup: + $ref: '#/components/schemas/markup' background: anyOf: - type: string @@ -44470,8 +44472,6 @@ components: example: high description: | The quality of the image that will be generated for GPT image models. The GPT image models support `low`, `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`. - markup: - $ref: '#/components/schemas/markup' required: - prompt - image @@ -46924,6 +46924,9 @@ components: $ref: '#/components/schemas/ImageRefParam' mask: $ref: '#/components/schemas/ImageRefParam' + markup: + $ref: '#/components/schemas/ImageRefParam' + description: A transparent PNG overlaid on the first image, referenced by file ID, HTTPS URL, or base64 data URL. Must match that image's dimensions after orientation and contain transparent pixels. Supports GPT Image 2.5 and 2.6. Cannot be combined with mask. prompt: type: string minLength: 1 @@ -47038,9 +47041,6 @@ components: description: Stream partial image results as events. partial_images: $ref: '#/components/schemas/PartialImages' - markup: - $ref: '#/components/schemas/ImageRefParam' - description: A transparent PNG overlaid on the first image, referenced by file ID, HTTPS URL, or base64 data URL. Must match that image's dimensions after orientation and contain transparent pixels. Supports GPT Image 2.5 and 2.6. Cannot be combined with mask. required: - images - prompt @@ -58555,6 +58555,27 @@ components: ] } } + RealtimeConnectDocumentationParams: + type: object + properties: + model: + type: string + call_id: + type: string + intent: + type: string + enum: + - realtime + - transcription + description: | + Selects the session type. Set `transcription` and omit `model` for a transcription session. If omitted, the session type from a client secret applies when present; otherwise the intent is `realtime`. + RealtimeConnectParams: + type: object + properties: + model: + type: string + call_id: + type: string RealtimeConversationItem: description: A single item within a Realtime conversation. anyOf: @@ -59537,914 +59558,1504 @@ components: using their id. items: $ref: '#/components/schemas/RealtimeConversationItem' - RealtimeServerEvent: - discriminator: - propertyName: type - description: | - A realtime server event. - anyOf: - - $ref: '#/components/schemas/RealtimeServerEventConversationCreated' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemCreated' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemDeleted' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionCompleted' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionDelta' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionFailed' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemRetrieved' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemTruncated' - - $ref: '#/components/schemas/RealtimeServerEventError' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCleared' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCommitted' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferDtmfEventReceived' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStarted' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStopped' - - $ref: '#/components/schemas/RealtimeServerEventRateLimitsUpdated' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartAdded' - - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseCreated' - - $ref: '#/components/schemas/RealtimeServerEventResponseDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemAdded' - - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseTextDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseTextDone' - - $ref: '#/components/schemas/RealtimeServerEventSessionCreated' - - $ref: '#/components/schemas/RealtimeServerEventSessionUpdated' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStarted' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStopped' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferCleared' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemAdded' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemDone' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferTimeoutTriggered' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment' - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsInProgress' - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsCompleted' - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsFailed' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallInProgress' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallCompleted' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallFailed' - RealtimeServerEventConversationCreated: + SubmitToolOutputsRunRequestWithoutStream: + 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. + required: + - tool_outputs + LiveFunctionToolChoiceParam: type: object - description: | - Returned when a conversation is created. Emitted right after session creation. properties: - event_id: - type: string - description: The unique ID of the server event. type: + default: function x-stainless-const: true - description: The event type, must be `conversation.created`. - const: conversation.created - conversation: - type: object - description: The conversation resource. - properties: - id: - type: string - description: The unique ID of the conversation. - object: - description: The object type, must be `realtime.conversation`. - const: realtime.conversation + type: string + enum: + - function + name: + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ required: - - event_id - type - - conversation - x-oaiMeta: - name: conversation.created - group: realtime - example: | - { - "event_id": "event_9101", - "type": "conversation.created", - "conversation": { - "id": "conv_001", - "object": "realtime.conversation" - } - } - RealtimeServerEventConversationItemAdded: - type: object - description: | - Sent by the server when an Item is added to the default Conversation. This can happen in several cases: - - When the client sends a `conversation.item.create` event. - - When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer. - - When the model is generating a Response. In this case the `conversation.item.added` event will be sent when the model starts generating a specific Item, and thus it will not yet have any content (and `status` will be `in_progress`). - - The event will include the full content of the Item (except when model is generating a Response) except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if necessary. + - name + CodeInterpreterContainerAuto: properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - auto + description: Always `auto`. + default: auto x-stainless-const: true - description: The event type, must be `conversation.item.added`. - const: conversation.item.added - previous_item_id: + file_ids: + items: + type: string + example: file-123 + type: array + maxItems: 50 + description: An optional list of uploaded files to make available to your code. + memory_limit: anyOf: - - type: string - description: | - The ID of the item that precedes this one, if any. This is used to - maintain ordering when items are inserted. + - $ref: '#/components/schemas/ContainerMemoryLimit' + description: The memory limit for the code interpreter container. - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' + network_policy: + discriminator: + propertyName: type + description: Network access policy for the container. + anyOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + type: object required: - - event_id - type - - item - x-oaiMeta: - name: conversation.item.added - group: realtime - example: | - { - "type": "conversation.item.added", - "event_id": "event_C9G8pjSJCfRNEhMEnYAVy", - "previous_item_id": null, - "item": { - "id": "item_C9G8pGVKYnaZu8PH5YQ9O", - "type": "message", - "status": "completed", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "hi" - } - ] - } - } - RealtimeServerEventConversationItemCreated: + title: CodeInterpreterToolAuto + description: Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on. + x-stainless-naming: + go: + type_name: ToolCodeInterpreterContainerCodeInterpreterContainerAuto + CreateRunRequestWithoutStream: type: object - description: | - Returned when a conversation item is created. There are several scenarios that produce this event: - - The server is generating a Response, which if successful will produce - either one or two Items, which will be of type `message` - (role `assistant`) or type `function_call`. - - The input audio buffer has been committed, either by the client or the - server (in `server_vad` mode). The server will take the content of the - input audio buffer and add it to a new user message Item. - - The client has sent a `conversation.item.create` event to add a new Item - to the Conversation. + additionalProperties: false properties: - event_id: + assistant_id: + description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run. type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `conversation.item.created`. - const: conversation.item.created - previous_item_id: + model: + description: The ID of the [Model](https://developers.openai.com/api/reference/resources/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. + example: gpt-4.1 anyOf: - type: string - description: | - The ID of the preceding item in the Conversation context, allows the - client to understand the order of the conversation. Can be `null` if the - item has no predecessor. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string + nullable: true + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + instructions: + description: Overrides the [instructions](https://developers.openai.com/api/docs/assistants/migration) of the assistant. This is useful for modifying the behavior on a per-run basis. + type: + - string + - 'null' + 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 + - 'null' + additional_messages: + description: Adds additional messages to the thread before creating the run. + type: + - array + - 'null' + items: + $ref: '#/components/schemas/CreateMessageRequest' + tools: + description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + type: + - array + - 'null' + maxItems: 20 + items: + $ref: '#/components/schemas/AssistantTool' + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + type: + - number + - 'null' + minimum: 0 + maximum: 2 + default: 1 + example: 1 + 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. + top_p: + type: + - number + - 'null' + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: | + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + max_prompt_tokens: + type: + - integer + - 'null' + 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 + - 'null' + 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: + allOf: + - $ref: '#/components/schemas/TruncationObject' + - nullable: true + tool_choice: + allOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + - nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' required: - - event_id - - type - - item - x-oaiMeta: - name: conversation.item.created - group: realtime - example: | - { - "event_id": "event_1920", - "type": "conversation.item.created", - "previous_item_id": "msg_002", - "item": { - "id": "msg_003", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "user", - "content": [] - } - } - RealtimeServerEventConversationItemDeleted: + - assistant_id + RealtimeClientEventResponseCreateWithReferencesParam: type: object - description: "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n" + description: "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history by default.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event includes inference configuration like \n`instructions` and `tools`. If these are set, they will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel. The `metadata` field is a good way to disambiguate\nmultiple simultaneous Responses.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n" properties: event_id: type: string - description: The unique ID of the server event. + maxLength: 512 + description: Optional client-generated ID used to identify this event. type: x-stainless-const: true - description: The event type, must be `conversation.item.deleted`. - const: conversation.item.deleted - item_id: - type: string - description: The ID of the item that was deleted. + description: The event type, must be `response.create`. + const: response.create + response: + $ref: '#/components/schemas/RealtimeResponseCreateParams' required: - - event_id - type - - item_id x-oaiMeta: - name: conversation.item.deleted + name: response.create group: realtime example: | + // Trigger a response with the default Conversation and no special parameters { - "event_id": "event_2728", - "type": "conversation.item.deleted", - "item_id": "msg_005" + "type": "response.create" } - RealtimeServerEventConversationItemDone: - type: object - description: | - Returned when a conversation item is finalized. - The event will include the full content of the Item except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if needed. - properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `conversation.item.done`. - const: conversation.item.done - previous_item_id: - anyOf: - - type: string - description: | - The ID of the item that precedes this one, if any. This is used to - maintain ordering when items are inserted. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' - required: - - event_id - - type - - item - x-oaiMeta: - name: conversation.item.done - group: realtime - example: | + // Trigger an out-of-band response that does not write to the default Conversation { - "type": "conversation.item.done", - "event_id": "event_CCXLgMZPo3qioWCeQa4WH", - "previous_item_id": "item_CCXLecNJVIVR2HUy3ABLj", - "item": { - "id": "item_CCXLfxmM5sXVJVz4mCa2S", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "metadata": { + "response_purpose": "summarization" + }, + "input": [ { - "type": "output_audio", - "transcript": "Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?" + "type": "item_reference", + "id": "item_12345" + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] } ] } } - RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: + RealtimeResponseCreateParamsWithReferencesParam: type: object - description: | - This event is the output of audio transcription for user audio written to the - user audio buffer. Transcription begins when the input audio buffer is - committed by the client or server (when VAD is enabled). Transcription runs - asynchronously with Response creation, so this event may come before or after - the Response events. - - Realtime API models accept audio natively, and thus input transcription is a - separate process run on a separate ASR (Automatic Speech Recognition) model. - The transcript may diverge somewhat from the model's interpretation, and - should be treated as a rough guide. + description: Create a new Realtime response with these parameters properties: - event_id: - type: string - description: The unique ID of the server event. - type: - type: string - enum: - - conversation.item.input_audio_transcription.completed - description: | - The event type, must be - `conversation.item.input_audio_transcription.completed`. - x-stainless-const: true - item_id: - type: string - description: The ID of the item containing the audio that is being transcribed. - content_index: - type: integer - description: The index of the content part containing the audio. - transcript: - type: string - description: The transcribed text. - languages: + output_modalities: type: array description: | - The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected. + The set of modalities the model used to respond, currently the only possible values are + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the + output to mode `text` will disable audio output from the model. items: - $ref: '#/components/schemas/TranscriptionLanguage' - logprobs: - anyOf: - - type: array - description: The log probabilities of the transcription. - items: - $ref: '#/components/schemas/LogProbProperties' - - type: 'null' - usage: + type: string + enum: + - text + - audio + instructions: + type: string + description: | + The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. + Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. + audio: type: object - description: Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing. - anyOf: - - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: TranscriptTextUsageTokens - - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: TranscriptTextUsageDuration - required: - - event_id - - type - - item_id - - content_index - - transcript - - usage - x-oaiMeta: - name: conversation.item.input_audio_transcription.completed - group: realtime - example: | - { - "type": "conversation.item.input_audio_transcription.completed", - "event_id": "event_CCXGRvtUVrax5SJAnNOWZ", - "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", - "content_index": 0, - "transcript": "Hey, can you hear me?", - "usage": { - "type": "tokens", - "total_tokens": 22, - "input_tokens": 13, - "input_token_details": { - "text_tokens": 0, - "audio_tokens": 13 - }, - "output_tokens": 9 - } - } - RealtimeServerEventConversationItemInputAudioTranscriptionDelta: + description: Configuration for audio input and output. + properties: + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + default: alloy + description: | + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during the session once the model has responded with audio at least once. + Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live. + We recommend `marin` and `cedar` for best quality. + tools: + type: array + description: Tools available to the model. + items: + anyOf: + - $ref: '#/components/schemas/RealtimeFunctionTool' + - $ref: '#/components/schemas/MCPTool' + tool_choice: + description: | + How the model chooses tools. Provide one of the string modes or force a specific + function/MCP tool. + default: auto + anyOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + parallel_tool_calls: + type: boolean + description: | + Whether the model may call multiple tools in parallel. Only supported by + reasoning Realtime models such as `gpt-realtime-2`. + reasoning: + $ref: '#/components/schemas/RealtimeReasoning' + max_output_tokens: + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + anyOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + conversation: + description: | + Controls which conversation the response is added to. Currently supports + `auto` and `none`, with `auto` as the default value. The `auto` value + means that the contents of the response will be added to the default + conversation. Set this to `none` to create an out-of-band response which + will not add items to default conversation. + anyOf: + - type: string + - type: string + default: auto + enum: + - auto + - none + metadata: + $ref: '#/components/schemas/Metadata' + prompt: + $ref: '#/components/schemas/Prompt' + input: + type: array + description: | + Input items to include in the prompt for the model. Using this field + creates a new context for this Response instead of using the default + conversation. An empty array `[]` will clear the context for this Response. + Note that this can include references to items that previously appeared in the session + using their id. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + LiveBuiltInVoice: + type: string + enum: + - alloy + - ash + - ballad + - beacon + - bossa + - cedar + - cinder + - coral + - delta + - echo + - gleam + - marin + - meridian + - quartz + - ripple + - sage + - shida + - shimmer + - stone + - tempo + - verse + - vesper + - willow + description: A built-in voice available for Live speech. + LiveMCPToolChoiceParam: type: object - description: | - Returned when the text value of an input audio transcription content part is updated with incremental transcription results. properties: - event_id: - type: string - description: The unique ID of the server event. type: + default: mcp x-stainless-const: true - description: The event type, must be `conversation.item.input_audio_transcription.delta`. - const: conversation.item.input_audio_transcription.delta - item_id: type: string - description: The ID of the item containing the audio that is being transcribed. - content_index: - type: integer - description: The index of the content part in the item's content array. - delta: + enum: + - mcp + server_label: type: string - description: The text delta. - logprobs: - anyOf: - - type: array - description: 'The log probabilities of the transcription. These can be enabled by configuring the session with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription.' - items: - $ref: '#/components/schemas/LogProbProperties' - - type: 'null' + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + name: + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ required: - - event_id - type - - item_id - x-oaiMeta: - name: conversation.item.input_audio_transcription.delta - group: realtime - example: | - { - "type": "conversation.item.input_audio_transcription.delta", - "event_id": "event_CCXGRxsAimPAs8kS2Wc7Z", - "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", - "content_index": 0, - "delta": "Hey", - "obfuscation": "aLxx0jTEciOGe" - } - RealtimeServerEventConversationItemInputAudioTranscriptionFailed: + - server_label + - name + CreateThreadAndRunRequestWithoutStream: type: object - description: "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n" + additionalProperties: false properties: - event_id: - type: string - description: The unique ID of the server event. - type: + assistant_id: + description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run. type: string - enum: - - conversation.item.input_audio_transcription.failed + thread: + $ref: '#/components/schemas/CreateThreadRequest' + model: + description: The ID of the [Model](https://developers.openai.com/api/reference/resources/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. + example: gpt-4.1 + anyOf: + - type: string + - type: string + enum: + - gpt-5 + - gpt-5-mini + - gpt-5-nano + - gpt-5-2025-08-07 + - gpt-5-mini-2025-08-07 + - gpt-5-nano-2025-08-07 + - gpt-4.1 + - gpt-4.1-mini + - gpt-4.1-nano + - gpt-4.1-2025-04-14 + - gpt-4.1-mini-2025-04-14 + - gpt-4.1-nano-2025-04-14 + - gpt-4o + - gpt-4o-2024-11-20 + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4.5-preview + - gpt-4.5-preview-2025-02-27 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-vision-preview + - gpt-4 + - gpt-4-0314 + - gpt-4-0613 + - gpt-4-32k + - gpt-4-32k-0314 + - gpt-4-32k-0613 + - gpt-3.5-turbo + - gpt-3.5-turbo-16k + - gpt-3.5-turbo-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + x-openai-enum-deprecations: + gpt-5: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-mini: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-nano: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-2025-08-07: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-mini-2025-08-07: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-nano-2025-08-07: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + x-oaiTypeLabel: 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 + - 'null' + tools: + description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + type: + - array + - 'null' + maxItems: 20 + items: + $ref: '#/components/schemas/AssistantTool' + tool_resources: + type: + - object + - 'null' description: | - The event type, must be - `conversation.item.input_audio_transcription.failed`. - x-stainless-const: true - item_id: - type: string - description: The ID of the user message item. - content_index: - type: integer - description: The index of the content part containing the audio. - error: - type: object - description: Details of the transcription error. + 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: - type: - type: string - description: The type of error. - code: - type: string - description: Error code, if any. - message: - type: string - description: A human-readable error message. - param: - type: string - description: Parameter related to the error, if any. + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](https://developers.openai.com/api/reference/resources/files) 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](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + type: + - number + - 'null' + minimum: 0 + maximum: 2 + default: 1 + example: 1 + 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. + top_p: + type: + - number + - 'null' + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: | + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + max_prompt_tokens: + type: + - integer + - 'null' + 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 + - 'null' + 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: + allOf: + - $ref: '#/components/schemas/TruncationObject' + - nullable: true + tool_choice: + allOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + - nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' required: - - event_id - - type - - item_id - - content_index - - error - x-oaiMeta: - name: conversation.item.input_audio_transcription.failed - group: realtime - example: | - { - "event_id": "event_2324", - "type": "conversation.item.input_audio_transcription.failed", - "item_id": "msg_003", - "content_index": 0, - "error": { - "type": "transcription_error", - "code": "audio_unintelligible", - "message": "The audio could not be transcribed.", - "param": null - } - } - RealtimeServerEventConversationItemInputAudioTranscriptionSegment: - type: object - description: Returned when an input audio transcription segment is identified for an item. + - assistant_id + Summary: properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `conversation.item.input_audio_transcription.segment`. - const: conversation.item.input_audio_transcription.segment - item_id: type: string - description: The ID of the item containing the input audio content. - content_index: - type: integer - description: The index of the input audio content part within the item. + enum: + - summary_text + description: The type of the object. Always `summary_text`. + default: summary_text + x-stainless-const: true text: type: string - description: The text for this segment. - id: - type: string - description: The segment identifier. - speaker: - type: string - description: The detected speaker label for this segment. - start: - type: number - format: double - description: Start time of the segment in seconds. - end: - type: number - format: double - description: End time of the segment in seconds. + description: A summary of the reasoning output from the model so far. + type: object required: - - event_id - type - - item_id - - content_index - text - - id - - speaker - - start - - end - x-oaiMeta: - name: conversation.item.input_audio_transcription.segment - group: realtime - example: | - { - "event_id": "event_6501", - "type": "conversation.item.input_audio_transcription.segment", - "item_id": "msg_011", - "content_index": 0, - "text": "hello", - "id": "seg_0001", - "speaker": "spk_1", - "start": 0.0, - "end": 0.4 - } - RealtimeServerEventConversationItemRetrieved: + title: Summary text + description: A summary text from the model. + RunStatus: + description: The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. + type: string + enum: + - queued + - in_progress + - requires_action + - cancelling + - cancelled + - failed + - completed + - incomplete + - expired + RealtimeResponseItemReference: type: object description: | - Returned when a conversation item is retrieved with `conversation.item.retrieve`. This is provided as a way to fetch the server's representation of an item, for example to get access to the post-processed audio data after noise cancellation and VAD. It includes the full content of the Item, including audio data. + Reference an existing item in this Realtime session as response.create input. + Item references are only accepted in the response input array, not as new + conversation items. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - item_reference x-stainless-const: true - description: The event type, must be `conversation.item.retrieved`. - const: conversation.item.retrieved - item: - $ref: '#/components/schemas/RealtimeConversationItem' + description: The type of this item. Always `item_reference`. + id: + type: string + minLength: 1 + maxLength: 32 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of an existing item in the same Realtime session. required: - - event_id - type - - item - x-oaiMeta: - name: conversation.item.retrieved - group: realtime - example: | - { - "type": "conversation.item.retrieved", - "event_id": "event_CCXGSizgEppa2d4XbKA7K", - "item": { - "id": "item_CCXGRxbY0n6WE4EszhF5w", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "output_audio", - "transcript": "Yes, I can hear you loud and clear. How can I help you today?", - "audio": "AAABAP//AAA=" - } - ] - } - } - RealtimeServerEventConversationItemTruncated: - type: object - description: "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n" - properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `conversation.item.truncated`. - const: conversation.item.truncated - item_id: - type: string - description: The ID of the assistant message item that was truncated. - content_index: - type: integer - description: The index of the content part that was truncated. - audio_end_ms: - type: integer - description: | - The duration up to which the audio was truncated, in milliseconds. - required: - - event_id - - type - - item_id - - content_index - - audio_end_ms - x-oaiMeta: - name: conversation.item.truncated - group: realtime - example: | - { - "event_id": "event_2526", - "type": "conversation.item.truncated", - "item_id": "msg_004", - "content_index": 0, - "audio_end_ms": 1500 - } - RealtimeServerEventError: + - id + RealtimeServerEvent: + discriminator: + propertyName: type + description: | + A realtime server event. + anyOf: + - $ref: '#/components/schemas/RealtimeServerEventConversationCreated' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemCreated' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemDeleted' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionCompleted' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionDelta' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionFailed' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemRetrieved' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemTruncated' + - $ref: '#/components/schemas/RealtimeServerEventError' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCleared' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCommitted' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferDtmfEventReceived' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStarted' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStopped' + - $ref: '#/components/schemas/RealtimeServerEventRateLimitsUpdated' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartAdded' + - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseCreated' + - $ref: '#/components/schemas/RealtimeServerEventResponseDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemAdded' + - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseTextDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseTextDone' + - $ref: '#/components/schemas/RealtimeServerEventSessionCreated' + - $ref: '#/components/schemas/RealtimeServerEventSessionUpdated' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStarted' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStopped' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferCleared' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemAdded' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemDone' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferTimeoutTriggered' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsInProgress' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsCompleted' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsFailed' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallInProgress' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallCompleted' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallFailed' + RealtimeServerEventConversationCreated: type: object description: | - Returned when an error occurs, which could be a client problem or a server - problem. Most errors are recoverable and the session will stay open, we - recommend to implementers to monitor and log error messages by default. + Returned when a conversation is created. Emitted right after session creation. properties: event_id: type: string description: The unique ID of the server event. type: x-stainless-const: true - description: The event type, must be `error`. - const: error - error: + description: The event type, must be `conversation.created`. + const: conversation.created + conversation: type: object - description: Details of the error. - required: - - type - - message + description: The conversation resource. properties: - type: - type: string - description: | - The type of error (e.g., "invalid_request_error", "server_error"). - code: - anyOf: - - type: string - description: Error code, if any. - - type: 'null' - message: + id: type: string - description: A human-readable error message. - param: - anyOf: - - type: string - description: Parameter related to the error, if any. - - type: 'null' - event_id: - anyOf: - - type: string - description: | - The event_id of the client event that caused the error, if applicable. - - type: 'null' + description: The unique ID of the conversation. + object: + description: The object type, must be `realtime.conversation`. + const: realtime.conversation required: - event_id - type - - error + - conversation x-oaiMeta: - name: error + name: conversation.created group: realtime example: | { - "event_id": "event_890", - "type": "error", - "error": { - "type": "invalid_request_error", - "code": "invalid_event", - "message": "The 'type' field is missing.", - "param": null, - "event_id": "event_567" + "event_id": "event_9101", + "type": "conversation.created", + "conversation": { + "id": "conv_001", + "object": "realtime.conversation" } } - RealtimeServerEventInputAudioBufferCleared: + RealtimeServerEventConversationItemAdded: type: object - description: "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n" + description: | + Sent by the server when an Item is added to the default Conversation. This can happen in several cases: + - When the client sends a `conversation.item.create` event. + - When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer. + - When the model is generating a Response. In this case the `conversation.item.added` event will be sent when the model starts generating a specific Item, and thus it will not yet have any content (and `status` will be `in_progress`). + + The event will include the full content of the Item (except when model is generating a Response) except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if necessary. properties: event_id: type: string description: The unique ID of the server event. type: x-stainless-const: true - description: The event type, must be `input_audio_buffer.cleared`. - const: input_audio_buffer.cleared + description: The event type, must be `conversation.item.added`. + const: conversation.item.added + previous_item_id: + anyOf: + - type: string + description: | + The ID of the item that precedes this one, if any. This is used to + maintain ordering when items are inserted. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - event_id - type + - item x-oaiMeta: - name: input_audio_buffer.cleared + name: conversation.item.added group: realtime example: | { - "event_id": "event_1314", - "type": "input_audio_buffer.cleared" + "type": "conversation.item.added", + "event_id": "event_C9G8pjSJCfRNEhMEnYAVy", + "previous_item_id": null, + "item": { + "id": "item_C9G8pGVKYnaZu8PH5YQ9O", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + } } - RealtimeServerEventInputAudioBufferCommitted: + RealtimeServerEventConversationItemCreated: type: object description: | - Returned when an input audio buffer is committed, either by the client or - automatically in server VAD mode. The `item_id` property is the ID of the user - message item that will be created, thus a `conversation.item.created` event - will also be sent to the client. + Returned when a conversation item is created. There are several scenarios that produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. properties: event_id: type: string description: The unique ID of the server event. type: x-stainless-const: true - description: The event type, must be `input_audio_buffer.committed`. - const: input_audio_buffer.committed + description: The event type, must be `conversation.item.created`. + const: conversation.item.created previous_item_id: anyOf: - type: string description: | - The ID of the preceding item after which the new item will be inserted. - Can be `null` if the item has no predecessor. + The ID of the preceding item in the Conversation context, allows the + client to understand the order of the conversation. Can be `null` if the + item has no predecessor. - type: 'null' - item_id: - type: string - description: The ID of the user message item that will be created. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - event_id - type - - item_id - x-oaiMeta: - name: input_audio_buffer.committed - group: realtime - example: | - { - "event_id": "event_1121", - "type": "input_audio_buffer.committed", - "previous_item_id": "msg_001", - "item_id": "msg_002" - } - RealtimeServerEventInputAudioBufferDtmfEventReceived: - type: object - description: | - **SIP Only:** Returned when an DTMF event is received. A DTMF event is a message that - represents a telephone keypad press (0–9, *, #, A–D). The `event` property - is the keypad that the user press. The `received_at` is the UTC Unix Timestamp - that the server received the event. - properties: - type: - x-stainless-const: true - description: The event type, must be `input_audio_buffer.dtmf_event_received`. - const: input_audio_buffer.dtmf_event_received - event: - type: string - description: The telephone keypad that was pressed by the user. - received_at: - type: integer - description: | - UTC Unix Timestamp when DTMF Event was received by server. - required: - - type - - event - - received_at + - item x-oaiMeta: - name: input_audio_buffer.dtmf_event_received + name: conversation.item.created group: realtime example: | { - "type": "input_audio_buffer.dtmf_event_received", - "event": "9", - "received_at": 1763605109 + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [] + } } - RealtimeServerEventInputAudioBufferSpeechStarted: + RealtimeServerEventConversationItemDeleted: type: object - description: "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n" + description: "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n" properties: event_id: type: string description: The unique ID of the server event. type: x-stainless-const: true - description: The event type, must be `input_audio_buffer.speech_started`. - const: input_audio_buffer.speech_started - audio_start_ms: - type: integer - description: "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n" + description: The event type, must be `conversation.item.deleted`. + const: conversation.item.deleted item_id: type: string - description: | - The ID of the user message item that will be created when speech stops. + description: The ID of the item that was deleted. required: - event_id - type - - audio_start_ms - item_id x-oaiMeta: - name: input_audio_buffer.speech_started + name: conversation.item.deleted group: realtime example: | { - "event_id": "event_1516", - "type": "input_audio_buffer.speech_started", - "audio_start_ms": 1000, - "item_id": "msg_003" + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" } - RealtimeServerEventInputAudioBufferSpeechStopped: + RealtimeServerEventConversationItemDone: type: object - description: "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n" + description: | + Returned when a conversation item is finalized. + + The event will include the full content of the Item except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if needed. properties: event_id: type: string description: The unique ID of the server event. type: x-stainless-const: true - description: The event type, must be `input_audio_buffer.speech_stopped`. - const: input_audio_buffer.speech_stopped - audio_end_ms: - type: integer - description: "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n" - item_id: - type: string - description: The ID of the user message item that will be created. + description: The event type, must be `conversation.item.done`. + const: conversation.item.done + previous_item_id: + anyOf: + - type: string + description: | + The ID of the item that precedes this one, if any. This is used to + maintain ordering when items are inserted. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - event_id - type - - audio_end_ms - - item_id + - item x-oaiMeta: - name: input_audio_buffer.speech_stopped + name: conversation.item.done group: realtime example: | { - "event_id": "event_1718", - "type": "input_audio_buffer.speech_stopped", - "audio_end_ms": 2000, - "item_id": "msg_003" + "type": "conversation.item.done", + "event_id": "event_CCXLgMZPo3qioWCeQa4WH", + "previous_item_id": "item_CCXLecNJVIVR2HUy3ABLj", + "item": { + "id": "item_CCXLfxmM5sXVJVz4mCa2S", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?" + } + ] + } } - RealtimeServerEventInputAudioBufferTimeoutTriggered: + RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: type: object description: | - Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured - with `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that - there hasn't been any speech detected for the configured duration. - - The `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last - model response up to the triggering time, as an offset from the beginning of audio written - to the input audio buffer. This means it demarcates the segment of audio that was silent and - the difference between the start and end values will roughly match the configured timeout. + This event is the output of audio transcription for user audio written to the + user audio buffer. Transcription begins when the input audio buffer is + committed by the client or server (when VAD is enabled). Transcription runs + asynchronously with Response creation, so this event may come before or after + the Response events. - The empty audio will be committed to the conversation as an `input_audio` item (there will be a - `input_audio_buffer.committed` event) and a model response will be generated. There may be speech - that didn't trigger VAD but is still detected by the model, so the model may respond with - something relevant to the conversation or a prompt to continue speaking. + Realtime API models accept audio natively, and thus input transcription is a + separate process run on a separate ASR (Automatic Speech Recognition) model. + The transcript may diverge somewhat from the model's interpretation, and + should be treated as a rough guide. properties: event_id: type: string description: The unique ID of the server event. type: + type: string + enum: + - conversation.item.input_audio_transcription.completed + description: | + The event type, must be + `conversation.item.input_audio_transcription.completed`. x-stainless-const: true - description: The event type, must be `input_audio_buffer.timeout_triggered`. - const: input_audio_buffer.timeout_triggered - audio_start_ms: - type: integer - description: Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response. - audio_end_ms: - type: integer - description: Millisecond offset of audio written to the input audio buffer at the time the timeout was triggered. item_id: type: string - description: The ID of the item associated with this segment. + description: The ID of the item containing the audio that is being transcribed. + content_index: + type: integer + description: The index of the content part containing the audio. + transcript: + type: string + description: The transcribed text. + languages: + type: array + description: | + The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected. + items: + $ref: '#/components/schemas/TranscriptionLanguage' + logprobs: + anyOf: + - type: array + description: The log probabilities of the transcription. + items: + $ref: '#/components/schemas/LogProbProperties' + - type: 'null' + usage: + type: object + description: Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing. + anyOf: + - $ref: '#/components/schemas/TranscriptTextUsageTokens' + title: TranscriptTextUsageTokens + - $ref: '#/components/schemas/TranscriptTextUsageDuration' + title: TranscriptTextUsageDuration required: - event_id - type - - audio_start_ms - - audio_end_ms - item_id + - content_index + - transcript + - usage x-oaiMeta: - name: input_audio_buffer.timeout_triggered + name: conversation.item.input_audio_transcription.completed group: realtime example: | { - "type":"input_audio_buffer.timeout_triggered", - "event_id":"event_CEKKrf1KTGvemCPyiJTJ2", - "audio_start_ms":13216, - "audio_end_ms":19232, - "item_id":"item_CEKKrWH0GiwN0ET97NUZc" + "type": "conversation.item.input_audio_transcription.completed", + "event_id": "event_CCXGRvtUVrax5SJAnNOWZ", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "transcript": "Hey, can you hear me?", + "usage": { + "type": "tokens", + "total_tokens": 22, + "input_tokens": 13, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 13 + }, + "output_tokens": 9 + } } - RealtimeServerEventMCPListToolsCompleted: + RealtimeServerEventConversationItemInputAudioTranscriptionDelta: type: object - description: Returned when listing MCP tools has completed for an item. + description: | + Returned when the text value of an input audio transcription content part is updated with incremental transcription results. properties: event_id: type: string description: The unique ID of the server event. type: x-stainless-const: true - description: The event type, must be `mcp_list_tools.completed`. - const: mcp_list_tools.completed + description: The event type, must be `conversation.item.input_audio_transcription.delta`. + const: conversation.item.input_audio_transcription.delta item_id: type: string - description: The ID of the MCP list tools item. + description: The ID of the item containing the audio that is being transcribed. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The text delta. + logprobs: + anyOf: + - type: array + description: 'The log probabilities of the transcription. These can be enabled by configuring the session with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription.' + items: + $ref: '#/components/schemas/LogProbProperties' + - type: 'null' required: - event_id - type - item_id x-oaiMeta: - name: mcp_list_tools.completed + name: conversation.item.input_audio_transcription.delta group: realtime example: | { - "event_id": "event_6102", - "type": "mcp_list_tools.completed", - "item_id": "mcp_list_tools_001" + "type": "conversation.item.input_audio_transcription.delta", + "event_id": "event_CCXGRxsAimPAs8kS2Wc7Z", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "delta": "Hey", + "obfuscation": "aLxx0jTEciOGe" } - RealtimeServerEventMCPListToolsFailed: + RealtimeServerEventConversationItemInputAudioTranscriptionFailed: type: object - description: Returned when listing MCP tools has failed for an item. + description: "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n" properties: event_id: type: string description: The unique ID of the server event. type: + type: string + enum: + - conversation.item.input_audio_transcription.failed + description: | + The event type, must be + `conversation.item.input_audio_transcription.failed`. x-stainless-const: true - description: The event type, must be `mcp_list_tools.failed`. - const: mcp_list_tools.failed item_id: type: string - description: The ID of the MCP list tools item. + description: The ID of the user message item. + content_index: + type: integer + description: The index of the content part containing the audio. + error: + type: object + description: Details of the transcription error. + properties: + type: + type: string + description: The type of error. + code: + type: string + description: Error code, if any. + message: + type: string + description: A human-readable error message. + param: + type: string + description: Parameter related to the error, if any. required: - event_id - type - item_id + - content_index + - error x-oaiMeta: - name: mcp_list_tools.failed + name: conversation.item.input_audio_transcription.failed + group: realtime + example: | + { + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } + } + RealtimeServerEventConversationItemInputAudioTranscriptionSegment: + type: object + description: Returned when an input audio transcription segment is identified for an item. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `conversation.item.input_audio_transcription.segment`. + const: conversation.item.input_audio_transcription.segment + item_id: + type: string + description: The ID of the item containing the input audio content. + content_index: + type: integer + description: The index of the input audio content part within the item. + text: + type: string + description: The text for this segment. + id: + type: string + description: The segment identifier. + speaker: + type: string + description: The detected speaker label for this segment. + start: + type: number + format: double + description: Start time of the segment in seconds. + end: + type: number + format: double + description: End time of the segment in seconds. + required: + - event_id + - type + - item_id + - content_index + - text + - id + - speaker + - start + - end + x-oaiMeta: + name: conversation.item.input_audio_transcription.segment + group: realtime + example: | + { + "event_id": "event_6501", + "type": "conversation.item.input_audio_transcription.segment", + "item_id": "msg_011", + "content_index": 0, + "text": "hello", + "id": "seg_0001", + "speaker": "spk_1", + "start": 0.0, + "end": 0.4 + } + RealtimeServerEventConversationItemRetrieved: + type: object + description: | + Returned when a conversation item is retrieved with `conversation.item.retrieve`. This is provided as a way to fetch the server's representation of an item, for example to get access to the post-processed audio data after noise cancellation and VAD. It includes the full content of the Item, including audio data. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `conversation.item.retrieved`. + const: conversation.item.retrieved + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.retrieved + group: realtime + example: | + { + "type": "conversation.item.retrieved", + "event_id": "event_CCXGSizgEppa2d4XbKA7K", + "item": { + "id": "item_CCXGRxbY0n6WE4EszhF5w", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Yes, I can hear you loud and clear. How can I help you today?", + "audio": "AAABAP//AAA=" + } + ] + } + } + RealtimeServerEventConversationItemTruncated: + type: object + description: "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n" + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `conversation.item.truncated`. + const: conversation.item.truncated + item_id: + type: string + description: The ID of the assistant message item that was truncated. + content_index: + type: integer + description: The index of the content part that was truncated. + audio_end_ms: + type: integer + description: | + The duration up to which the audio was truncated, in milliseconds. + required: + - event_id + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncated + group: realtime + example: | + { + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeServerEventError: + type: object + description: | + Returned when an error occurs, which could be a client problem or a server + problem. Most errors are recoverable and the session will stay open, we + recommend to implementers to monitor and log error messages by default. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `error`. + const: error + error: + type: object + description: Details of the error. + required: + - type + - message + properties: + type: + type: string + description: | + The type of error (e.g., "invalid_request_error", "server_error"). + code: + anyOf: + - type: string + description: Error code, if any. + - type: 'null' + message: + type: string + description: A human-readable error message. + param: + anyOf: + - type: string + description: Parameter related to the error, if any. + - type: 'null' + event_id: + anyOf: + - type: string + description: | + The event_id of the client event that caused the error, if applicable. + - type: 'null' + required: + - event_id + - type + - error + x-oaiMeta: + name: error + group: realtime + example: | + { + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } + } + RealtimeServerEventInputAudioBufferCleared: + type: object + description: "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n" + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.cleared`. + const: input_audio_buffer.cleared + required: + - event_id + - type + x-oaiMeta: + name: input_audio_buffer.cleared + group: realtime + example: | + { + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" + } + RealtimeServerEventInputAudioBufferCommitted: + type: object + description: | + Returned when an input audio buffer is committed, either by the client or + automatically in server VAD mode. The `item_id` property is the ID of the user + message item that will be created, thus a `conversation.item.created` event + will also be sent to the client. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.committed`. + const: input_audio_buffer.committed + previous_item_id: + anyOf: + - type: string + description: | + The ID of the preceding item after which the new item will be inserted. + Can be `null` if the item has no predecessor. + - type: 'null' + item_id: + type: string + description: The ID of the user message item that will be created. + required: + - event_id + - type + - item_id + x-oaiMeta: + name: input_audio_buffer.committed + group: realtime + example: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeServerEventInputAudioBufferDtmfEventReceived: + type: object + description: | + **SIP Only:** Returned when an DTMF event is received. A DTMF event is a message that + represents a telephone keypad press (0–9, *, #, A–D). The `event` property + is the keypad that the user press. The `received_at` is the UTC Unix Timestamp + that the server received the event. + properties: + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.dtmf_event_received`. + const: input_audio_buffer.dtmf_event_received + event: + type: string + description: The telephone keypad that was pressed by the user. + received_at: + type: integer + description: | + UTC Unix Timestamp when DTMF Event was received by server. + required: + - type + - event + - received_at + x-oaiMeta: + name: input_audio_buffer.dtmf_event_received + group: realtime + example: | + { + "type": "input_audio_buffer.dtmf_event_received", + "event": "9", + "received_at": 1763605109 + } + RealtimeServerEventInputAudioBufferSpeechStarted: + type: object + description: "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n" + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.speech_started`. + const: input_audio_buffer.speech_started + audio_start_ms: + type: integer + description: "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n" + item_id: + type: string + description: | + The ID of the user message item that will be created when speech stops. + required: + - event_id + - type + - audio_start_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_started + group: realtime + example: | + { + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" + } + RealtimeServerEventInputAudioBufferSpeechStopped: + type: object + description: "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n" + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.speech_stopped`. + const: input_audio_buffer.speech_stopped + audio_end_ms: + type: integer + description: "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n" + item_id: + type: string + description: The ID of the user message item that will be created. + required: + - event_id + - type + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_stopped + group: realtime + example: | + { + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" + } + RealtimeServerEventInputAudioBufferTimeoutTriggered: + type: object + description: | + Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured + with `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that + there hasn't been any speech detected for the configured duration. + + The `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last + model response up to the triggering time, as an offset from the beginning of audio written + to the input audio buffer. This means it demarcates the segment of audio that was silent and + the difference between the start and end values will roughly match the configured timeout. + + The empty audio will be committed to the conversation as an `input_audio` item (there will be a + `input_audio_buffer.committed` event) and a model response will be generated. There may be speech + that didn't trigger VAD but is still detected by the model, so the model may respond with + something relevant to the conversation or a prompt to continue speaking. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.timeout_triggered`. + const: input_audio_buffer.timeout_triggered + audio_start_ms: + type: integer + description: Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response. + audio_end_ms: + type: integer + description: Millisecond offset of audio written to the input audio buffer at the time the timeout was triggered. + item_id: + type: string + description: The ID of the item associated with this segment. + required: + - event_id + - type + - audio_start_ms + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.timeout_triggered + group: realtime + example: | + { + "type":"input_audio_buffer.timeout_triggered", + "event_id":"event_CEKKrf1KTGvemCPyiJTJ2", + "audio_start_ms":13216, + "audio_end_ms":19232, + "item_id":"item_CEKKrWH0GiwN0ET97NUZc" + } + RealtimeServerEventMCPListToolsCompleted: + type: object + description: Returned when listing MCP tools has completed for an item. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `mcp_list_tools.completed`. + const: mcp_list_tools.completed + item_id: + type: string + description: The ID of the MCP list tools item. + required: + - event_id + - type + - item_id + x-oaiMeta: + name: mcp_list_tools.completed + group: realtime + example: | + { + "event_id": "event_6102", + "type": "mcp_list_tools.completed", + "item_id": "mcp_list_tools_001" + } + RealtimeServerEventMCPListToolsFailed: + type: object + description: Returned when listing MCP tools has failed for an item. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `mcp_list_tools.failed`. + const: mcp_list_tools.failed + item_id: + type: string + description: The ID of the MCP list tools item. + required: + - event_id + - type + - item_id + x-oaiMeta: + name: mcp_list_tools.failed group: realtime example: | { @@ -63440,6 +64051,13 @@ components: } } } + RealtimeTranslationConnectParams: + type: object + properties: + model: + type: string + required: + - model RealtimeTranslationServerEvent: discriminator: propertyName: type @@ -64797,8 +65415,8 @@ components: ResponseConfigurationUpdate: type: object description: | - A configuration update that applies to subsequent responses until it is - replaced by another configuration update. + A configuration update for subsequent responses. Each setting stays in effect + until a later update replaces that setting. properties: id: type: string @@ -64820,15 +65438,27 @@ components: description: | The reasoning effort used for subsequent responses until another configuration update replaces it. + text: + type: object + description: The text output configuration for subsequent responses. + properties: + format: + description: Use a JSON schema for structured output or text to return to plain text. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/TextResponseFormatJsonSchema' + required: + - format required: - id - type ResponseConfigurationUpdateItemParam: type: object description: | - An update to the conversation's response configuration. The configuration - remains in effect for subsequent responses until it is replaced by another - configuration update. + An update to the conversation's response configuration. Supply reasoning, + text, or both. Each setting stays in effect until a later update replaces it. properties: id: anyOf: @@ -64852,6 +65482,19 @@ components: description: | The reasoning effort to use for subsequent responses until another configuration update replaces it. + text: + type: object + description: The text output configuration for subsequent responses. + properties: + format: + description: Use a JSON schema for structured output or text to return to plain text. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/TextResponseFormatJsonSchema' + required: + - format required: - type ResponseContentPartAddedEvent: @@ -70438,13 +71081,13 @@ components: Setting to `{ "type": "json_object" }` enables the older JSON mode, which ensures the message the model generates is valid JSON. Using `json_schema` is preferred for models that support it. + discriminator: + propertyName: type anyOf: - $ref: '#/components/schemas/ResponseFormatText' - $ref: '#/components/schemas/TextResponseFormatJsonSchema' x-openai-ruby-json-schema-input: true - $ref: '#/components/schemas/ResponseFormatJsonObject' - discriminator: - propertyName: type TextResponseFormatJsonSchema: x-openai-structured-output: json_schema_default_strict type: object @@ -78615,6 +79258,10 @@ components: - object - metadata - created_at + markup: + type: string + format: binary + description: A transparent PNG overlaid on the first image to guide the edit. Must match that image's dimensions after orientation and contain transparent pixels. Supports GPT Image 2.5 and 2.6. Cannot be combined with mask. ImageGenOutputTokensDetails: properties: image_tokens: @@ -79457,6 +80104,72 @@ components: required: - type - responses + LiveDecisionInputTextParam: + type: object + properties: + type: + default: input_text + x-stainless-const: true + type: string + enum: + - input_text + text: + description: The text input to the model. + type: string + maxLength: 10485760 + required: + - type + - text + LiveDetailEnum: + type: string + enum: + - low + - high + - auto + - original + LiveDecisionInputImageParam: + type: object + properties: + type: + default: input_image + x-stainless-const: true + type: string + enum: + - input_image + image_url: + description: A base64-encoded image data URL or a publicly accessible HTTP(S) image URL. + type: string + maxLength: 20971520 + pattern: ^(data:|https?://) + detail: + anyOf: + - description: The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. + $ref: '#/components/schemas/LiveDetailEnum' + - type: 'null' + required: + - type + - image_url + LiveDecisionJsonObject: + type: object + additionalProperties: true + LiveDecisionInputJsonParam: + type: object + properties: + type: + default: input_json + x-stainless-const: true + type: string + enum: + - input_json + data: + anyOf: + - $ref: '#/components/schemas/LiveDecisionJsonObject' + - type: array + items: + $ref: '#/components/schemas/LiveDecisionJsonObject' + required: + - type + - data LiveDecisionChoiceParam: type: object properties: @@ -80247,6 +80960,67 @@ components: type: object required: - cyber + CachedUsageDetails: + properties: + cached_text_tokens: + type: integer + cached_image_tokens: + type: integer + type: object + required: + - cached_text_tokens + - cached_image_tokens + ImageGenToolUsage: + properties: + input_tokens: + type: integer + description: The number of tokens (images and text) in the input prompt. + total_tokens: + type: integer + description: The total number of tokens (images and text) used for the image generation. + output_tokens: + type: integer + description: The number of output tokens generated by the model. + output_tokens_details: + $ref: '#/components/schemas/ImageGenOutputTokensDetails' + input_tokens_details: + $ref: '#/components/schemas/ImageGenInputUsageDetails' + cached_tokens: + type: integer + cached_tokens_details: + $ref: '#/components/schemas/CachedUsageDetails' + type: object + required: + - input_tokens + - total_tokens + - output_tokens + - input_tokens_details + title: Image generation tool usage + description: Token usage for image generation tool calls in a response. + WebSearchUsage: + properties: + num_requests: + type: integer + description: The number of billable web search requests issued. + type: object + required: + - num_requests + title: Web search usage + description: Usage details for web search requests that ran while generating the response. + ResponseToolUsage: + properties: + image_gen: + $ref: '#/components/schemas/ImageGenToolUsage' + description: Aggregated usage statistics for image generation tool calls. + web_search: + $ref: '#/components/schemas/WebSearchUsage' + description: Aggregated billable usage statistics for web search tool calls. + type: object + required: + - image_gen + - web_search + title: Response tool usage + description: Aggregated usage details for billable tools that ran while generating the response. PromptCacheOptions: properties: ttl: @@ -80737,6 +81511,242 @@ components: - request_paused - error_type - reason + OrderEnum: + type: string + enum: + - asc + - desc + ExternalKeyPurpose: + type: string + enum: + - ekm + - psp_decryption + ExternalKeyResource: + properties: + object: + type: string + id: + type: string + type: + type: string + purpose: + $ref: '#/components/schemas/ExternalKeyPurpose' + name: + type: string + api_project_ids: + items: + type: string + type: array + workspace_id: + type: string + created_at: + type: integer + role_arn: + type: string + external_id: + type: string + kms_arn: + type: string + workload_identity_project_number: + type: string + workload_identity_pool_id: + type: string + workload_identity_provider_id: + type: string + audience: + type: string + kms_project_id: + type: string + kms_key_ring_name: + type: string + kms_key_name: + type: string + kms_key_location: + type: string + kms_key_version: + type: string + tenant_id: + type: string + vault_uri: + type: string + key_name: + type: string + key_version: + type: string + type: object + required: + - object + - id + - type + - name + - api_project_ids + - workspace_id + - created_at + ListExternalKeysResource: + properties: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + data: + items: + $ref: '#/components/schemas/ExternalKeyResource' + type: array + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean + type: object + required: + - object + - data + - first_id + - last_id + - has_more + AwsExternalKeyParams: + properties: + name: + type: string + description: A friendly name to identify this config + type: + type: string + enum: + - aws + default: aws + x-stainless-const: true + role_arn: + type: string + pattern: ^arn:aws:iam::\d{12}:role/.+$ + description: The Role ARN that OpenAI will assume to call your KMS + example: arn:aws:iam::123456789012:role/example-role + kms_arn: + type: string + description: The Key Management System ARN for the master key you manage + external_id: + type: string + description: The ExternalID that OpenAI will pass in the AssumeRole call for the customer's AWS account. This must be the OpenAI organization ID or an API project ID that belongs to the organization. + purpose: + $ref: '#/components/schemas/ExternalKeyPurpose' + type: object + required: + - name + - type + - role_arn + - kms_arn + - external_id + GcpExternalKeyParams: + properties: + name: + type: string + description: A friendly name to identify this config + type: + type: string + enum: + - gcp + default: gcp + x-stainless-const: true + workload_identity_project_number: + type: string + pattern: ^[0-9]{1,19}$ + description: The numeric GCP project number where you registered OpenAI's workload identity + workload_identity_pool_id: + type: string + description: The pool containing the Workload Identity provider that you registered for OpenAI + workload_identity_provider_id: + type: string + description: The Workload Identity provider that you registered for OpenAI + kms_project_id: + type: string + description: The string GCP project name where your KMS resides + kms_key_ring_name: + type: string + description: The Key Management System key ring for the master key you manage + kms_key_name: + type: string + description: The name of the Key Management System master key you manage + kms_key_location: + type: string + description: The region where your Key Management System master key is located + audience: + type: string + description: The aud field in the identity token OpenAI will pass in the call to the customer's GCP STS. This must be the OpenAI organization ID or an API project ID that belongs to the organization. + purpose: + $ref: '#/components/schemas/ExternalKeyPurpose' + kms_key_version: + type: string + pattern: ^[1-9][0-9]*$ + description: An exact CryptoKeyVersion number. Required for PSP decryption; not accepted for EKM. + type: object + required: + - name + - type + - workload_identity_project_number + - workload_identity_pool_id + - workload_identity_provider_id + - kms_project_id + - kms_key_ring_name + - kms_key_name + - kms_key_location + - audience + AzureExternalKeyParams: + properties: + name: + type: string + description: A friendly name to identify this config + type: + type: string + enum: + - azure + default: azure + x-stainless-const: true + tenant_id: + type: string + pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ + description: Your Azure tenant UUID + vault_uri: + type: string + pattern: ^https://.+\.vault\.azure\.net/?$ + description: The URI of the Azure vault containing the master key you manage + key_name: + type: string + maxLength: 127 + pattern: ^org-[0-9a-zA-Z-]*--[0-9a-zA-Z-]*$ + description: The name of the Azure Key Vault master key that you manage + purpose: + $ref: '#/components/schemas/ExternalKeyPurpose' + key_version: + type: string + pattern: ^[0-9a-fA-F]{32}$ + description: An exact Azure Key Vault key version. Required for PSP decryption; not accepted for EKM. + type: object + required: + - name + - type + - tenant_id + - vault_uri + - key_name + V1OrganizationExternalKeysPostRequest: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/AwsExternalKeyParams' + - $ref: '#/components/schemas/GcpExternalKeyParams' + - $ref: '#/components/schemas/AzureExternalKeyParams' + ValidateExternalKeyResource: + properties: + status: + type: string + type: object + required: + - status DecisionsUsageBucketWidth: type: string enum: @@ -81506,11 +82516,6 @@ components: - object - created_at - results - OrderEnum: - type: string - enum: - - asc - - desc VideoModel: anyOf: - type: string @@ -84964,6 +85969,26 @@ components: - max_concurrent_subagents additionalProperties: false description: The resolved configuration for creating and coordinating subagents. + CompactionResource: + type: object + properties: + async: + type: boolean + description: Whether context is compacted in the background. Defaults to true. + required: + - async + additionalProperties: false + description: The effective settings for compacting the agent's context. + ExperimentalConfigResource: + type: object + properties: + time_awareness: + type: boolean + description: Whether the model receives periodic current-time reminders. + required: + - time_awareness + additionalProperties: false + description: The effective experimental settings for an agent. AutomationAgentConfigResource: type: object properties: @@ -85831,6 +86856,14 @@ components: - error additionalProperties: false description: An API error response. + ExperimentalConfigOverridesParam: + type: object + properties: + time_awareness: + type: boolean + description: Whether to give the model periodic current-time reminders. Omit to keep the current setting. + additionalProperties: false + description: Experimental settings to update. Omitted settings keep their current values. ReasoningEffortParam: type: string enum: @@ -85981,6 +87014,16 @@ components: description: Explicit configuration for creating and coordinating subagents. x-openai-go-legacy-bool-fields: - enabled + CompactionParam: + type: object + properties: + async: + type: + - boolean + - 'null' + description: Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage. + additionalProperties: false + description: Settings for compacting the agent's context. AgentToolConfigParamFunction: type: object properties: @@ -86398,6 +87441,10 @@ components: SessionAgentConfigParam: type: object properties: + experimental: + $ref: '#/components/schemas/ExperimentalConfigOverridesParam' + default: {} + description: Experimental settings to merge by key. Omitted settings keep their current values. model: type: string minLength: 0 @@ -86430,6 +87477,11 @@ components: - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' - type: 'null' description: Configuration for creating and coordinating subagents. + compaction: + anyOf: + - $ref: '#/components/schemas/CompactionParam' + - type: 'null' + description: Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction. tools: type: - array @@ -86439,15 +87491,6 @@ components: minItems: 0 maxItems: 16384 description: Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON. - compaction: - anyOf: - - $ref: '#/components/schemas/CompactionParam' - - type: 'null' - description: Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction. - experimental: - $ref: '#/components/schemas/ExperimentalConfigOverridesParam' - default: {} - description: Experimental settings to merge by key. Omitted settings keep their current values. additionalProperties: false description: Agent configuration for a session. Omitted fields inherit from `agent_id` when supplied. Supplied objects and arrays replace the whole field, except experimental settings, which merge by key. Null resets nullable fields. EnvironmentParamNone: @@ -89979,6 +91022,15 @@ components: - has_more additionalProperties: false description: A page of Agents API resources, with IDs for retrieving additional pages. + ExperimentalConfigParam: + type: object + properties: + time_awareness: + type: boolean + default: false + description: Whether to give the model periodic current-time reminders. Defaults to false. + additionalProperties: false + description: Experimental agent settings. These features may change. PersistedAgentToolConfigParamFunction: type: object properties: @@ -90314,6 +91366,11 @@ components: CreateAgentParams: type: object properties: + experimental: + $ref: '#/components/schemas/ExperimentalConfigParam' + default: + time_awareness: false + description: Experimental agent settings. All experimental features default to disabled. metadata: type: - object @@ -90382,11 +91439,6 @@ components: - $ref: '#/components/schemas/CompactionParam' - type: 'null' description: Context compaction settings. Omission or null enables background compaction. - experimental: - $ref: '#/components/schemas/ExperimentalConfigParam' - default: - time_awareness: false - description: Experimental agent settings. All experimental features default to disabled. required: - model additionalProperties: false @@ -90394,6 +91446,10 @@ components: UpdateAgentParams: type: object properties: + experimental: + $ref: '#/components/schemas/ExperimentalConfigOverridesParam' + default: {} + description: Experimental settings to merge by key. Omitted settings keep their current values. model: type: string minLength: 0 @@ -90426,6 +91482,11 @@ components: - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' - type: 'null' description: Configuration for creating and coordinating subagents. + compaction: + anyOf: + - $ref: '#/components/schemas/CompactionParam' + - type: 'null' + description: Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction. metadata: type: - object @@ -90457,15 +91518,6 @@ components: minItems: 0 maxItems: 2000 description: Replaces the tool list. Omit to leave it unchanged, or pass null to clear it. The replacement must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON. - compaction: - anyOf: - - $ref: '#/components/schemas/CompactionParam' - - type: 'null' - description: Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction. - experimental: - $ref: '#/components/schemas/ExperimentalConfigOverridesParam' - default: {} - description: Experimental settings to merge by key. Omitted settings keep their current values. additionalProperties: false description: Fields to replace on an existing reusable agent. DeletedAgentResource: @@ -95450,7 +96502,7 @@ components: example: type: decision.create event_id: decision_1 - LiveDecisionInputTextParam: + LiveDecisionUserInputTextParam: type: object properties: type: @@ -95466,14 +96518,7 @@ components: required: - type - text - LiveDetailEnum: - type: string - enum: - - low - - high - - auto - - original - LiveDecisionInputImageParam: + LiveDecisionUserInputImageParam: type: object properties: type: @@ -95495,7 +96540,149 @@ components: required: - type - image_url - LiveDecisionInputItemParam: + LiveDecisionUserMessageParam: + type: object + properties: + id: + anyOf: + - description: The unique ID of this message item. + type: string + - type: 'null' + type: + default: message + x-stainless-const: true + type: string + enum: + - message + role: + description: The message role. Always `user`. + default: user + x-stainless-const: true + type: string + enum: + - user + content: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveDecisionUserInputTextParam' + - $ref: '#/components/schemas/LiveDecisionUserInputImageParam' + - $ref: '#/components/schemas/LiveDecisionInputJsonParam' + x-stainless-variantName: parts + x-stainless-naming: + java: + variant_constructor: DecisionItemCreateEventItemContentItems + required: + - role + - content + LiveDecisionDeveloperMessageParam: + type: object + properties: + id: + anyOf: + - description: The unique ID of this message item. + type: string + - type: 'null' + type: + default: message + x-stainless-const: true + type: string + enum: + - message + role: + default: developer + x-stainless-const: true + type: string + enum: + - developer + content: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + $ref: '#/components/schemas/LiveDecisionInputTextParam' + x-stainless-variantName: parts + required: + - role + - content + LiveDecisionSystemMessageParam: + type: object + properties: + id: + anyOf: + - description: The unique ID of this message item. + type: string + - type: 'null' + type: + default: message + x-stainless-const: true + type: string + enum: + - message + role: + default: system + x-stainless-const: true + type: string + enum: + - system + content: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + $ref: '#/components/schemas/LiveDecisionInputTextParam' + x-stainless-variantName: parts + required: + - role + - content + LiveDecisionOutputTextParam: + type: object + properties: + type: + default: output_text + x-stainless-const: true + type: string + enum: + - output_text + text: + description: The text content. + type: string + maxLength: 10485760 + required: + - type + - text + LiveDecisionRefusalParam: + type: object + properties: + type: + default: refusal + x-stainless-const: true + type: string + enum: + - refusal + refusal: + description: The refusal text. + type: string + maxLength: 10485760 + required: + - type + - refusal + LiveMessagePhase: + type: string + enum: + - commentary + - final_answer + LiveDecisionAssistantMessageParam: type: object properties: id: @@ -95509,7 +96696,226 @@ components: type: string enum: - message + role: + default: assistant + x-stainless-const: true + type: string + enum: + - assistant + content: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveDecisionOutputTextParam' + - $ref: '#/components/schemas/LiveDecisionRefusalParam' + x-stainless-variantName: parts + phase: + anyOf: + - description: Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages. + $ref: '#/components/schemas/LiveMessagePhase' + - type: 'null' + required: + - role + - content + LiveFunctionCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + LiveDecisionFunctionCallParam: + type: object + properties: + id: + anyOf: + - description: The local Decision item ID. + type: string + - type: 'null' + call_id: + description: The unique ID of the function tool call generated by the model. + type: string + minLength: 1 + maxLength: 64 + status: + anyOf: + - $ref: '#/components/schemas/LiveFunctionCallItemStatus' + - type: 'null' + type: + description: The item type. Always `function_call`. + default: function_call + x-stainless-const: true + type: string + enum: + - function_call + name: + type: string + minLength: 1 + maxLength: 128 + pattern: ^[a-zA-Z0-9_.-]+$ + namespace: + anyOf: + - description: The namespace of the function to call. + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + - type: 'null' + arguments: + description: The function arguments as a JSON string. + type: string + required: + - call_id + - type + - name + - arguments + LiveDecisionFunctionCallOutputParam: + type: object + properties: + id: + anyOf: + - description: The local Decision item ID. + type: string + - type: 'null' + call_id: + description: The unique ID of the function tool call generated by the model. + type: string + minLength: 1 + maxLength: 64 + status: + anyOf: + - $ref: '#/components/schemas/LiveFunctionCallItemStatus' + - type: 'null' + type: + description: The type of the function tool call output. Always `function_call_output`. + default: function_call_output + x-stainless-const: true + type: string + enum: + - function_call_output + output: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveDecisionInputTextParam' + - $ref: '#/components/schemas/LiveDecisionInputImageParam' + x-stainless-variantName: parts + required: + - call_id + - type + - output + LiveDecisionCustomToolCallParam: + type: object + properties: + id: + anyOf: + - description: The local Decision item ID. + type: string + - type: 'null' + call_id: + description: The unique ID of the function tool call generated by the model. + type: string + minLength: 1 + maxLength: 64 + status: + anyOf: + - $ref: '#/components/schemas/LiveFunctionCallItemStatus' + - type: 'null' + type: + description: The item type. Always `custom_tool_call`. + default: custom_tool_call + x-stainless-const: true + type: string + enum: + - custom_tool_call + name: + description: The name of the custom tool to call. + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + namespace: + anyOf: + - description: The namespace of the function to call. + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + - type: 'null' + input: + description: The input to the custom tool call. + type: string + required: + - call_id + - type + - name + - input + LiveDecisionCustomToolCallOutputParam: + type: object + properties: + id: + anyOf: + - description: The local Decision item ID. + type: string + - type: 'null' + call_id: + description: The unique ID of the function tool call generated by the model. + type: string + minLength: 1 + maxLength: 64 + status: + anyOf: + - $ref: '#/components/schemas/LiveFunctionCallItemStatus' + - type: 'null' + type: + default: custom_tool_call_output + x-stainless-const: true + type: string + enum: + - custom_tool_call_output + output: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveDecisionInputTextParam' + - $ref: '#/components/schemas/LiveDecisionInputImageParam' + x-stainless-variantName: parts + required: + - call_id + - type + - output + LiveDecisionInputItemParam: + type: object + properties: + id: + anyOf: + - description: The unique ID of this message item. + type: string + - type: 'null' + type: description: The item type. An omitted type denotes a message. Tool call and output items have their corresponding tool type. + default: message + x-stainless-const: true + type: string + enum: + - message role: description: The role on a message item, defaulting to user. Tool call and output items omit role. default: user @@ -95518,6 +96924,7 @@ components: enum: - user content: + description: The required content of a message item. Tool call and output items omit content. anyOf: - description: The text input to the model. type: string @@ -95533,7 +96940,6 @@ components: x-stainless-naming: java: variant_constructor: DecisionItemCreateEventItemContentItems - description: The required content of a message item. Tool call and output items omit content. required: - role - content @@ -96533,6 +97939,308 @@ components: output_tokens_details: reasoning_tokens: 0 total_tokens: 42 + LiveDecisionStoredUserMessageParam: + type: object + properties: + id: + type: string + type: + default: message + x-stainless-const: true + type: string + enum: + - message + role: + description: The message role. Always `user`. + default: user + x-stainless-const: true + type: string + enum: + - user + content: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveDecisionUserInputTextParam' + - $ref: '#/components/schemas/LiveDecisionUserInputImageParam' + - $ref: '#/components/schemas/LiveDecisionInputJsonParam' + x-stainless-variantName: parts + x-stainless-naming: + java: + variant_constructor: DecisionItemCreatedEventItemContentItems + required: + - role + - content + - id + LiveDecisionStoredDeveloperMessageParam: + type: object + properties: + id: + type: string + type: + default: message + x-stainless-const: true + type: string + enum: + - message + role: + default: developer + x-stainless-const: true + type: string + enum: + - developer + content: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + $ref: '#/components/schemas/LiveDecisionInputTextParam' + x-stainless-variantName: parts + required: + - role + - content + - id + LiveDecisionStoredSystemMessageParam: + type: object + properties: + id: + type: string + type: + default: message + x-stainless-const: true + type: string + enum: + - message + role: + default: system + x-stainless-const: true + type: string + enum: + - system + content: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + $ref: '#/components/schemas/LiveDecisionInputTextParam' + x-stainless-variantName: parts + required: + - role + - content + - id + LiveDecisionStoredAssistantMessageParam: + type: object + properties: + id: + type: string + type: + default: message + x-stainless-const: true + type: string + enum: + - message + role: + default: assistant + x-stainless-const: true + type: string + enum: + - assistant + content: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveDecisionOutputTextParam' + - $ref: '#/components/schemas/LiveDecisionRefusalParam' + x-stainless-variantName: parts + phase: + anyOf: + - description: Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages. + $ref: '#/components/schemas/LiveMessagePhase' + - type: 'null' + required: + - role + - content + - id + LiveDecisionStoredFunctionCallParam: + type: object + properties: + id: + type: string + call_id: + description: The unique ID of the function tool call generated by the model. + type: string + minLength: 1 + maxLength: 64 + status: + anyOf: + - $ref: '#/components/schemas/LiveFunctionCallItemStatus' + - type: 'null' + type: + description: The item type. Always `function_call`. + default: function_call + x-stainless-const: true + type: string + enum: + - function_call + name: + type: string + minLength: 1 + maxLength: 128 + pattern: ^[a-zA-Z0-9_.-]+$ + namespace: + anyOf: + - description: The namespace of the function to call. + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + - type: 'null' + arguments: + description: The function arguments as a JSON string. + type: string + required: + - call_id + - type + - name + - arguments + - id + LiveDecisionStoredFunctionCallOutputParam: + type: object + properties: + id: + type: string + call_id: + description: The unique ID of the function tool call generated by the model. + type: string + minLength: 1 + maxLength: 64 + status: + anyOf: + - $ref: '#/components/schemas/LiveFunctionCallItemStatus' + - type: 'null' + type: + description: The type of the function tool call output. Always `function_call_output`. + default: function_call_output + x-stainless-const: true + type: string + enum: + - function_call_output + output: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveDecisionInputTextParam' + - $ref: '#/components/schemas/LiveDecisionInputImageParam' + x-stainless-variantName: parts + required: + - call_id + - type + - output + - id + LiveDecisionStoredCustomToolCallParam: + type: object + properties: + id: + type: string + call_id: + description: The unique ID of the function tool call generated by the model. + type: string + minLength: 1 + maxLength: 64 + status: + anyOf: + - $ref: '#/components/schemas/LiveFunctionCallItemStatus' + - type: 'null' + type: + description: The item type. Always `custom_tool_call`. + default: custom_tool_call + x-stainless-const: true + type: string + enum: + - custom_tool_call + name: + description: The name of the custom tool to call. + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + namespace: + anyOf: + - description: The namespace of the function to call. + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + - type: 'null' + input: + description: The input to the custom tool call. + type: string + required: + - call_id + - type + - name + - input + - id + LiveDecisionStoredCustomToolCallOutputParam: + type: object + properties: + id: + type: string + call_id: + description: The unique ID of the function tool call generated by the model. + type: string + minLength: 1 + maxLength: 64 + status: + anyOf: + - $ref: '#/components/schemas/LiveFunctionCallItemStatus' + - type: 'null' + type: + default: custom_tool_call_output + x-stainless-const: true + type: string + enum: + - custom_tool_call_output + output: + anyOf: + - description: The text input to the model. + type: string + maxLength: 10485760 + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveDecisionInputTextParam' + - $ref: '#/components/schemas/LiveDecisionInputImageParam' + x-stainless-variantName: parts + required: + - call_id + - type + - output + - id LiveDecisionStoredInputItemParam: type: object properties: @@ -96540,12 +98248,12 @@ components: description: The ID of the stored Decision input item. type: string type: + description: The item type. An omitted type denotes a message. Tool call and output items have their corresponding tool type. default: message x-stainless-const: true type: string enum: - message - description: The item type. An omitted type denotes a message. Tool call and output items have their corresponding tool type. role: description: The role on a message item. Tool call and output items omit role. default: user @@ -96554,6 +98262,7 @@ components: enum: - user content: + description: The required content of a message item. Tool call and output items omit content. anyOf: - description: The text input to the model. type: string @@ -96569,7 +98278,6 @@ components: x-stainless-naming: java: variant_constructor: DecisionItemCreatedEventItemContentItems - description: The required content of a message item. Tool call and output items omit content. required: - id - role @@ -97006,6 +98714,39 @@ components: type: transport.dtmf.received event_id: event_dtmf_1 event: '5' + LiveTransportDTMFSent: + description: A SIP DTMF keypress successfully sent to the SIP trunk. Delivered only to sideband observers; this is not a client command. + example: + type: transport.dtmf.sent + event_id: event_dtmf_2 + event: '#' + type: object + properties: + type: + default: transport.dtmf.sent + x-stainless-const: true + type: string + enum: + - transport.dtmf.sent + event_id: + type: string + event: + type: string + minLength: 1 + maxLength: 1 + pattern: ^[0-9A-D*#]$ + client_event_id: + description: The event_id of the client command, when supplied. + type: string + required: + - type + - event_id + - event + x-oaiMeta: + example: + type: transport.dtmf.sent + event_id: event_dtmf_2 + event: '#' LiveTransportRinging: description: The outbound SIP provider leg is ringing or providing early media. Delivered only to sideband observers. example: @@ -97157,6 +98898,40 @@ components: - $ref: '#/components/schemas/LiveTransportRinging' - $ref: '#/components/schemas/LiveTransportAnswered' - $ref: '#/components/schemas/LiveTransportFailed' + LiveTransportDTMFSendParam: + description: Send one DTMF keypress to the SIP trunk through a Live sideband connection. This command is supported only for SIP calls. A successful send emits `transport.dtmf.sent` on sideband. If you provide `event_id`, the success notification includes it as `client_event_id`; a failure includes it as `error.client_event_id`. Send separate events for multiple keypresses. + example: + type: transport.dtmf.send + event_id: evt_dtmf_001 + event: '#' + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + default: transport.dtmf.send + x-stainless-const: true + type: string + enum: + - transport.dtmf.send + event: + description: 'The DTMF key to send: one of `0`–`9`, `A`–`D`, `*`, or `#`.' + type: string + minLength: 1 + maxLength: 1 + pattern: ^[0-9A-D*#]$ + required: + - type + - event + x-oaiMeta: + example: + type: transport.dtmf.send + event_id: evt_dtmf_001 + event: '#' UserMessageItemParam: properties: id: @@ -97697,12 +99472,12 @@ components: Setting to `{ "type": "json_object" }` enables the older JSON mode, which ensures the message the model generates is valid JSON. Using `json_schema` is preferred for models that support it. + discriminator: + propertyName: type anyOf: - $ref: '#/components/schemas/BetaResponseFormatText' - $ref: '#/components/schemas/BetaTextResponseFormatJsonSchema' - $ref: '#/components/schemas/BetaResponseFormatJsonObject' - discriminator: - propertyName: type BetaResponseFormatJsonObject: type: object title: JSON object @@ -100765,9 +102540,8 @@ components: BetaResponseConfigurationUpdateItemParam: type: object description: | - An update to the conversation's response configuration. The configuration - remains in effect for subsequent responses until it is replaced by another - configuration update. + An update to the conversation's response configuration. Supply reasoning, + text, or both. Each setting stays in effect until a later update replaces it. properties: agent: anyOf: @@ -100796,6 +102570,19 @@ components: description: | The reasoning effort to use for subsequent responses until another configuration update replaces it. + text: + type: object + description: The text output configuration for subsequent responses. + properties: + format: + description: Use a JSON schema for structured output or text to return to plain text. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/BetaResponseFormatText' + - $ref: '#/components/schemas/BetaTextResponseFormatJsonSchema' + required: + - format required: - type BetaAdditionalToolsItemParam: @@ -103522,8 +105309,8 @@ components: BetaResponseConfigurationUpdate: type: object description: | - A configuration update that applies to subsequent responses until it is - replaced by another configuration update. + A configuration update for subsequent responses. Each setting stays in effect + until a later update replaces that setting. properties: agent: $ref: '#/components/schemas/BetaAgentTag' @@ -103548,6 +105335,19 @@ components: description: | The reasoning effort used for subsequent responses until another configuration update replaces it. + text: + type: object + description: The text output configuration for subsequent responses. + properties: + format: + description: Use a JSON schema for structured output or text to return to plain text. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/BetaResponseFormatText' + - $ref: '#/components/schemas/BetaTextResponseFormatJsonSchema' + required: + - format required: - id - type @@ -104771,6 +106571,95 @@ components: - mode title: Prompt cache options description: The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models. + BetaResponseToolUsage: + properties: + image_gen: + $ref: '#/components/schemas/BetaImageGenToolUsage' + description: Aggregated usage statistics for image generation tool calls. + web_search: + $ref: '#/components/schemas/BetaWebSearchUsage' + description: Aggregated billable usage statistics for web search tool calls. + type: object + required: + - image_gen + - web_search + title: Response tool usage + description: Aggregated usage details for billable tools that ran while generating the response. + BetaWebSearchUsage: + properties: + num_requests: + type: integer + description: The number of billable web search requests issued. + type: object + required: + - num_requests + title: Web search usage + description: Usage details for web search requests that ran while generating the response. + BetaImageGenToolUsage: + properties: + input_tokens: + type: integer + description: The number of tokens (images and text) in the input prompt. + total_tokens: + type: integer + description: The total number of tokens (images and text) used for the image generation. + output_tokens: + type: integer + description: The number of output tokens generated by the model. + output_tokens_details: + $ref: '#/components/schemas/BetaImageGenOutputTokensDetails' + input_tokens_details: + $ref: '#/components/schemas/BetaImageGenInputUsageDetails' + cached_tokens: + type: integer + cached_tokens_details: + $ref: '#/components/schemas/BetaCachedUsageDetails' + type: object + required: + - input_tokens + - total_tokens + - output_tokens + - input_tokens_details + title: Image generation tool usage + description: Token usage for image generation tool calls in a response. + BetaCachedUsageDetails: + properties: + cached_text_tokens: + type: integer + cached_image_tokens: + type: integer + type: object + required: + - cached_text_tokens + - cached_image_tokens + BetaImageGenInputUsageDetails: + properties: + text_tokens: + type: integer + description: The number of text tokens in the input prompt. + image_tokens: + type: integer + description: The number of image tokens in the input prompt. + type: object + required: + - text_tokens + - image_tokens + title: Input usage details + description: The input tokens detailed information for the image generation. + BetaImageGenOutputTokensDetails: + properties: + image_tokens: + type: integer + description: The number of image output tokens generated by the model. + text_tokens: + type: integer + description: The number of text output tokens generated by the model. + type: object + required: + - image_tokens + - text_tokens + title: Image generation output token details + description: The output token details for the image generation. BetaOutputItem: discriminator: propertyName: type @@ -109970,2290 +111859,451 @@ components: - $ref: '#/components/schemas/BetaResponseCustomToolCallInputDoneEvent' discriminator: propertyName: type - LiveDecisionAssistantMessageParam: - type: object - properties: - id: - anyOf: - - description: The unique ID of this message item. - type: string - - type: 'null' - type: - default: message - x-stainless-const: true - type: string - enum: - - message - role: - default: assistant - x-stainless-const: true - type: string - enum: - - assistant - content: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveDecisionOutputTextParam' - - $ref: '#/components/schemas/LiveDecisionRefusalParam' - x-stainless-variantName: parts - phase: - anyOf: - - description: Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages. - $ref: '#/components/schemas/LiveMessagePhase' - - type: 'null' - required: - - role - - content - LiveDecisionCustomToolCallOutputParam: + SessionSpendControlResource: type: object properties: - id: - anyOf: - - description: The local Decision item ID. - type: string - - type: 'null' - call_id: - description: The unique ID of the function tool call generated by the model. - type: string - minLength: 1 - maxLength: 64 - status: - anyOf: - - $ref: '#/components/schemas/LiveFunctionCallItemStatus' - - type: 'null' - type: - default: custom_tool_call_output - x-stainless-const: true - type: string - enum: - - custom_tool_call_output - output: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveDecisionInputTextParam' - - $ref: '#/components/schemas/LiveDecisionInputImageParam' - x-stainless-variantName: parts + limit: + type: integer + format: int64 + minimum: 1 + maximum: 4503599627370495 + description: The configured positive limit in USD cents. + consumed: + type: + - integer + - 'null' + minimum: 0 + description: Best-effort recorded spend floored to whole USD cents, or null when unavailable. required: - - call_id - - type - - output - LiveDecisionCustomToolCallParam: + - limit + - consumed + additionalProperties: false + description: Session-wide spending control, present only when a limit is configured. + SessionSpendControlParam: type: object properties: - id: - anyOf: - - description: The local Decision item ID. - type: string - - type: 'null' - call_id: - description: The unique ID of the function tool call generated by the model. - type: string - minLength: 1 - maxLength: 64 - status: - anyOf: - - $ref: '#/components/schemas/LiveFunctionCallItemStatus' - - type: 'null' - type: - description: The item type. Always `custom_tool_call`. - default: custom_tool_call - x-stainless-const: true - type: string - enum: - - custom_tool_call - name: - description: The name of the custom tool to call. - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - namespace: - anyOf: - - description: The namespace of the function to call. - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - - type: 'null' - input: - description: The input to the custom tool call. - type: string + limit: + type: + - integer + - 'null' + format: int64 + minimum: 1 + maximum: 4503599627370495 + description: Positive USD cents, or null to remove the limit. required: - - call_id - - type - - name - - input - LiveDecisionDeveloperMessageParam: + - limit + additionalProperties: false + description: Sets the session-wide limit without changing recorded spend. + DecisionPromptCacheBreakpoint: type: object properties: - id: - anyOf: - - description: The unique ID of this message item. - type: string - - type: 'null' - type: - default: message - x-stainless-const: true + mode: type: string enum: - - message - role: - default: developer + - explicit + default: explicit x-stainless-const: true - type: string - enum: - - developer - content: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - $ref: '#/components/schemas/LiveDecisionInputTextParam' - x-stainless-variantName: parts + description: The breakpoint mode. Always `explicit`. required: - - role - - content - LiveDecisionFunctionCallOutputParam: + - mode + additionalProperties: false + title: Prompt cache breakpoint + description: Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block. + OAuthErrorCode: + anyOf: + - enum: + - invalid_grant + - invalid_subject_token + - type: string + AutomationMetadataParam: type: object - properties: - id: - anyOf: - - description: The local Decision item ID. - type: string - - type: 'null' - call_id: - description: The unique ID of the function tool call generated by the model. - type: string - minLength: 1 - maxLength: 64 - status: - anyOf: - - $ref: '#/components/schemas/LiveFunctionCallItemStatus' - - type: 'null' - type: - description: The type of the function tool call output. Always `function_call_output`. - default: function_call_output - x-stainless-const: true - type: string - enum: - - function_call_output - output: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveDecisionInputTextParam' - - $ref: '#/components/schemas/LiveDecisionInputImageParam' - x-stainless-variantName: parts - required: - - call_id - - type - - output - LiveDecisionFunctionCallParam: + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + ResponseSteerInputContent: + discriminator: + propertyName: type + description: A piece of message content, such as text, an image, or a file. + anyOf: + - $ref: '#/components/schemas/InputTextContentParam' + - $ref: '#/components/schemas/InputImageContentParamAutoParam' + - $ref: '#/components/schemas/InputFileContentParam' + BetaResponseSteerInputContent: + discriminator: + propertyName: type + description: A piece of message content, such as text, an image, or a file. + anyOf: + - $ref: '#/components/schemas/BetaInputTextContentParam' + - $ref: '#/components/schemas/BetaInputImageContentParamAutoParam' + - $ref: '#/components/schemas/BetaInputFileContentParam' + ModerationImageURLInput: type: object + description: An object describing an image to classify. properties: - id: - anyOf: - - description: The local Decision item ID. - type: string - - type: 'null' - call_id: - description: The unique ID of the function tool call generated by the model. - type: string - minLength: 1 - maxLength: 64 - status: - anyOf: - - $ref: '#/components/schemas/LiveFunctionCallItemStatus' - - type: 'null' type: - description: The item type. Always `function_call`. - default: function_call - x-stainless-const: true + description: Always `image_url`. type: string enum: - - function_call - name: - type: string - minLength: 1 - maxLength: 128 - pattern: ^[a-zA-Z0-9_.-]+$ - namespace: - anyOf: - - description: The namespace of the function to call. - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - - type: 'null' - arguments: - description: The function arguments as a JSON string. - type: string - required: - - call_id - - type - - name - - arguments - LiveDecisionInputJsonParam: - type: object - properties: - type: - default: input_json + - image_url x-stainless-const: true - type: string - enum: - - input_json - data: - anyOf: - - $ref: '#/components/schemas/LiveDecisionJsonObject' - - type: array - items: - $ref: '#/components/schemas/LiveDecisionJsonObject' + image_url: + type: object + description: Contains either an image URL or a data URL for a base64 encoded image. + properties: + url: + type: string + description: Either a URL of the image or the base64 encoded image data. + format: uri + example: https://example.com/image.jpg + required: + - url + x-stainless-go-json: omitzero required: - type - - data - LiveDecisionJsonObject: - type: object - additionalProperties: true - LiveDecisionOutputTextParam: + - image_url + ModerationTextInput: type: object + description: An object describing text to classify. properties: type: - default: output_text - x-stainless-const: true + description: Always `text`. type: string enum: - - output_text + - text + x-stainless-const: true text: - description: The text content. + description: A string of text to classify. type: string - maxLength: 10485760 + example: '...text to classify goes here...' required: - type - text - LiveDecisionRefusalParam: - type: object - properties: - type: - default: refusal - x-stainless-const: true - type: string - enum: - - refusal - refusal: - description: The refusal text. - type: string - maxLength: 10485760 - required: - - type - - refusal - LiveDecisionStoredAssistantMessageParam: + ComparisonFilterValueItems: + anyOf: + - type: string + - type: number + ChunkingStrategyResponse: type: object - properties: - id: - type: string - type: - default: message - x-stainless-const: true - type: string - enum: - - message - role: - default: assistant - x-stainless-const: true - type: string - enum: - - assistant - content: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveDecisionOutputTextParam' - - $ref: '#/components/schemas/LiveDecisionRefusalParam' - x-stainless-variantName: parts - phase: - anyOf: - - description: Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages. - $ref: '#/components/schemas/LiveMessagePhase' - - type: 'null' - required: - - role - - content - - id - LiveDecisionStoredCustomToolCallOutputParam: - type: object - properties: - id: - type: string - call_id: - description: The unique ID of the function tool call generated by the model. - type: string - minLength: 1 - maxLength: 64 - status: - anyOf: - - $ref: '#/components/schemas/LiveFunctionCallItemStatus' - - type: 'null' - type: - default: custom_tool_call_output - x-stainless-const: true - type: string - enum: - - custom_tool_call_output - output: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveDecisionInputTextParam' - - $ref: '#/components/schemas/LiveDecisionInputImageParam' - x-stainless-variantName: parts - required: - - call_id - - type - - output - - id - LiveDecisionStoredCustomToolCallParam: - type: object - properties: - id: - type: string - call_id: - description: The unique ID of the function tool call generated by the model. - type: string - minLength: 1 - maxLength: 64 - status: - anyOf: - - $ref: '#/components/schemas/LiveFunctionCallItemStatus' - - type: 'null' - type: - description: The item type. Always `custom_tool_call`. - default: custom_tool_call - x-stainless-const: true - type: string - enum: - - custom_tool_call - name: - description: The name of the custom tool to call. - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - namespace: - anyOf: - - description: The namespace of the function to call. - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - - type: 'null' - input: - description: The input to the custom tool call. - type: string - required: - - call_id - - type - - name - - input - - id - LiveDecisionStoredDeveloperMessageParam: - type: object - properties: - id: - type: string - type: - default: message - x-stainless-const: true - type: string - enum: - - message - role: - default: developer - x-stainless-const: true - type: string - enum: - - developer - content: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - $ref: '#/components/schemas/LiveDecisionInputTextParam' - x-stainless-variantName: parts - required: - - role - - content - - id - LiveDecisionStoredFunctionCallOutputParam: - type: object - properties: - id: - type: string - call_id: - description: The unique ID of the function tool call generated by the model. - type: string - minLength: 1 - maxLength: 64 - status: - anyOf: - - $ref: '#/components/schemas/LiveFunctionCallItemStatus' - - type: 'null' - type: - description: The type of the function tool call output. Always `function_call_output`. - default: function_call_output - x-stainless-const: true - type: string - enum: - - function_call_output - output: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveDecisionInputTextParam' - - $ref: '#/components/schemas/LiveDecisionInputImageParam' - x-stainless-variantName: parts - required: - - call_id - - type - - output - - id - LiveDecisionStoredFunctionCallParam: - type: object - properties: - id: - type: string - call_id: - description: The unique ID of the function tool call generated by the model. - type: string - minLength: 1 - maxLength: 64 - status: - anyOf: - - $ref: '#/components/schemas/LiveFunctionCallItemStatus' - - type: 'null' - type: - description: The item type. Always `function_call`. - default: function_call - x-stainless-const: true - type: string - enum: - - function_call - name: - type: string - minLength: 1 - maxLength: 128 - pattern: ^[a-zA-Z0-9_.-]+$ - namespace: - anyOf: - - description: The namespace of the function to call. - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - - type: 'null' - arguments: - description: The function arguments as a JSON string. - type: string - required: - - call_id - - type - - name - - arguments - - id - LiveDecisionStoredSystemMessageParam: - type: object - properties: - id: - type: string - type: - default: message - x-stainless-const: true - type: string - enum: - - message - role: - default: system - x-stainless-const: true - type: string - enum: - - system - content: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - $ref: '#/components/schemas/LiveDecisionInputTextParam' - x-stainless-variantName: parts - required: - - role - - content - - id - LiveDecisionStoredUserMessageParam: - type: object - properties: - id: - type: string - type: - default: message - x-stainless-const: true - type: string - enum: - - message - role: - description: The message role. Always `user`. - default: user - x-stainless-const: true - type: string - enum: - - user - content: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveDecisionUserInputTextParam' - - $ref: '#/components/schemas/LiveDecisionUserInputImageParam' - - $ref: '#/components/schemas/LiveDecisionInputJsonParam' - x-stainless-variantName: parts - x-stainless-naming: - java: - variant_constructor: DecisionItemCreatedEventItemContentItems - required: - - role - - content - - id - LiveDecisionSystemMessageParam: - type: object - properties: - id: - anyOf: - - description: The unique ID of this message item. - type: string - - type: 'null' - type: - default: message - x-stainless-const: true - type: string - enum: - - message - role: - default: system - x-stainless-const: true - type: string - enum: - - system - content: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - $ref: '#/components/schemas/LiveDecisionInputTextParam' - x-stainless-variantName: parts - required: - - role - - content - LiveDecisionUserInputImageParam: - type: object - properties: - type: - default: input_image - x-stainless-const: true - type: string - enum: - - input_image - image_url: - description: A base64-encoded image data URL or a publicly accessible HTTP(S) image URL. - type: string - maxLength: 20971520 - pattern: ^(data:|https?://) - detail: - anyOf: - - description: The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. - $ref: '#/components/schemas/LiveDetailEnum' - - type: 'null' - required: - - type - - image_url - LiveDecisionUserInputTextParam: - type: object - properties: - type: - default: input_text - x-stainless-const: true - type: string - enum: - - input_text - text: - description: The text input to the model. - type: string - maxLength: 10485760 - required: - - type - - text - LiveDecisionUserMessageParam: - type: object - properties: - id: - anyOf: - - description: The unique ID of this message item. - type: string - - type: 'null' - type: - default: message - x-stainless-const: true - type: string - enum: - - message - role: - description: The message role. Always `user`. - default: user - x-stainless-const: true - type: string - enum: - - user - content: - anyOf: - - description: The text input to the model. - type: string - maxLength: 10485760 - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveDecisionUserInputTextParam' - - $ref: '#/components/schemas/LiveDecisionUserInputImageParam' - - $ref: '#/components/schemas/LiveDecisionInputJsonParam' - x-stainless-variantName: parts - x-stainless-naming: - java: - variant_constructor: DecisionItemCreateEventItemContentItems - required: - - role - - content - LiveFunctionCallItemStatus: + description: The strategy used to chunk the file. + anyOf: + - $ref: '#/components/schemas/StaticChunkingStrategyResponseParam' + - $ref: '#/components/schemas/OtherChunkingStrategyResponseParam' + discriminator: + propertyName: type + FilePurpose: + description: | + The intended purpose of the uploaded file. One of: + - `assistants`: Used in the Assistants API + - `batch`: Used in the Batch API + - `fine-tune`: Used for fine-tuning + - `vision`: Images used for vision fine-tuning + - `user_data`: Flexible file type for any purpose + - `evals`: Used for eval data sets type: string enum: - - in_progress - - completed - - incomplete - LiveMessagePhase: + - assistants + - batch + - fine-tune + - vision + - user_data + - evals + AssistantTool: + anyOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + discriminator: + propertyName: type + TextAnnotationDelta: + anyOf: + - $ref: '#/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject' + - $ref: '#/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject' + discriminator: + propertyName: type + TextAnnotation: + anyOf: + - $ref: '#/components/schemas/MessageContentTextAnnotationsFileCitationObject' + - $ref: '#/components/schemas/MessageContentTextAnnotationsFilePathObject' + discriminator: + propertyName: type + RunStepDetailsToolCall: + anyOf: + - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFunctionObject' + discriminator: + propertyName: type + RunStepDeltaStepDetailsToolCall: + anyOf: + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject' + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject' + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject' + discriminator: + propertyName: type + MessageContent: + anyOf: + - $ref: '#/components/schemas/MessageContentImageFileObject' + - $ref: '#/components/schemas/MessageContentImageUrlObject' + - $ref: '#/components/schemas/MessageContentTextObject' + - $ref: '#/components/schemas/MessageContentRefusalObject' + discriminator: + propertyName: type + MessageContentDelta: + anyOf: + - $ref: '#/components/schemas/MessageDeltaContentImageFileObject' + - $ref: '#/components/schemas/MessageDeltaContentTextObject' + - $ref: '#/components/schemas/MessageDeltaContentRefusalObject' + - $ref: '#/components/schemas/MessageDeltaContentImageUrlObject' + discriminator: + propertyName: type + ChatModel: type: string enum: - - commentary - - final_answer - BetaCachedUsageDetails: - properties: - cached_text_tokens: - type: integer - cached_image_tokens: - type: integer - type: object - required: - - cached_text_tokens - - cached_image_tokens - BetaImageGenInputUsageDetails: - properties: - text_tokens: - type: integer - description: The number of text tokens in the input prompt. - image_tokens: - type: integer - description: The number of image tokens in the input prompt. - type: object - required: - - text_tokens - - image_tokens - title: Input usage details - description: The input tokens detailed information for the image generation. - BetaImageGenOutputTokensDetails: - properties: - image_tokens: - type: integer - description: The number of image output tokens generated by the model. - text_tokens: - type: integer - description: The number of text output tokens generated by the model. - type: object - required: - - image_tokens - - text_tokens - title: Image generation output token details - description: The output token details for the image generation. - BetaImageGenToolUsage: - properties: - input_tokens: - type: integer - description: The number of tokens (images and text) in the input prompt. - total_tokens: - type: integer - description: The total number of tokens (images and text) used for the image generation. - output_tokens: - type: integer - description: The number of output tokens generated by the model. - output_tokens_details: - $ref: '#/components/schemas/BetaImageGenOutputTokensDetails' - input_tokens_details: - $ref: '#/components/schemas/BetaImageGenInputUsageDetails' - cached_tokens: - type: integer - cached_tokens_details: - $ref: '#/components/schemas/BetaCachedUsageDetails' - type: object - required: - - input_tokens - - total_tokens - - output_tokens - - input_tokens_details - title: Image generation tool usage - description: Token usage for image generation tool calls in a response. - BetaResponseToolUsage: - properties: - image_gen: - $ref: '#/components/schemas/BetaImageGenToolUsage' - description: Aggregated usage statistics for image generation tool calls. - web_search: - $ref: '#/components/schemas/BetaWebSearchUsage' - description: Aggregated billable usage statistics for web search tool calls. - type: object - required: - - image_gen - - web_search - title: Response tool usage - description: Aggregated usage details for billable tools that ran while generating the response. - BetaWebSearchUsage: - properties: - num_requests: - type: integer - description: The number of billable web search requests issued. - type: object - required: - - num_requests - title: Web search usage - description: Usage details for web search requests that ran while generating the response. - CachedUsageDetails: - properties: - cached_text_tokens: - type: integer - cached_image_tokens: - type: integer - type: object - required: - - cached_text_tokens - - cached_image_tokens - ImageGenToolUsage: - properties: - input_tokens: - type: integer - description: The number of tokens (images and text) in the input prompt. - total_tokens: - type: integer - description: The total number of tokens (images and text) used for the image generation. - output_tokens: - type: integer - description: The number of output tokens generated by the model. - output_tokens_details: - $ref: '#/components/schemas/ImageGenOutputTokensDetails' - input_tokens_details: - $ref: '#/components/schemas/ImageGenInputUsageDetails' - cached_tokens: - type: integer - cached_tokens_details: - $ref: '#/components/schemas/CachedUsageDetails' - type: object - required: - - input_tokens - - total_tokens - - output_tokens - - input_tokens_details - title: Image generation tool usage - description: Token usage for image generation tool calls in a response. - ResponseToolUsage: - properties: - image_gen: - $ref: '#/components/schemas/ImageGenToolUsage' - description: Aggregated usage statistics for image generation tool calls. - web_search: - $ref: '#/components/schemas/WebSearchUsage' - description: Aggregated billable usage statistics for web search tool calls. - type: object - required: - - image_gen - - web_search - title: Response tool usage - description: Aggregated usage details for billable tools that ran while generating the response. - WebSearchUsage: - properties: - num_requests: - type: integer - description: The number of billable web search requests issued. - type: object - required: - - num_requests - title: Web search usage - description: Usage details for web search requests that ran while generating the response. - AwsExternalKeyParams: - properties: - name: - type: string - description: A friendly name to identify this config - type: - type: string - enum: - - aws - default: aws - x-stainless-const: true - role_arn: - type: string - pattern: ^arn:aws:iam::\d{12}:role/.+$ - description: The Role ARN that OpenAI will assume to call your KMS - example: arn:aws:iam::123456789012:role/example-role - kms_arn: - type: string - description: The Key Management System ARN for the master key you manage - external_id: - type: string - description: The ExternalID that OpenAI will pass in the AssumeRole call for the customer's AWS account. This must be the OpenAI organization ID or an API project ID that belongs to the organization. - purpose: - $ref: '#/components/schemas/ExternalKeyPurpose' - type: object - required: - - name - - type - - role_arn - - kms_arn - - external_id - AzureExternalKeyParams: - properties: - name: - type: string - description: A friendly name to identify this config - type: - type: string - enum: - - azure - default: azure - x-stainless-const: true - tenant_id: - type: string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ - description: Your Azure tenant UUID - vault_uri: - type: string - pattern: ^https://.+\.vault\.azure\.net/?$ - description: The URI of the Azure vault containing the master key you manage - key_name: - type: string - maxLength: 127 - pattern: ^org-[0-9a-zA-Z-]*--[0-9a-zA-Z-]*$ - description: The name of the Azure Key Vault master key that you manage - purpose: - $ref: '#/components/schemas/ExternalKeyPurpose' - key_version: - type: string - pattern: ^[0-9a-fA-F]{32}$ - description: An exact Azure Key Vault key version. Required for PSP decryption; not accepted for EKM. - type: object - required: - - name - - type - - tenant_id - - vault_uri - - key_name - ExternalKeyPurpose: - type: string - enum: - - ekm - - psp_decryption - ExternalKeyResource: - properties: - object: - type: string - id: - type: string - type: - type: string - purpose: - $ref: '#/components/schemas/ExternalKeyPurpose' - name: - type: string - api_project_ids: - items: - type: string - type: array - workspace_id: - type: string - created_at: - type: integer - role_arn: - type: string - external_id: - type: string - kms_arn: - type: string - workload_identity_project_number: - type: string - workload_identity_pool_id: - type: string - workload_identity_provider_id: - type: string - audience: - type: string - kms_project_id: - type: string - kms_key_ring_name: - type: string - kms_key_name: - type: string - kms_key_location: - type: string - kms_key_version: - type: string - tenant_id: - type: string - vault_uri: - type: string - key_name: - type: string - key_version: - type: string - type: object - required: - - object - - id - - type - - name - - api_project_ids - - workspace_id - - created_at - GcpExternalKeyParams: - properties: - name: - type: string - description: A friendly name to identify this config - type: - type: string - enum: - - gcp - default: gcp - x-stainless-const: true - workload_identity_project_number: - type: string - pattern: ^[0-9]{1,19}$ - description: The numeric GCP project number where you registered OpenAI's workload identity - workload_identity_pool_id: - type: string - description: The pool containing the Workload Identity provider that you registered for OpenAI - workload_identity_provider_id: - type: string - description: The Workload Identity provider that you registered for OpenAI - kms_project_id: - type: string - description: The string GCP project name where your KMS resides - kms_key_ring_name: - type: string - description: The Key Management System key ring for the master key you manage - kms_key_name: - type: string - description: The name of the Key Management System master key you manage - kms_key_location: - type: string - description: The region where your Key Management System master key is located - audience: - type: string - description: The aud field in the identity token OpenAI will pass in the call to the customer's GCP STS. This must be the OpenAI organization ID or an API project ID that belongs to the organization. - purpose: - $ref: '#/components/schemas/ExternalKeyPurpose' - kms_key_version: - type: string - pattern: ^[1-9][0-9]*$ - description: An exact CryptoKeyVersion number. Required for PSP decryption; not accepted for EKM. - type: object - required: - - name - - type - - workload_identity_project_number - - workload_identity_pool_id - - workload_identity_provider_id - - kms_project_id - - kms_key_ring_name - - kms_key_name - - kms_key_location - - audience - ListExternalKeysResource: - properties: - object: - type: string - enum: - - list - default: list - x-stainless-const: true - data: - items: - $ref: '#/components/schemas/ExternalKeyResource' - type: array - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean - type: object - required: - - object - - data - - first_id - - last_id - - has_more - V1OrganizationExternalKeysPostRequest: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/AwsExternalKeyParams' - - $ref: '#/components/schemas/GcpExternalKeyParams' - - $ref: '#/components/schemas/AzureExternalKeyParams' - ValidateExternalKeyResource: - properties: - status: - type: string - type: object - required: - - status - LiveTransportDTMFSendParam: - description: Send one DTMF keypress to the SIP trunk through a Live sideband connection. This command is supported only for SIP calls. A successful send emits `transport.dtmf.sent` on sideband. If you provide `event_id`, the success notification includes it as `client_event_id`; a failure includes it as `error.client_event_id`. Send separate events for multiple keypresses. - example: - type: transport.dtmf.send - event_id: evt_dtmf_001 - event: '#' - type: object - properties: - event_id: - anyOf: - - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. - type: string - maxLength: 512 - - type: 'null' - type: - default: transport.dtmf.send - x-stainless-const: true - type: string - enum: - - transport.dtmf.send - event: - description: 'The DTMF key to send: one of `0`–`9`, `A`–`D`, `*`, or `#`.' - type: string - minLength: 1 - maxLength: 1 - pattern: ^[0-9A-D*#]$ - required: - - type - - event - x-oaiMeta: - example: - type: transport.dtmf.send - event_id: evt_dtmf_001 - event: '#' - LiveTransportDTMFSent: - description: A SIP DTMF keypress successfully sent to the SIP trunk. Delivered only to sideband observers; this is not a client command. - example: - type: transport.dtmf.sent - event_id: event_dtmf_2 - event: '#' - type: object - properties: - type: - default: transport.dtmf.sent - x-stainless-const: true - type: string - enum: - - transport.dtmf.sent - event_id: - type: string - event: - type: string - minLength: 1 - maxLength: 1 - pattern: ^[0-9A-D*#]$ - client_event_id: - description: The event_id of the client command, when supplied. - type: string - required: - - type - - event_id - - event - x-oaiMeta: - example: - type: transport.dtmf.sent - event_id: event_dtmf_2 - event: '#' - CompactionParam: - type: object - properties: - async: - type: - - boolean - - 'null' - description: Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage. - additionalProperties: false - description: Settings for compacting the agent's context. - CompactionResource: - type: object - properties: - async: - type: boolean - description: Whether context is compacted in the background. Defaults to true. - required: - - async - additionalProperties: false - description: The effective settings for compacting the agent's context. - markup: - type: string - format: binary - description: A transparent PNG overlaid on the first image to guide the edit. Must match that image's dimensions after orientation and contain transparent pixels. Supports GPT Image 2.5 and 2.6. Cannot be combined with mask. - ExperimentalConfigOverridesParam: - type: object - properties: - time_awareness: - type: boolean - description: Whether to give the model periodic current-time reminders. Omit to keep the current setting. - additionalProperties: false - description: Experimental settings to update. Omitted settings keep their current values. - ExperimentalConfigParam: - type: object - properties: - time_awareness: - type: boolean - default: false - description: Whether to give the model periodic current-time reminders. Defaults to false. - additionalProperties: false - description: Experimental agent settings. These features may change. - ExperimentalConfigResource: - type: object - properties: - time_awareness: - type: boolean - description: Whether the model receives periodic current-time reminders. - required: - - time_awareness - additionalProperties: false - description: The effective experimental settings for an agent. - SessionSpendControlResource: - type: object - properties: - limit: - type: integer - format: int64 - minimum: 1 - maximum: 4503599627370495 - description: The configured positive limit in USD cents. - consumed: - type: - - integer - - 'null' - minimum: 0 - description: Best-effort recorded spend floored to whole USD cents, or null when unavailable. - required: - - limit - - consumed - additionalProperties: false - description: Session-wide spending control, present only when a limit is configured. - SessionSpendControlParam: - type: object - properties: - limit: - type: - - integer - - 'null' - format: int64 - minimum: 1 - maximum: 4503599627370495 - description: Positive USD cents, or null to remove the limit. - required: - - limit - additionalProperties: false - description: Sets the session-wide limit without changing recorded spend. - DecisionPromptCacheBreakpoint: - type: object - properties: - mode: - type: string - enum: - - explicit - default: explicit - x-stainless-const: true - description: The breakpoint mode. Always `explicit`. - required: - - mode - additionalProperties: false - title: Prompt cache breakpoint - description: Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block. - OAuthErrorCode: - anyOf: - - enum: - - invalid_grant - - invalid_subject_token - - type: string - AutomationMetadataParam: - type: object - additionalProperties: - type: string - minLength: 0 - maxLength: 512 - propertyNames: - type: string - minLength: 1 - maxLength: 64 - minProperties: 0 - maxProperties: 16 - ResponseSteerInputContent: - discriminator: - propertyName: type - description: A piece of message content, such as text, an image, or a file. - anyOf: - - $ref: '#/components/schemas/InputTextContentParam' - - $ref: '#/components/schemas/InputImageContentParamAutoParam' - - $ref: '#/components/schemas/InputFileContentParam' - BetaResponseSteerInputContent: - discriminator: - propertyName: type - description: A piece of message content, such as text, an image, or a file. - anyOf: - - $ref: '#/components/schemas/BetaInputTextContentParam' - - $ref: '#/components/schemas/BetaInputImageContentParamAutoParam' - - $ref: '#/components/schemas/BetaInputFileContentParam' - RealtimeConnectParams: - type: object - properties: - model: - type: string - call_id: - type: string - ModerationImageURLInput: - type: object - description: An object describing an image to classify. - properties: - type: - description: Always `image_url`. - type: string - enum: - - image_url - x-stainless-const: true - image_url: - type: object - description: Contains either an image URL or a data URL for a base64 encoded image. - properties: - url: - type: string - description: Either a URL of the image or the base64 encoded image data. - format: uri - example: https://example.com/image.jpg - required: - - url - x-stainless-go-json: omitzero - required: - - type - - image_url - ModerationTextInput: - type: object - description: An object describing text to classify. - properties: - type: - description: Always `text`. - type: string - enum: - - text - x-stainless-const: true - text: - description: A string of text to classify. - type: string - example: '...text to classify goes here...' - required: - - type - - text - ComparisonFilterValueItems: - anyOf: - - type: string - - type: number - ChunkingStrategyResponse: - type: object - description: The strategy used to chunk the file. - anyOf: - - $ref: '#/components/schemas/StaticChunkingStrategyResponseParam' - - $ref: '#/components/schemas/OtherChunkingStrategyResponseParam' - discriminator: - propertyName: type - FilePurpose: - description: | - The intended purpose of the uploaded file. One of: - - `assistants`: Used in the Assistants API - - `batch`: Used in the Batch API - - `fine-tune`: Used for fine-tuning - - `vision`: Images used for vision fine-tuning - - `user_data`: Flexible file type for any purpose - - `evals`: Used for eval data sets - type: string - enum: - - assistants - - batch - - fine-tune - - vision - - user_data - - evals - AssistantTool: - anyOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: '#/components/schemas/AssistantToolsFileSearch' - - $ref: '#/components/schemas/AssistantToolsFunction' - discriminator: - propertyName: type - TextAnnotationDelta: - anyOf: - - $ref: '#/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject' - - $ref: '#/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject' - discriminator: - propertyName: type - TextAnnotation: - anyOf: - - $ref: '#/components/schemas/MessageContentTextAnnotationsFileCitationObject' - - $ref: '#/components/schemas/MessageContentTextAnnotationsFilePathObject' - discriminator: - propertyName: type - RunStepDetailsToolCall: - anyOf: - - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeObject' - - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchObject' - - $ref: '#/components/schemas/RunStepDetailsToolCallsFunctionObject' - discriminator: - propertyName: type - RunStepDeltaStepDetailsToolCall: - anyOf: - - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject' - - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject' - - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject' - discriminator: - propertyName: type - MessageContent: - anyOf: - - $ref: '#/components/schemas/MessageContentImageFileObject' - - $ref: '#/components/schemas/MessageContentImageUrlObject' - - $ref: '#/components/schemas/MessageContentTextObject' - - $ref: '#/components/schemas/MessageContentRefusalObject' - discriminator: - propertyName: type - MessageContentDelta: - anyOf: - - $ref: '#/components/schemas/MessageDeltaContentImageFileObject' - - $ref: '#/components/schemas/MessageDeltaContentTextObject' - - $ref: '#/components/schemas/MessageDeltaContentRefusalObject' - - $ref: '#/components/schemas/MessageDeltaContentImageUrlObject' - discriminator: - propertyName: type - ChatModel: - type: string - enum: - - gpt-6-astra - - gpt-6.1-sol - - gpt-6.1-terra - - gpt-6-sol - - gpt-6-luna - - gpt-5.6-sol - - gpt-5.6-terra - - gpt-5.6-luna - - gpt-5.5 - - gpt-5.5-2026-04-23 - - gpt-5.4 - - gpt-5.4-mini - - gpt-5.4-nano - - gpt-5.4-mini-2026-03-17 - - gpt-5.4-nano-2026-03-17 - - gpt-5.3-chat-latest - - gpt-5.2 - - gpt-5.2-2025-12-11 - - gpt-5.2-chat-latest - - gpt-5.2-pro - - gpt-5.2-pro-2025-12-11 - - gpt-5.1 - - gpt-5.1-2025-11-13 - - gpt-5.1-codex - - gpt-5.1-mini - - gpt-5.1-chat-latest - - gpt-5 - - gpt-5-mini - - gpt-5-nano - - gpt-5-2025-08-07 - - gpt-5-mini-2025-08-07 - - gpt-5-nano-2025-08-07 - - gpt-5-chat-latest - - gpt-4.1 - - gpt-4.1-mini - - gpt-4.1-nano - - gpt-4.1-2025-04-14 - - gpt-4.1-mini-2025-04-14 - - gpt-4.1-nano-2025-04-14 - - o4-mini - - o4-mini-2025-04-16 - - o3 - - o3-2025-04-16 - - o3-mini - - o3-mini-2025-01-31 - - o1 - - o1-2024-12-17 - - o1-preview - - o1-preview-2024-09-12 - - o1-mini - - o1-mini-2024-09-12 - - gpt-4o - - gpt-4o-2024-11-20 - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-audio-mini - - gpt-audio-mini-2025-12-15 - - gpt-4o-audio-preview - - gpt-4o-audio-preview-2024-10-01 - - gpt-4o-audio-preview-2024-12-17 - - gpt-4o-audio-preview-2025-06-03 - - gpt-4o-mini-audio-preview - - gpt-4o-mini-audio-preview-2024-12-17 - - gpt-4o-search-preview - - gpt-4o-mini-search-preview - - gpt-4o-search-preview-2025-03-11 - - gpt-4o-mini-search-preview-2025-03-11 - - chatgpt-4o-latest - - codex-mini-latest - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0301 - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - x-openai-enum-deprecations: - gpt-5.4-nano: - message: 'Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5.1: - message: 'Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4.1-2025-04-14: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4.1: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4.1-mini: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4.1-mini-2025-04-14: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-2024-08-06: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-2024-11-20: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-mini: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-mini-2024-07-18: - message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5.3-chat-latest: - message: 'Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5.2-chat-latest: - message: 'Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5.1-codex: - message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5.1-chat-latest: - message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-2025-08-07: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-mini-2025-08-07: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-nano-2025-08-07: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-chat-latest: - message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4.1-nano: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4.1-nano-2025-04-14: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o4-mini: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o4-mini-2025-04-16: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o3-2025-04-16: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o3-mini: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o3-mini-2025-01-31: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o1: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o1-2024-12-17: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-2024-05-13: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-audio-mini: - message: 'Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-search-preview-2025-03-11: - message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-mini-search-preview-2025-03-11: - message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-turbo: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-turbo-2024-04-09: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-0125-preview: - message: 'Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-turbo-preview: - message: 'Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-1106-preview: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-0314: - message: 'Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-0613: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-3.5-turbo: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-3.5-turbo-1106: - message: 'Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-3.5-turbo-0125: - message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-3.5-turbo-0301: - message: 'Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-3.5-turbo-0613: - message: 'Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-3.5-turbo-16k: - message: 'Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-3.5-turbo-16k-0613: - message: 'Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-vision-preview: - message: 'Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-32k: - message: 'Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-32k-0314: - message: 'Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4-32k-0613: - message: 'Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o1-preview: - message: 'Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o1-preview-2024-09-12: - message: 'Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-audio-preview-2024-10-01: - message: 'Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o1-mini: - message: 'Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o1-mini-2024-09-12: - message: 'Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - codex-mini-latest: - message: 'Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - chatgpt-4o-latest: - message: 'Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-audio-preview: - message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-mini-audio-preview: - message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-audio-preview-2024-12-17: - message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-audio-preview-2025-06-03: - message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-mini-audio-preview-2024-12-17: - message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-search-preview: - message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-4o-mini-search-preview: - message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-mini: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-nano: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - o3: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-audio-mini-2025-12-15: - message: 'Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5.1-mini: - message: Not a supported model ID. Retained for SDK compatibility. - gpt-5.1-2025-11-13: - message: 'Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5.4-nano-2026-03-17: - message: 'Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - x-stainless-nominal: false - LiveBuiltInVoice: - type: string - enum: - - alloy - - ash - - ballad - - beacon - - bossa - - cedar - - cinder - - coral - - delta - - echo - - gleam - - marin - - meridian - - quartz - - ripple - - sage - - shida - - shimmer - - stone - - tempo - - verse - - vesper - - willow - description: A built-in voice available for Live speech. - Summary: - properties: - type: - type: string - enum: - - summary_text - description: The type of the object. Always `summary_text`. - default: summary_text - x-stainless-const: true - text: - type: string - description: A summary of the reasoning output from the model so far. - type: object - required: - - type - - text - title: Summary text - description: A summary text from the model. - CreateThreadAndRunRequestWithoutStream: - type: object - additionalProperties: false - properties: - assistant_id: - description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run. - type: string - thread: - $ref: '#/components/schemas/CreateThreadRequest' - model: - description: The ID of the [Model](https://developers.openai.com/api/reference/resources/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. - example: gpt-4.1 - anyOf: - - type: string - - type: string - enum: - - gpt-5 - - gpt-5-mini - - gpt-5-nano - - gpt-5-2025-08-07 - - gpt-5-mini-2025-08-07 - - gpt-5-nano-2025-08-07 - - gpt-4.1 - - gpt-4.1-mini - - gpt-4.1-nano - - gpt-4.1-2025-04-14 - - gpt-4.1-mini-2025-04-14 - - gpt-4.1-nano-2025-04-14 - - gpt-4o - - gpt-4o-2024-11-20 - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4.5-preview - - gpt-4.5-preview-2025-02-27 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - x-openai-enum-deprecations: - gpt-5: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-mini: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-nano: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-2025-08-07: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-mini-2025-08-07: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - gpt-5-nano-2025-08-07: - message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' - x-oaiTypeLabel: 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 - - 'null' - tools: - description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. - type: - - array - - 'null' - maxItems: 20 - items: - $ref: '#/components/schemas/AssistantTool' - tool_resources: - type: - - object - - 'null' - 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](https://developers.openai.com/api/reference/resources/files) 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](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. - maxItems: 1 - items: - type: string - metadata: - $ref: '#/components/schemas/Metadata' - temperature: - type: - - number - - 'null' - minimum: 0 - maximum: 2 - default: 1 - example: 1 - 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. - top_p: - type: - - number - - 'null' - minimum: 0 - maximum: 1 - default: 1 - example: 1 - description: | - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - response_format: - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - nullable: true - max_prompt_tokens: - type: - - integer - - 'null' - 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 - - 'null' - 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: - allOf: - - $ref: '#/components/schemas/TruncationObject' - - nullable: true - tool_choice: - allOf: - - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' - - nullable: true - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - required: - - assistant_id - CreateRunRequestWithoutStream: - type: object - additionalProperties: false - properties: - assistant_id: - description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run. - type: string - model: - description: The ID of the [Model](https://developers.openai.com/api/reference/resources/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. - example: gpt-4.1 - anyOf: - - type: string - - $ref: '#/components/schemas/AssistantSupportedModels' - x-oaiTypeLabel: string - nullable: true - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - instructions: - description: Overrides the [instructions](https://developers.openai.com/api/docs/assistants/migration) of the assistant. This is useful for modifying the behavior on a per-run basis. - type: - - string - - 'null' - 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 - - 'null' - additional_messages: - description: Adds additional messages to the thread before creating the run. - type: - - array - - 'null' - items: - $ref: '#/components/schemas/CreateMessageRequest' - tools: - description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. - type: - - array - - 'null' - maxItems: 20 - items: - $ref: '#/components/schemas/AssistantTool' - metadata: - $ref: '#/components/schemas/Metadata' - temperature: - type: - - number - - 'null' - minimum: 0 - maximum: 2 - default: 1 - example: 1 - 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. - top_p: - type: - - number - - 'null' - minimum: 0 - maximum: 1 - default: 1 - example: 1 - description: | - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - response_format: - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - nullable: true - max_prompt_tokens: - type: - - integer - - 'null' - 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 - - 'null' - 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: - allOf: - - $ref: '#/components/schemas/TruncationObject' - - nullable: true - tool_choice: - allOf: - - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' - - nullable: true - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - required: - - assistant_id - SubmitToolOutputsRunRequestWithoutStream: - 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. - required: - - tool_outputs - RunStatus: - description: The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - type: string - enum: - - queued - - in_progress - - requires_action - - cancelling - - cancelled - - failed - - completed - - incomplete - - expired - CodeInterpreterContainerAuto: - properties: - type: - type: string - enum: - - auto - description: Always `auto`. - default: auto - x-stainless-const: true - file_ids: - items: - type: string - example: file-123 - type: array - maxItems: 50 - description: An optional list of uploaded files to make available to your code. - memory_limit: - anyOf: - - $ref: '#/components/schemas/ContainerMemoryLimit' - description: The memory limit for the code interpreter container. - - type: 'null' - network_policy: - discriminator: - propertyName: type - description: Network access policy for the container. - anyOf: - - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' - - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' - type: object - required: - - type - title: CodeInterpreterToolAuto - description: Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on. - x-stainless-naming: - go: - type_name: ToolCodeInterpreterContainerCodeInterpreterContainerAuto - LiveFunctionToolChoiceParam: - type: object - properties: - type: - default: function - x-stainless-const: true - type: string - enum: - - function - name: - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - required: - - type - - name - LiveMCPToolChoiceParam: - type: object - properties: - type: - default: mcp - x-stainless-const: true - type: string - enum: - - mcp - server_label: - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - name: - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - required: - - type - - server_label - - name - RealtimeConnectDocumentationParams: - type: object - properties: - model: - type: string - call_id: - type: string - intent: - type: string - enum: - - realtime - - transcription - description: | - Selects the session type. Set `transcription` and omit `model` for a transcription session. If omitted, the session type from a client secret applies when present; otherwise the intent is `realtime`. - RealtimeClientEventResponseCreateWithReferencesParam: - type: object - description: "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history by default.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event includes inference configuration like \n`instructions` and `tools`. If these are set, they will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel. The `metadata` field is a good way to disambiguate\nmultiple simultaneous Responses.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n" - properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `response.create`. - const: response.create - response: - $ref: '#/components/schemas/RealtimeResponseCreateParams' - required: - - type - x-oaiMeta: - name: response.create - group: realtime - example: | - // Trigger a response with the default Conversation and no special parameters - { - "type": "response.create" - } - - // Trigger an out-of-band response that does not write to the default Conversation - { - "type": "response.create", - "response": { - "instructions": "Provide a concise answer.", - "tools": [], // clear any session tools - "conversation": "none", - "output_modalities": ["text"], - "metadata": { - "response_purpose": "summarization" - }, - "input": [ - { - "type": "item_reference", - "id": "item_12345" - }, - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Summarize the above message in one sentence." - } - ] - } - ] - } - } - RealtimeResponseCreateParamsWithReferencesParam: - type: object - description: Create a new Realtime response with these parameters - properties: - output_modalities: - type: array - description: | - The set of modalities the model used to respond, currently the only possible values are - `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the - output to mode `text` will disable audio output from the model. - items: - type: string - enum: - - text - - audio - instructions: - type: string - description: | - The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. - Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. - audio: - type: object - description: Configuration for audio input and output. - properties: - output: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - default: alloy - description: | - The voice the model uses to respond. Supported built-in voices are - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, - `marin`, and `cedar`. You may also provide a custom voice object with - an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed - during the session once the model has responded with audio at least once. - Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live. - We recommend `marin` and `cedar` for best quality. - tools: - type: array - description: Tools available to the model. - items: - anyOf: - - $ref: '#/components/schemas/RealtimeFunctionTool' - - $ref: '#/components/schemas/MCPTool' - tool_choice: - description: | - How the model chooses tools. Provide one of the string modes or force a specific - function/MCP tool. - default: auto - anyOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - parallel_tool_calls: - type: boolean - description: | - Whether the model may call multiple tools in parallel. Only supported by - reasoning Realtime models such as `gpt-realtime-2`. - reasoning: - $ref: '#/components/schemas/RealtimeReasoning' - max_output_tokens: - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - anyOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - conversation: - description: | - Controls which conversation the response is added to. Currently supports - `auto` and `none`, with `auto` as the default value. The `auto` value - means that the contents of the response will be added to the default - conversation. Set this to `none` to create an out-of-band response which - will not add items to default conversation. - anyOf: - - type: string - - type: string - default: auto - enum: - - auto - - none - metadata: - $ref: '#/components/schemas/Metadata' - prompt: - $ref: '#/components/schemas/Prompt' - input: - type: array - description: | - Input items to include in the prompt for the model. Using this field - creates a new context for this Response instead of using the default - conversation. An empty array `[]` will clear the context for this Response. - Note that this can include references to items that previously appeared in the session - using their id. - items: - $ref: '#/components/schemas/RealtimeConversationItem' - RealtimeResponseItemReference: - type: object - description: | - Reference an existing item in this Realtime session as response.create input. - Item references are only accepted in the response input array, not as new - conversation items. - properties: - type: - type: string - enum: - - item_reference - x-stainless-const: true - description: The type of this item. Always `item_reference`. - id: - type: string - minLength: 1 - maxLength: 32 - pattern: ^[a-zA-Z0-9_-]+$ - description: The ID of an existing item in the same Realtime session. - required: - - type - - id - RealtimeTranslationConnectParams: - type: object - properties: - model: - type: string - required: - - model + - gpt-6-astra + - gpt-6.1-sol + - gpt-6.1-terra + - gpt-6-sol + - gpt-6-luna + - gpt-5.6-sol + - gpt-5.6-terra + - gpt-5.6-luna + - gpt-5.5 + - gpt-5.5-2026-04-23 + - gpt-5.4 + - gpt-5.4-mini + - gpt-5.4-nano + - gpt-5.4-mini-2026-03-17 + - gpt-5.4-nano-2026-03-17 + - gpt-5.3-chat-latest + - gpt-5.2 + - gpt-5.2-2025-12-11 + - gpt-5.2-chat-latest + - gpt-5.2-pro + - gpt-5.2-pro-2025-12-11 + - gpt-5.1 + - gpt-5.1-2025-11-13 + - gpt-5.1-codex + - gpt-5.1-mini + - gpt-5.1-chat-latest + - gpt-5 + - gpt-5-mini + - gpt-5-nano + - gpt-5-2025-08-07 + - gpt-5-mini-2025-08-07 + - gpt-5-nano-2025-08-07 + - gpt-5-chat-latest + - gpt-4.1 + - gpt-4.1-mini + - gpt-4.1-nano + - gpt-4.1-2025-04-14 + - gpt-4.1-mini-2025-04-14 + - gpt-4.1-nano-2025-04-14 + - o4-mini + - o4-mini-2025-04-16 + - o3 + - o3-2025-04-16 + - o3-mini + - o3-mini-2025-01-31 + - o1 + - o1-2024-12-17 + - o1-preview + - o1-preview-2024-09-12 + - o1-mini + - o1-mini-2024-09-12 + - gpt-4o + - gpt-4o-2024-11-20 + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-audio-mini + - gpt-audio-mini-2025-12-15 + - gpt-4o-audio-preview + - gpt-4o-audio-preview-2024-10-01 + - gpt-4o-audio-preview-2024-12-17 + - gpt-4o-audio-preview-2025-06-03 + - gpt-4o-mini-audio-preview + - gpt-4o-mini-audio-preview-2024-12-17 + - gpt-4o-search-preview + - gpt-4o-mini-search-preview + - gpt-4o-search-preview-2025-03-11 + - gpt-4o-mini-search-preview-2025-03-11 + - chatgpt-4o-latest + - codex-mini-latest + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-vision-preview + - gpt-4 + - gpt-4-0314 + - gpt-4-0613 + - gpt-4-32k + - gpt-4-32k-0314 + - gpt-4-32k-0613 + - gpt-3.5-turbo + - gpt-3.5-turbo-16k + - gpt-3.5-turbo-0301 + - gpt-3.5-turbo-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + x-openai-enum-deprecations: + gpt-5.4-nano: + message: 'Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5.1: + message: 'Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5.1-2025-11-13: + message: 'Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5.4-nano-2026-03-17: + message: 'Announced shutdown date: 2027-04-01. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4.1-2025-04-14: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4.1: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4.1-mini: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4.1-mini-2025-04-14: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-2024-08-06: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-2024-11-20: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-mini: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-mini-2024-07-18: + message: 'Announced shutdown date: 2027-01-14. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5.3-chat-latest: + message: 'Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5.2-chat-latest: + message: 'Announced shutdown date: 2026-08-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5.1-codex: + message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5.1-chat-latest: + message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-2025-08-07: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-mini-2025-08-07: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-nano-2025-08-07: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-chat-latest: + message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4.1-nano: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4.1-nano-2025-04-14: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o4-mini: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o4-mini-2025-04-16: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o3-2025-04-16: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o3-mini: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o3-mini-2025-01-31: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o1: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o1-2024-12-17: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-2024-05-13: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-audio-mini: + message: 'Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-search-preview-2025-03-11: + message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-mini-search-preview-2025-03-11: + message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-turbo: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-turbo-2024-04-09: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-0125-preview: + message: 'Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-turbo-preview: + message: 'Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-1106-preview: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-0314: + message: 'Announced shutdown date: 2026-03-26. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-0613: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-3.5-turbo: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-3.5-turbo-1106: + message: 'Announced shutdown date: 2026-09-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-3.5-turbo-0125: + message: 'Announced shutdown date: 2026-10-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-3.5-turbo-0301: + message: 'Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-3.5-turbo-0613: + message: 'Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-3.5-turbo-16k: + message: 'Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-3.5-turbo-16k-0613: + message: 'Announced shutdown date: 2024-09-13. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-vision-preview: + message: 'Announced shutdown date: 2024-12-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-32k: + message: 'Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-32k-0314: + message: 'Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4-32k-0613: + message: 'Announced shutdown date: 2025-06-06. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o1-preview: + message: 'Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o1-preview-2024-09-12: + message: 'Announced shutdown date: 2025-07-28. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-audio-preview-2024-10-01: + message: 'Announced shutdown date: 2025-10-10. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o1-mini: + message: 'Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o1-mini-2024-09-12: + message: 'Announced shutdown date: 2025-10-27. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + codex-mini-latest: + message: 'Announced shutdown date: 2026-02-12. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + chatgpt-4o-latest: + message: 'Announced shutdown date: 2026-02-17. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-audio-preview: + message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-mini-audio-preview: + message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-audio-preview-2024-12-17: + message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-audio-preview-2025-06-03: + message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-mini-audio-preview-2024-12-17: + message: 'Announced shutdown date: 2026-05-07. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-search-preview: + message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-4o-mini-search-preview: + message: 'Announced shutdown date: 2026-07-23. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-mini: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5-nano: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + o3: + message: 'Announced shutdown date: 2026-12-11. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-audio-mini-2025-12-15: + message: 'Announced shutdown date: 2027-01-20. See https://developers.openai.com/api/docs/deprecations for details and recommended replacements.' + gpt-5.1-mini: + message: Not a supported model ID. Retained for SDK compatibility. + x-stainless-nominal: false responses: TooManyRequests: description: The request was rejected because a rate limit was exceeded. diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItem.kt index 7c39cf8d7..23747faa2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItem.kt @@ -6,6 +6,15 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openai.core.BaseDeserializer +import com.openai.core.BaseSerializer import com.openai.core.Enum import com.openai.core.ExcludeMissing import com.openai.core.JsonField @@ -13,6 +22,7 @@ import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties +import com.openai.core.getOrThrow import com.openai.errors.OpenAIInvalidDataException import java.util.Collections import java.util.Objects @@ -20,8 +30,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * A configuration update that applies to subsequent responses until it is replaced by another - * configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a later + * update replaces that setting. */ class BetaResponseConfigurationUpdateItem @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -30,6 +40,7 @@ private constructor( private val type: JsonValue, private val agent: JsonField, private val reasoning: JsonField, + private val text: JsonField, private val additionalProperties: MutableMap, ) { @@ -41,7 +52,8 @@ private constructor( @JsonProperty("reasoning") @ExcludeMissing reasoning: JsonField = JsonMissing.of(), - ) : this(id, type, agent, reasoning, mutableMapOf()) + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + ) : this(id, type, agent, reasoning, text, mutableMapOf()) /** * The unique ID of the configuration update item. @@ -80,6 +92,14 @@ private constructor( */ fun reasoning(): Optional = reasoning.getOptional("reasoning") + /** + * The text output configuration for subsequent responses. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + /** * Returns the raw JSON value of [id]. * @@ -101,6 +121,13 @@ private constructor( */ @JsonProperty("reasoning") @ExcludeMissing fun _reasoning(): JsonField = reasoning + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -121,6 +148,7 @@ private constructor( "type" to this.type, "agent" to this.agent, "reasoning" to this.reasoning, + "text" to this.text, ) /** @@ -158,6 +186,7 @@ private constructor( private var type: JsonValue = JsonValue.from("configuration_update") private var agent: JsonField = JsonMissing.of() private var reasoning: JsonField = JsonMissing.of() + private var text: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -168,6 +197,7 @@ private constructor( type = betaResponseConfigurationUpdateItem.type agent = betaResponseConfigurationUpdateItem.agent reasoning = betaResponseConfigurationUpdateItem.reasoning + text = betaResponseConfigurationUpdateItem.text additionalProperties = betaResponseConfigurationUpdateItem.additionalProperties.toMutableMap() } @@ -220,6 +250,31 @@ private constructor( */ fun reasoning(reasoning: JsonField) = apply { this.reasoning = reasoning } + /** The text output configuration for subsequent responses. */ + fun text(text: Text) = text(JsonField.of(text)) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [Text] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun text(text: JsonField) = apply { this.text = text } + + /** + * Alias for calling [text] with the following: + * ```java + * Text.builder() + * .format(format) + * .build() + * ``` + */ + fun formatText(format: Text.Format) = text(Text.builder().format(format).build()) + + /** Alias for calling [formatText] with `Text.Format.ofJsonSchema(jsonSchema)`. */ + fun formatText(jsonSchema: BetaResponseFormatTextJsonSchemaConfig) = + formatText(Text.Format.ofJsonSchema(jsonSchema)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -257,6 +312,7 @@ private constructor( type, agent, reasoning, + text, additionalProperties.toMutableMap(), ) } @@ -284,6 +340,7 @@ private constructor( } agent().ifPresent { it.validate() } reasoning().ifPresent { it.validate() } + text().ifPresent { it.validate() } validated = true } @@ -305,7 +362,8 @@ private constructor( (if (id.asKnown().isPresent) 1 else 0) + type.let { if (it == JsonValue.from("configuration_update")) 1 else 0 } + (agent.asKnown().getOrNull()?.validity() ?: 0) + - (reasoning.asKnown().getOrNull()?.validity() ?: 0) + (reasoning.asKnown().getOrNull()?.validity() ?: 0) + + (text.asKnown().getOrNull()?.validity() ?: 0) /** The agent that produced this item. */ class Agent @@ -842,6 +900,450 @@ private constructor( "Reasoning{effort=$effort, additionalProperties=$additionalProperties}" } + /** The text output configuration for subsequent responses. */ + class Text + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val format: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("format") @ExcludeMissing format: JsonField = JsonMissing.of() + ) : this(format, mutableMapOf()) + + /** + * Use a JSON schema for structured output or text to return to plain text. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun format(): Format = format.getRequired("format") + + /** + * Returns the raw JSON value of [format]. + * + * Unlike [format], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("format") @ExcludeMissing fun _format(): JsonField = format + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + /** + * Returns an immutable snapshot of all present JSON properties, including declared and + * additional properties. + * + * Keys use their JSON names. Declared properties take precedence over additional properties + * with the same name. Missing properties are omitted, while explicit nulls and unrecognized + * values are preserved. + */ + fun _allProperties(): Map = + collectAllProperties(additionalProperties, "format" to this.format) + + /** + * Returns the legacy additional-properties view. + * + * @deprecated Use [_allProperties] to access both declared and additional JSON properties. + * This accessor retains its legacy additional-properties behavior. + */ + @Deprecated("Use _allProperties() to access both declared and additional JSON properties.") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Text]. + * + * The following fields are required: + * ```java + * .format() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Text]. */ + class Builder internal constructor() { + + private var format: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(text: Text) = apply { + format = text.format + additionalProperties = text.additionalProperties.toMutableMap() + } + + /** Use a JSON schema for structured output or text to return to plain text. */ + fun format(format: Format) = format(JsonField.of(format)) + + /** + * Sets [Builder.format] to an arbitrary JSON value. + * + * You should usually call [Builder.format] with a well-typed [Format] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun format(format: JsonField) = apply { this.format = format } + + /** Alias for calling [format] with `Format.ofText()`. */ + fun formatText() = format(Format.ofText()) + + /** Alias for calling [format] with `Format.ofJsonSchema(jsonSchema)`. */ + fun format(jsonSchema: BetaResponseFormatTextJsonSchemaConfig) = + format(Format.ofJsonSchema(jsonSchema)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Text]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .format() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Text = + Text(checkRequired("format", format), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Text = apply { + if (validated) { + return@apply + } + + format().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (format.asKnown().getOrNull()?.validity() ?: 0) + + /** Use a JSON schema for structured output or text to return to plain text. */ + @JsonDeserialize(using = Format.Deserializer::class) + @JsonSerialize(using = Format.Serializer::class) + class Format + private constructor( + private val text: JsonValue? = null, + private val jsonSchema: BetaResponseFormatTextJsonSchemaConfig? = null, + private val _json: JsonValue? = null, + ) { + + /** Default response format. Used to generate text responses. */ + fun text(): Optional = Optional.ofNullable(text) + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn more + * about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun jsonSchema(): Optional = + Optional.ofNullable(jsonSchema) + + fun isText(): Boolean = text != null + + fun isJsonSchema(): Boolean = jsonSchema != null + + /** Default response format. Used to generate text responses. */ + fun asText(): JsonValue = text.getOrThrow("text") + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn more + * about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun asJsonSchema(): BetaResponseFormatTextJsonSchemaConfig = + jsonSchema.getOrThrow("jsonSchema") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = format.accept(new Format.Visitor>() { + * @Override + * public Optional visitText(JsonValue text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + text != null -> visitor.visitText(text) + jsonSchema != null -> visitor.visitJsonSchema(jsonSchema) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Format = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitText(text: JsonValue) { + text.let { + if (it != JsonValue.from(mapOf("type" to "text"))) { + throw OpenAIInvalidDataException( + "'text' is invalid, received $it" + ) + } + } + } + + override fun visitJsonSchema( + jsonSchema: BetaResponseFormatTextJsonSchemaConfig + ) { + jsonSchema.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitText(text: JsonValue) = + text.let { if (it == JsonValue.from(mapOf("type" to "text"))) 1 else 0 } + + override fun visitJsonSchema( + jsonSchema: BetaResponseFormatTextJsonSchemaConfig + ) = jsonSchema.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Format && + text == other.text && + jsonSchema == other.jsonSchema && + (text != null || jsonSchema != null || _json == other._json) + } + + override fun hashCode(): Int = + if (text == null && jsonSchema == null) Objects.hash(_json) + else Objects.hash(text, jsonSchema) + + override fun toString(): String = + when { + text != null -> "Format{text=$text}" + jsonSchema != null -> "Format{jsonSchema=$jsonSchema}" + _json != null -> "Format{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Format") + } + + companion object { + + /** Default response format. Used to generate text responses. */ + @JvmStatic fun ofText() = Format(text = JsonValue.from(mapOf("type" to "text"))) + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + @JvmStatic + fun ofJsonSchema(jsonSchema: BetaResponseFormatTextJsonSchemaConfig) = + Format(jsonSchema = jsonSchema) + } + + /** + * An interface that defines how to map each variant of [Format] to a value of type [T]. + */ + interface Visitor { + + /** Default response format. Used to generate text responses. */ + fun visitText(text: JsonValue): T + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun visitJsonSchema(jsonSchema: BetaResponseFormatTextJsonSchemaConfig): T + + /** + * Maps an unknown variant of [Format] to a value of type [T]. + * + * An instance of [Format] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw OpenAIInvalidDataException("Unknown Format") + } + } + + internal class Deserializer : BaseDeserializer(Format::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Format { + val json = JsonValue.fromJsonNode(node) + val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() + + when (type) { + "text" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Format(text = it, _json = json) } + ?.takeIf { it.isValid() } ?: Format(_json = json) + } + "json_schema" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Format(jsonSchema = it, _json = json) } + ?: Format(_json = json) + } + } + + return Format(_json = json) + } + } + + internal class Serializer : BaseSerializer(Format::class) { + + override fun serialize( + value: Format, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.text != null -> generator.writeObject(value.text) + value.jsonSchema != null -> generator.writeObject(value.jsonSchema) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Format") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Text && + format == other.format && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(format, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Text{format=$format, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -852,15 +1354,16 @@ private constructor( type == other.type && agent == other.agent && reasoning == other.reasoning && + text == other.text && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(id, type, agent, reasoning, additionalProperties) + Objects.hash(id, type, agent, reasoning, text, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "BetaResponseConfigurationUpdateItem{id=$id, type=$type, agent=$agent, reasoning=$reasoning, additionalProperties=$additionalProperties}" + "BetaResponseConfigurationUpdateItem{id=$id, type=$type, agent=$agent, reasoning=$reasoning, text=$text, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParam.kt index faaa0e079..2d68dc97c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParam.kt @@ -6,6 +6,15 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openai.core.BaseDeserializer +import com.openai.core.BaseSerializer import com.openai.core.Enum import com.openai.core.ExcludeMissing import com.openai.core.JsonField @@ -13,6 +22,7 @@ import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties +import com.openai.core.getOrThrow import com.openai.errors.OpenAIInvalidDataException import java.util.Collections import java.util.Objects @@ -20,8 +30,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * An update to the conversation's response configuration. The configuration remains in effect for - * subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. Each + * setting stays in effect until a later update replaces it. */ class BetaResponseConfigurationUpdateItemParam @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -30,6 +40,7 @@ private constructor( private val id: JsonField, private val agent: JsonField, private val reasoning: JsonField, + private val text: JsonField, private val additionalProperties: MutableMap, ) { @@ -41,7 +52,8 @@ private constructor( @JsonProperty("reasoning") @ExcludeMissing reasoning: JsonField = JsonMissing.of(), - ) : this(type, id, agent, reasoning, mutableMapOf()) + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + ) : this(type, id, agent, reasoning, text, mutableMapOf()) /** * The item type. Always `configuration_update`. @@ -80,6 +92,14 @@ private constructor( */ fun reasoning(): Optional = reasoning.getOptional("reasoning") + /** + * The text output configuration for subsequent responses. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + /** * Returns the raw JSON value of [id]. * @@ -101,6 +121,13 @@ private constructor( */ @JsonProperty("reasoning") @ExcludeMissing fun _reasoning(): JsonField = reasoning + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -121,6 +148,7 @@ private constructor( "id" to this.id, "agent" to this.agent, "reasoning" to this.reasoning, + "text" to this.text, ) /** @@ -153,6 +181,7 @@ private constructor( private var id: JsonField = JsonMissing.of() private var agent: JsonField = JsonMissing.of() private var reasoning: JsonField = JsonMissing.of() + private var text: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -163,6 +192,7 @@ private constructor( id = betaResponseConfigurationUpdateItemParam.id agent = betaResponseConfigurationUpdateItemParam.agent reasoning = betaResponseConfigurationUpdateItemParam.reasoning + text = betaResponseConfigurationUpdateItemParam.text additionalProperties = betaResponseConfigurationUpdateItemParam.additionalProperties.toMutableMap() } @@ -221,6 +251,31 @@ private constructor( */ fun reasoning(reasoning: JsonField) = apply { this.reasoning = reasoning } + /** The text output configuration for subsequent responses. */ + fun text(text: Text) = text(JsonField.of(text)) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [Text] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun text(text: JsonField) = apply { this.text = text } + + /** + * Alias for calling [text] with the following: + * ```java + * Text.builder() + * .format(format) + * .build() + * ``` + */ + fun formatText(format: Text.Format) = text(Text.builder().format(format).build()) + + /** Alias for calling [formatText] with `Text.Format.ofJsonSchema(jsonSchema)`. */ + fun formatText(jsonSchema: BetaResponseFormatTextJsonSchemaConfig) = + formatText(Text.Format.ofJsonSchema(jsonSchema)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -251,6 +306,7 @@ private constructor( id, agent, reasoning, + text, additionalProperties.toMutableMap(), ) } @@ -278,6 +334,7 @@ private constructor( id() agent().ifPresent { it.validate() } reasoning().ifPresent { it.validate() } + text().ifPresent { it.validate() } validated = true } @@ -299,7 +356,8 @@ private constructor( type.let { if (it == JsonValue.from("configuration_update")) 1 else 0 } + (if (id.asKnown().isPresent) 1 else 0) + (agent.asKnown().getOrNull()?.validity() ?: 0) + - (reasoning.asKnown().getOrNull()?.validity() ?: 0) + (reasoning.asKnown().getOrNull()?.validity() ?: 0) + + (text.asKnown().getOrNull()?.validity() ?: 0) /** The agent that produced this item. */ class Agent @@ -836,6 +894,450 @@ private constructor( "Reasoning{effort=$effort, additionalProperties=$additionalProperties}" } + /** The text output configuration for subsequent responses. */ + class Text + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val format: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("format") @ExcludeMissing format: JsonField = JsonMissing.of() + ) : this(format, mutableMapOf()) + + /** + * Use a JSON schema for structured output or text to return to plain text. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun format(): Format = format.getRequired("format") + + /** + * Returns the raw JSON value of [format]. + * + * Unlike [format], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("format") @ExcludeMissing fun _format(): JsonField = format + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + /** + * Returns an immutable snapshot of all present JSON properties, including declared and + * additional properties. + * + * Keys use their JSON names. Declared properties take precedence over additional properties + * with the same name. Missing properties are omitted, while explicit nulls and unrecognized + * values are preserved. + */ + fun _allProperties(): Map = + collectAllProperties(additionalProperties, "format" to this.format) + + /** + * Returns the legacy additional-properties view. + * + * @deprecated Use [_allProperties] to access both declared and additional JSON properties. + * This accessor retains its legacy additional-properties behavior. + */ + @Deprecated("Use _allProperties() to access both declared and additional JSON properties.") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Text]. + * + * The following fields are required: + * ```java + * .format() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Text]. */ + class Builder internal constructor() { + + private var format: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(text: Text) = apply { + format = text.format + additionalProperties = text.additionalProperties.toMutableMap() + } + + /** Use a JSON schema for structured output or text to return to plain text. */ + fun format(format: Format) = format(JsonField.of(format)) + + /** + * Sets [Builder.format] to an arbitrary JSON value. + * + * You should usually call [Builder.format] with a well-typed [Format] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun format(format: JsonField) = apply { this.format = format } + + /** Alias for calling [format] with `Format.ofText()`. */ + fun formatText() = format(Format.ofText()) + + /** Alias for calling [format] with `Format.ofJsonSchema(jsonSchema)`. */ + fun format(jsonSchema: BetaResponseFormatTextJsonSchemaConfig) = + format(Format.ofJsonSchema(jsonSchema)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Text]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .format() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Text = + Text(checkRequired("format", format), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Text = apply { + if (validated) { + return@apply + } + + format().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (format.asKnown().getOrNull()?.validity() ?: 0) + + /** Use a JSON schema for structured output or text to return to plain text. */ + @JsonDeserialize(using = Format.Deserializer::class) + @JsonSerialize(using = Format.Serializer::class) + class Format + private constructor( + private val text: JsonValue? = null, + private val jsonSchema: BetaResponseFormatTextJsonSchemaConfig? = null, + private val _json: JsonValue? = null, + ) { + + /** Default response format. Used to generate text responses. */ + fun text(): Optional = Optional.ofNullable(text) + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn more + * about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun jsonSchema(): Optional = + Optional.ofNullable(jsonSchema) + + fun isText(): Boolean = text != null + + fun isJsonSchema(): Boolean = jsonSchema != null + + /** Default response format. Used to generate text responses. */ + fun asText(): JsonValue = text.getOrThrow("text") + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn more + * about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun asJsonSchema(): BetaResponseFormatTextJsonSchemaConfig = + jsonSchema.getOrThrow("jsonSchema") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = format.accept(new Format.Visitor>() { + * @Override + * public Optional visitText(JsonValue text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + text != null -> visitor.visitText(text) + jsonSchema != null -> visitor.visitJsonSchema(jsonSchema) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Format = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitText(text: JsonValue) { + text.let { + if (it != JsonValue.from(mapOf("type" to "text"))) { + throw OpenAIInvalidDataException( + "'text' is invalid, received $it" + ) + } + } + } + + override fun visitJsonSchema( + jsonSchema: BetaResponseFormatTextJsonSchemaConfig + ) { + jsonSchema.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitText(text: JsonValue) = + text.let { if (it == JsonValue.from(mapOf("type" to "text"))) 1 else 0 } + + override fun visitJsonSchema( + jsonSchema: BetaResponseFormatTextJsonSchemaConfig + ) = jsonSchema.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Format && + text == other.text && + jsonSchema == other.jsonSchema && + (text != null || jsonSchema != null || _json == other._json) + } + + override fun hashCode(): Int = + if (text == null && jsonSchema == null) Objects.hash(_json) + else Objects.hash(text, jsonSchema) + + override fun toString(): String = + when { + text != null -> "Format{text=$text}" + jsonSchema != null -> "Format{jsonSchema=$jsonSchema}" + _json != null -> "Format{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Format") + } + + companion object { + + /** Default response format. Used to generate text responses. */ + @JvmStatic fun ofText() = Format(text = JsonValue.from(mapOf("type" to "text"))) + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + @JvmStatic + fun ofJsonSchema(jsonSchema: BetaResponseFormatTextJsonSchemaConfig) = + Format(jsonSchema = jsonSchema) + } + + /** + * An interface that defines how to map each variant of [Format] to a value of type [T]. + */ + interface Visitor { + + /** Default response format. Used to generate text responses. */ + fun visitText(text: JsonValue): T + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun visitJsonSchema(jsonSchema: BetaResponseFormatTextJsonSchemaConfig): T + + /** + * Maps an unknown variant of [Format] to a value of type [T]. + * + * An instance of [Format] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw OpenAIInvalidDataException("Unknown Format") + } + } + + internal class Deserializer : BaseDeserializer(Format::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Format { + val json = JsonValue.fromJsonNode(node) + val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() + + when (type) { + "text" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { Format(text = it, _json = json) } + ?.takeIf { it.isValid() } ?: Format(_json = json) + } + "json_schema" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Format(jsonSchema = it, _json = json) } + ?: Format(_json = json) + } + } + + return Format(_json = json) + } + } + + internal class Serializer : BaseSerializer(Format::class) { + + override fun serialize( + value: Format, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.text != null -> generator.writeObject(value.text) + value.jsonSchema != null -> generator.writeObject(value.jsonSchema) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Format") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Text && + format == other.format && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(format, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Text{format=$format, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -846,15 +1348,16 @@ private constructor( id == other.id && agent == other.agent && reasoning == other.reasoning && + text == other.text && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(type, id, agent, reasoning, additionalProperties) + Objects.hash(type, id, agent, reasoning, text, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "BetaResponseConfigurationUpdateItemParam{type=$type, id=$id, agent=$agent, reasoning=$reasoning, additionalProperties=$additionalProperties}" + "BetaResponseConfigurationUpdateItemParam{type=$type, id=$id, agent=$agent, reasoning=$reasoning, text=$text, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputItem.kt index 4b7dbdf59..1be94b608 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputItem.kt @@ -153,8 +153,8 @@ private constructor( fun additionalTools(): Optional = Optional.ofNullable(additionalTools) /** - * An update to the conversation's response configuration. The configuration remains in effect - * for subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. Each + * setting stays in effect until a later update replaces it. */ fun configurationUpdate(): Optional = Optional.ofNullable(configurationUpdate) @@ -376,8 +376,8 @@ private constructor( fun asAdditionalTools(): AdditionalTools = additionalTools.getOrThrow("additionalTools") /** - * An update to the conversation's response configuration. The configuration remains in effect - * for subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. Each + * setting stays in effect until a later update replaces it. */ fun asConfigurationUpdate(): BetaResponseConfigurationUpdateItemParam = configurationUpdate.getOrThrow("configurationUpdate") @@ -1144,8 +1144,8 @@ private constructor( BetaResponseInputItem(additionalTools = additionalTools) /** - * An update to the conversation's response configuration. The configuration remains in - * effect for subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. + * Each setting stays in effect until a later update replaces it. */ @JvmStatic fun ofConfigurationUpdate(configurationUpdate: BetaResponseConfigurationUpdateItemParam) = @@ -1327,8 +1327,8 @@ private constructor( fun visitAdditionalTools(additionalTools: AdditionalTools): T /** - * An update to the conversation's response configuration. The configuration remains in - * effect for subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. + * Each setting stays in effect until a later update replaces it. */ fun visitConfigurationUpdate( configurationUpdate: BetaResponseConfigurationUpdateItemParam diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt index f1de9f817..919330ec4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt @@ -136,8 +136,8 @@ private constructor( fun additionalTools(): Optional = Optional.ofNullable(additionalTools) /** - * A configuration update that applies to subsequent responses until it is replaced by another - * configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a later + * update replaces that setting. */ fun configurationUpdate(): Optional = Optional.ofNullable(configurationUpdate) @@ -334,8 +334,8 @@ private constructor( fun asAdditionalTools(): AdditionalTools = additionalTools.getOrThrow("additionalTools") /** - * A configuration update that applies to subsequent responses until it is replaced by another - * configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a later + * update replaces that setting. */ fun asConfigurationUpdate(): BetaResponseConfigurationUpdateItem = configurationUpdate.getOrThrow("configurationUpdate") @@ -1059,8 +1059,8 @@ private constructor( BetaResponseItem(additionalTools = additionalTools) /** - * A configuration update that applies to subsequent responses until it is replaced by - * another configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a + * later update replaces that setting. */ @JvmStatic fun ofConfigurationUpdate(configurationUpdate: BetaResponseConfigurationUpdateItem) = @@ -1217,8 +1217,8 @@ private constructor( fun visitAdditionalTools(additionalTools: AdditionalTools): T /** - * A configuration update that applies to subsequent responses until it is replaced by - * another configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a + * later update replaces that setting. */ fun visitConfigurationUpdate(configurationUpdate: BetaResponseConfigurationUpdateItem): T diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt index d92b2ad75..3358f4d47 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt @@ -154,8 +154,8 @@ private constructor( fun additionalTools(): Optional = Optional.ofNullable(additionalTools) /** - * A configuration update that applies to subsequent responses until it is replaced by another - * configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a later + * update replaces that setting. */ fun configurationUpdate(): Optional = Optional.ofNullable(configurationUpdate) @@ -330,8 +330,8 @@ private constructor( fun asAdditionalTools(): AdditionalTools = additionalTools.getOrThrow("additionalTools") /** - * A configuration update that applies to subsequent responses until it is replaced by another - * configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a later + * update replaces that setting. */ fun asConfigurationUpdate(): ResponseConfigurationUpdateItem = configurationUpdate.getOrThrow("configurationUpdate") @@ -968,8 +968,8 @@ private constructor( ConversationItem(additionalTools = additionalTools) /** - * A configuration update that applies to subsequent responses until it is replaced by - * another configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a + * later update replaces that setting. */ @JvmStatic fun ofConfigurationUpdate(configurationUpdate: ResponseConfigurationUpdateItem) = @@ -1113,8 +1113,8 @@ private constructor( fun visitAdditionalTools(additionalTools: AdditionalTools): T /** - * A configuration update that applies to subsequent responses until it is replaced by - * another configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a + * later update replaces that setting. */ fun visitConfigurationUpdate(configurationUpdate: ResponseConfigurationUpdateItem): T diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItem.kt index 8cc31f65a..de750d1e9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItem.kt @@ -6,22 +6,33 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openai.core.BaseDeserializer +import com.openai.core.BaseSerializer import com.openai.core.ExcludeMissing import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties +import com.openai.core.getOrThrow import com.openai.errors.OpenAIInvalidDataException import com.openai.models.ReasoningEffort +import com.openai.models.ResponseFormatText import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * A configuration update that applies to subsequent responses until it is replaced by another - * configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a later + * update replaces that setting. */ class ResponseConfigurationUpdateItem @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -29,6 +40,7 @@ private constructor( private val id: JsonField, private val type: JsonValue, private val reasoning: JsonField, + private val text: JsonField, private val additionalProperties: MutableMap, ) { @@ -39,7 +51,8 @@ private constructor( @JsonProperty("reasoning") @ExcludeMissing reasoning: JsonField = JsonMissing.of(), - ) : this(id, type, reasoning, mutableMapOf()) + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + ) : this(id, type, reasoning, text, mutableMapOf()) /** * The unique ID of the configuration update item. @@ -70,6 +83,14 @@ private constructor( */ fun reasoning(): Optional = reasoning.getOptional("reasoning") + /** + * The text output configuration for subsequent responses. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + /** * Returns the raw JSON value of [id]. * @@ -84,6 +105,13 @@ private constructor( */ @JsonProperty("reasoning") @ExcludeMissing fun _reasoning(): JsonField = reasoning + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -103,6 +131,7 @@ private constructor( "id" to this.id, "type" to this.type, "reasoning" to this.reasoning, + "text" to this.text, ) /** @@ -139,6 +168,7 @@ private constructor( private var id: JsonField? = null private var type: JsonValue = JsonValue.from("configuration_update") private var reasoning: JsonField = JsonMissing.of() + private var text: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -147,6 +177,7 @@ private constructor( id = responseConfigurationUpdateItem.id type = responseConfigurationUpdateItem.type reasoning = responseConfigurationUpdateItem.reasoning + text = responseConfigurationUpdateItem.text additionalProperties = responseConfigurationUpdateItem.additionalProperties.toMutableMap() } @@ -188,6 +219,34 @@ private constructor( */ fun reasoning(reasoning: JsonField) = apply { this.reasoning = reasoning } + /** The text output configuration for subsequent responses. */ + fun text(text: Text) = text(JsonField.of(text)) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [Text] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun text(text: JsonField) = apply { this.text = text } + + /** + * Alias for calling [text] with the following: + * ```java + * Text.builder() + * .format(format) + * .build() + * ``` + */ + fun formatText(format: Text.Format) = text(Text.builder().format(format).build()) + + /** Alias for calling [formatText] with `Text.Format.ofText(text)`. */ + fun formatText(text: ResponseFormatText) = formatText(Text.Format.ofText(text)) + + /** Alias for calling [formatText] with `Text.Format.ofJsonSchema(jsonSchema)`. */ + fun formatText(jsonSchema: ResponseFormatTextJsonSchemaConfig) = + formatText(Text.Format.ofJsonSchema(jsonSchema)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -224,6 +283,7 @@ private constructor( checkRequired("id", id), type, reasoning, + text, additionalProperties.toMutableMap(), ) } @@ -250,6 +310,7 @@ private constructor( } } reasoning().ifPresent { it.validate() } + text().ifPresent { it.validate() } validated = true } @@ -270,7 +331,8 @@ private constructor( internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + type.let { if (it == JsonValue.from("configuration_update")) 1 else 0 } + - (reasoning.asKnown().getOrNull()?.validity() ?: 0) + (reasoning.asKnown().getOrNull()?.validity() ?: 0) + + (text.asKnown().getOrNull()?.validity() ?: 0) /** The reasoning configuration applied by this update. */ class Reasoning @@ -450,6 +512,443 @@ private constructor( "Reasoning{effort=$effort, additionalProperties=$additionalProperties}" } + /** The text output configuration for subsequent responses. */ + class Text + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val format: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("format") @ExcludeMissing format: JsonField = JsonMissing.of() + ) : this(format, mutableMapOf()) + + /** + * Use a JSON schema for structured output or text to return to plain text. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun format(): Format = format.getRequired("format") + + /** + * Returns the raw JSON value of [format]. + * + * Unlike [format], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("format") @ExcludeMissing fun _format(): JsonField = format + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + /** + * Returns an immutable snapshot of all present JSON properties, including declared and + * additional properties. + * + * Keys use their JSON names. Declared properties take precedence over additional properties + * with the same name. Missing properties are omitted, while explicit nulls and unrecognized + * values are preserved. + */ + fun _allProperties(): Map = + collectAllProperties(additionalProperties, "format" to this.format) + + /** + * Returns the legacy additional-properties view. + * + * @deprecated Use [_allProperties] to access both declared and additional JSON properties. + * This accessor retains its legacy additional-properties behavior. + */ + @Deprecated("Use _allProperties() to access both declared and additional JSON properties.") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Text]. + * + * The following fields are required: + * ```java + * .format() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Text]. */ + class Builder internal constructor() { + + private var format: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(text: Text) = apply { + format = text.format + additionalProperties = text.additionalProperties.toMutableMap() + } + + /** Use a JSON schema for structured output or text to return to plain text. */ + fun format(format: Format) = format(JsonField.of(format)) + + /** + * Sets [Builder.format] to an arbitrary JSON value. + * + * You should usually call [Builder.format] with a well-typed [Format] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun format(format: JsonField) = apply { this.format = format } + + /** Alias for calling [format] with `Format.ofText(text)`. */ + fun format(text: ResponseFormatText) = format(Format.ofText(text)) + + /** Alias for calling [format] with `Format.ofJsonSchema(jsonSchema)`. */ + fun format(jsonSchema: ResponseFormatTextJsonSchemaConfig) = + format(Format.ofJsonSchema(jsonSchema)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Text]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .format() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Text = + Text(checkRequired("format", format), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Text = apply { + if (validated) { + return@apply + } + + format().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (format.asKnown().getOrNull()?.validity() ?: 0) + + /** Use a JSON schema for structured output or text to return to plain text. */ + @JsonDeserialize(using = Format.Deserializer::class) + @JsonSerialize(using = Format.Serializer::class) + class Format + private constructor( + private val text: ResponseFormatText? = null, + private val jsonSchema: ResponseFormatTextJsonSchemaConfig? = null, + private val _json: JsonValue? = null, + ) { + + /** Default response format. Used to generate text responses. */ + fun text(): Optional = Optional.ofNullable(text) + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn more + * about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun jsonSchema(): Optional = + Optional.ofNullable(jsonSchema) + + fun isText(): Boolean = text != null + + fun isJsonSchema(): Boolean = jsonSchema != null + + /** Default response format. Used to generate text responses. */ + fun asText(): ResponseFormatText = text.getOrThrow("text") + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn more + * about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun asJsonSchema(): ResponseFormatTextJsonSchemaConfig = + jsonSchema.getOrThrow("jsonSchema") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = format.accept(new Format.Visitor>() { + * @Override + * public Optional visitText(ResponseFormatText text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + text != null -> visitor.visitText(text) + jsonSchema != null -> visitor.visitJsonSchema(jsonSchema) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Format = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitText(text: ResponseFormatText) { + text.validate() + } + + override fun visitJsonSchema( + jsonSchema: ResponseFormatTextJsonSchemaConfig + ) { + jsonSchema.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitText(text: ResponseFormatText) = text.validity() + + override fun visitJsonSchema( + jsonSchema: ResponseFormatTextJsonSchemaConfig + ) = jsonSchema.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Format && + text == other.text && + jsonSchema == other.jsonSchema && + (text != null || jsonSchema != null || _json == other._json) + } + + override fun hashCode(): Int = + if (text == null && jsonSchema == null) Objects.hash(_json) + else Objects.hash(text, jsonSchema) + + override fun toString(): String = + when { + text != null -> "Format{text=$text}" + jsonSchema != null -> "Format{jsonSchema=$jsonSchema}" + _json != null -> "Format{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Format") + } + + companion object { + + /** Default response format. Used to generate text responses. */ + @JvmStatic fun ofText(text: ResponseFormatText) = Format(text = text) + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + @JvmStatic + fun ofJsonSchema(jsonSchema: ResponseFormatTextJsonSchemaConfig) = + Format(jsonSchema = jsonSchema) + } + + /** + * An interface that defines how to map each variant of [Format] to a value of type [T]. + */ + interface Visitor { + + /** Default response format. Used to generate text responses. */ + fun visitText(text: ResponseFormatText): T + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun visitJsonSchema(jsonSchema: ResponseFormatTextJsonSchemaConfig): T + + /** + * Maps an unknown variant of [Format] to a value of type [T]. + * + * An instance of [Format] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw OpenAIInvalidDataException("Unknown Format") + } + } + + internal class Deserializer : BaseDeserializer(Format::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Format { + val json = JsonValue.fromJsonNode(node) + val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() + + when (type) { + "text" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + Format(text = it, _json = json) + } ?: Format(_json = json) + } + "json_schema" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Format(jsonSchema = it, _json = json) } + ?: Format(_json = json) + } + } + + return Format(_json = json) + } + } + + internal class Serializer : BaseSerializer(Format::class) { + + override fun serialize( + value: Format, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.text != null -> generator.writeObject(value.text) + value.jsonSchema != null -> generator.writeObject(value.jsonSchema) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Format") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Text && + format == other.format && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(format, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Text{format=$format, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -459,13 +958,16 @@ private constructor( id == other.id && type == other.type && reasoning == other.reasoning && + text == other.text && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(id, type, reasoning, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(id, type, reasoning, text, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "ResponseConfigurationUpdateItem{id=$id, type=$type, reasoning=$reasoning, additionalProperties=$additionalProperties}" + "ResponseConfigurationUpdateItem{id=$id, type=$type, reasoning=$reasoning, text=$text, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParam.kt index 6f86df08a..17de20a71 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParam.kt @@ -6,21 +6,33 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openai.core.BaseDeserializer +import com.openai.core.BaseSerializer import com.openai.core.ExcludeMissing import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue +import com.openai.core.checkRequired import com.openai.core.collectAllProperties +import com.openai.core.getOrThrow import com.openai.errors.OpenAIInvalidDataException import com.openai.models.ReasoningEffort +import com.openai.models.ResponseFormatText import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * An update to the conversation's response configuration. The configuration remains in effect for - * subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. Each + * setting stays in effect until a later update replaces it. */ class ResponseConfigurationUpdateItemParam @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -28,6 +40,7 @@ private constructor( private val type: JsonValue, private val id: JsonField, private val reasoning: JsonField, + private val text: JsonField, private val additionalProperties: MutableMap, ) { @@ -38,7 +51,8 @@ private constructor( @JsonProperty("reasoning") @ExcludeMissing reasoning: JsonField = JsonMissing.of(), - ) : this(type, id, reasoning, mutableMapOf()) + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + ) : this(type, id, reasoning, text, mutableMapOf()) /** * The item type. Always `configuration_update`. @@ -69,6 +83,14 @@ private constructor( */ fun reasoning(): Optional = reasoning.getOptional("reasoning") + /** + * The text output configuration for subsequent responses. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + /** * Returns the raw JSON value of [id]. * @@ -83,6 +105,13 @@ private constructor( */ @JsonProperty("reasoning") @ExcludeMissing fun _reasoning(): JsonField = reasoning + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -102,6 +131,7 @@ private constructor( "type" to this.type, "id" to this.id, "reasoning" to this.reasoning, + "text" to this.text, ) /** @@ -133,6 +163,7 @@ private constructor( private var type: JsonValue = JsonValue.from("configuration_update") private var id: JsonField = JsonMissing.of() private var reasoning: JsonField = JsonMissing.of() + private var text: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -142,6 +173,7 @@ private constructor( type = responseConfigurationUpdateItemParam.type id = responseConfigurationUpdateItemParam.id reasoning = responseConfigurationUpdateItemParam.reasoning + text = responseConfigurationUpdateItemParam.text additionalProperties = responseConfigurationUpdateItemParam.additionalProperties.toMutableMap() } @@ -186,6 +218,34 @@ private constructor( */ fun reasoning(reasoning: JsonField) = apply { this.reasoning = reasoning } + /** The text output configuration for subsequent responses. */ + fun text(text: Text) = text(JsonField.of(text)) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [Text] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun text(text: JsonField) = apply { this.text = text } + + /** + * Alias for calling [text] with the following: + * ```java + * Text.builder() + * .format(format) + * .build() + * ``` + */ + fun formatText(format: Text.Format) = text(Text.builder().format(format).build()) + + /** Alias for calling [formatText] with `Text.Format.ofText(text)`. */ + fun formatText(text: ResponseFormatText) = formatText(Text.Format.ofText(text)) + + /** Alias for calling [formatText] with `Text.Format.ofJsonSchema(jsonSchema)`. */ + fun formatText(jsonSchema: ResponseFormatTextJsonSchemaConfig) = + formatText(Text.Format.ofJsonSchema(jsonSchema)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -215,6 +275,7 @@ private constructor( type, id, reasoning, + text, additionalProperties.toMutableMap(), ) } @@ -241,6 +302,7 @@ private constructor( } id() reasoning().ifPresent { it.validate() } + text().ifPresent { it.validate() } validated = true } @@ -261,7 +323,8 @@ private constructor( internal fun validity(): Int = type.let { if (it == JsonValue.from("configuration_update")) 1 else 0 } + (if (id.asKnown().isPresent) 1 else 0) + - (reasoning.asKnown().getOrNull()?.validity() ?: 0) + (reasoning.asKnown().getOrNull()?.validity() ?: 0) + + (text.asKnown().getOrNull()?.validity() ?: 0) /** Updates to reasoning configuration. Only effort is supported. */ class Reasoning @@ -441,6 +504,443 @@ private constructor( "Reasoning{effort=$effort, additionalProperties=$additionalProperties}" } + /** The text output configuration for subsequent responses. */ + class Text + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val format: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("format") @ExcludeMissing format: JsonField = JsonMissing.of() + ) : this(format, mutableMapOf()) + + /** + * Use a JSON schema for structured output or text to return to plain text. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun format(): Format = format.getRequired("format") + + /** + * Returns the raw JSON value of [format]. + * + * Unlike [format], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("format") @ExcludeMissing fun _format(): JsonField = format + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + /** + * Returns an immutable snapshot of all present JSON properties, including declared and + * additional properties. + * + * Keys use their JSON names. Declared properties take precedence over additional properties + * with the same name. Missing properties are omitted, while explicit nulls and unrecognized + * values are preserved. + */ + fun _allProperties(): Map = + collectAllProperties(additionalProperties, "format" to this.format) + + /** + * Returns the legacy additional-properties view. + * + * @deprecated Use [_allProperties] to access both declared and additional JSON properties. + * This accessor retains its legacy additional-properties behavior. + */ + @Deprecated("Use _allProperties() to access both declared and additional JSON properties.") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Text]. + * + * The following fields are required: + * ```java + * .format() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Text]. */ + class Builder internal constructor() { + + private var format: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(text: Text) = apply { + format = text.format + additionalProperties = text.additionalProperties.toMutableMap() + } + + /** Use a JSON schema for structured output or text to return to plain text. */ + fun format(format: Format) = format(JsonField.of(format)) + + /** + * Sets [Builder.format] to an arbitrary JSON value. + * + * You should usually call [Builder.format] with a well-typed [Format] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun format(format: JsonField) = apply { this.format = format } + + /** Alias for calling [format] with `Format.ofText(text)`. */ + fun format(text: ResponseFormatText) = format(Format.ofText(text)) + + /** Alias for calling [format] with `Format.ofJsonSchema(jsonSchema)`. */ + fun format(jsonSchema: ResponseFormatTextJsonSchemaConfig) = + format(Format.ofJsonSchema(jsonSchema)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Text]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .format() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Text = + Text(checkRequired("format", format), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Text = apply { + if (validated) { + return@apply + } + + format().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (format.asKnown().getOrNull()?.validity() ?: 0) + + /** Use a JSON schema for structured output or text to return to plain text. */ + @JsonDeserialize(using = Format.Deserializer::class) + @JsonSerialize(using = Format.Serializer::class) + class Format + private constructor( + private val text: ResponseFormatText? = null, + private val jsonSchema: ResponseFormatTextJsonSchemaConfig? = null, + private val _json: JsonValue? = null, + ) { + + /** Default response format. Used to generate text responses. */ + fun text(): Optional = Optional.ofNullable(text) + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn more + * about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun jsonSchema(): Optional = + Optional.ofNullable(jsonSchema) + + fun isText(): Boolean = text != null + + fun isJsonSchema(): Boolean = jsonSchema != null + + /** Default response format. Used to generate text responses. */ + fun asText(): ResponseFormatText = text.getOrThrow("text") + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn more + * about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun asJsonSchema(): ResponseFormatTextJsonSchemaConfig = + jsonSchema.getOrThrow("jsonSchema") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.openai.core.JsonValue; + * import java.util.Optional; + * + * Optional result = format.accept(new Format.Visitor>() { + * @Override + * public Optional visitText(ResponseFormatText text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + text != null -> visitor.visitText(text) + jsonSchema != null -> visitor.visitJsonSchema(jsonSchema) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Format = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitText(text: ResponseFormatText) { + text.validate() + } + + override fun visitJsonSchema( + jsonSchema: ResponseFormatTextJsonSchemaConfig + ) { + jsonSchema.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitText(text: ResponseFormatText) = text.validity() + + override fun visitJsonSchema( + jsonSchema: ResponseFormatTextJsonSchemaConfig + ) = jsonSchema.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Format && + text == other.text && + jsonSchema == other.jsonSchema && + (text != null || jsonSchema != null || _json == other._json) + } + + override fun hashCode(): Int = + if (text == null && jsonSchema == null) Objects.hash(_json) + else Objects.hash(text, jsonSchema) + + override fun toString(): String = + when { + text != null -> "Format{text=$text}" + jsonSchema != null -> "Format{jsonSchema=$jsonSchema}" + _json != null -> "Format{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Format") + } + + companion object { + + /** Default response format. Used to generate text responses. */ + @JvmStatic fun ofText(text: ResponseFormatText) = Format(text = text) + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + @JvmStatic + fun ofJsonSchema(jsonSchema: ResponseFormatTextJsonSchemaConfig) = + Format(jsonSchema = jsonSchema) + } + + /** + * An interface that defines how to map each variant of [Format] to a value of type [T]. + */ + interface Visitor { + + /** Default response format. Used to generate text responses. */ + fun visitText(text: ResponseFormatText): T + + /** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + */ + fun visitJsonSchema(jsonSchema: ResponseFormatTextJsonSchemaConfig): T + + /** + * Maps an unknown variant of [Format] to a value of type [T]. + * + * An instance of [Format] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws OpenAIInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw OpenAIInvalidDataException("Unknown Format") + } + } + + internal class Deserializer : BaseDeserializer(Format::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Format { + val json = JsonValue.fromJsonNode(node) + val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() + + when (type) { + "text" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + Format(text = it, _json = json) + } ?: Format(_json = json) + } + "json_schema" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Format(jsonSchema = it, _json = json) } + ?: Format(_json = json) + } + } + + return Format(_json = json) + } + } + + internal class Serializer : BaseSerializer(Format::class) { + + override fun serialize( + value: Format, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.text != null -> generator.writeObject(value.text) + value.jsonSchema != null -> generator.writeObject(value.jsonSchema) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Format") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Text && + format == other.format && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(format, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Text{format=$format, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -450,13 +950,16 @@ private constructor( type == other.type && id == other.id && reasoning == other.reasoning && + text == other.text && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(type, id, reasoning, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(type, id, reasoning, text, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "ResponseConfigurationUpdateItemParam{type=$type, id=$id, reasoning=$reasoning, additionalProperties=$additionalProperties}" + "ResponseConfigurationUpdateItemParam{type=$type, id=$id, reasoning=$reasoning, text=$text, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt index b3c117361..1c908c186 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt @@ -139,8 +139,8 @@ private constructor( fun additionalTools(): Optional = Optional.ofNullable(additionalTools) /** - * An update to the conversation's response configuration. The configuration remains in effect - * for subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. Each + * setting stays in effect until a later update replaces it. */ fun configurationUpdate(): Optional = Optional.ofNullable(configurationUpdate) @@ -346,8 +346,8 @@ private constructor( fun asAdditionalTools(): AdditionalTools = additionalTools.getOrThrow("additionalTools") /** - * An update to the conversation's response configuration. The configuration remains in effect - * for subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. Each + * setting stays in effect until a later update replaces it. */ fun asConfigurationUpdate(): ResponseConfigurationUpdateItemParam = configurationUpdate.getOrThrow("configurationUpdate") @@ -1074,8 +1074,8 @@ private constructor( ResponseInputItem(additionalTools = additionalTools) /** - * An update to the conversation's response configuration. The configuration remains in - * effect for subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. + * Each setting stays in effect until a later update replaces it. */ @JvmStatic fun ofConfigurationUpdate(configurationUpdate: ResponseConfigurationUpdateItemParam) = @@ -1254,8 +1254,8 @@ private constructor( fun visitAdditionalTools(additionalTools: AdditionalTools): T /** - * An update to the conversation's response configuration. The configuration remains in - * effect for subsequent responses until it is replaced by another configuration update. + * An update to the conversation's response configuration. Supply reasoning, text, or both. + * Each setting stays in effect until a later update replaces it. */ fun visitConfigurationUpdate(configurationUpdate: ResponseConfigurationUpdateItemParam): T diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt index cdf9f3422..e3e6b77f2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt @@ -120,8 +120,8 @@ private constructor( fun additionalTools(): Optional = Optional.ofNullable(additionalTools) /** - * A configuration update that applies to subsequent responses until it is replaced by another - * configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a later + * update replaces that setting. */ fun configurationUpdate(): Optional = Optional.ofNullable(configurationUpdate) @@ -302,8 +302,8 @@ private constructor( fun asAdditionalTools(): AdditionalTools = additionalTools.getOrThrow("additionalTools") /** - * A configuration update that applies to subsequent responses until it is replaced by another - * configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a later + * update replaces that setting. */ fun asConfigurationUpdate(): ResponseConfigurationUpdateItem = configurationUpdate.getOrThrow("configurationUpdate") @@ -965,8 +965,8 @@ private constructor( ResponseItem(additionalTools = additionalTools) /** - * A configuration update that applies to subsequent responses until it is replaced by - * another configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a + * later update replaces that setting. */ @JvmStatic fun ofConfigurationUpdate(configurationUpdate: ResponseConfigurationUpdateItem) = @@ -1111,8 +1111,8 @@ private constructor( fun visitAdditionalTools(additionalTools: AdditionalTools): T /** - * A configuration update that applies to subsequent responses until it is replaced by - * another configuration update. + * A configuration update for subsequent responses. Each setting stays in effect until a + * later update replaces that setting. */ fun visitConfigurationUpdate(configurationUpdate: ResponseConfigurationUpdateItem): T diff --git a/openai-java-core/src/test/kotlin/com/openai/core/ResponseConfigurationUpdateFormatTest.kt b/openai-java-core/src/test/kotlin/com/openai/core/ResponseConfigurationUpdateFormatTest.kt new file mode 100644 index 000000000..03a2f0b58 --- /dev/null +++ b/openai-java-core/src/test/kotlin/com/openai/core/ResponseConfigurationUpdateFormatTest.kt @@ -0,0 +1,46 @@ +package com.openai.core + +import com.fasterxml.jackson.databind.JsonNode +import com.openai.models.beta.responses.BetaResponseConfigurationUpdateItem +import com.openai.models.beta.responses.BetaResponseConfigurationUpdateItemParam +import com.openai.models.responses.ResponseConfigurationUpdateItem +import com.openai.models.responses.ResponseConfigurationUpdateItemParam +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ValueSource + +internal class ResponseConfigurationUpdateFormatTest { + @ParameterizedTest + @ValueSource( + strings = + [ + """{"type":"text"}""", + """{"type":"json_schema","name":"answer","schema":{"type":"object"}}""", + """{"type":"future_format","name":"answer","schema":{},"extra":[1,true]}""", + ] + ) + fun dispatchesByTypeAndPreservesUnknownFormats(json: String) { + val mapper = jsonMapper() + val expected = mapper.readTree(json) + val type = expected["type"].asText() + + fun checkFormat(format: Any, isText: Boolean, isJsonSchema: Boolean) { + assertThat(isText).isEqualTo(type == "text") + assertThat(isJsonSchema).isEqualTo(type == "json_schema") + assertThat(mapper.valueToTree(format)).isEqualTo(expected) + } + + mapper.readValue(json, ResponseConfigurationUpdateItem.Text.Format::class.java).run { + checkFormat(this, isText(), isJsonSchema()) + } + mapper.readValue(json, ResponseConfigurationUpdateItemParam.Text.Format::class.java).run { + checkFormat(this, isText(), isJsonSchema()) + } + mapper.readValue(json, BetaResponseConfigurationUpdateItem.Text.Format::class.java).run { + checkFormat(this, isText(), isJsonSchema()) + } + mapper + .readValue(json, BetaResponseConfigurationUpdateItemParam.Text.Format::class.java) + .run { checkFormat(this, isText(), isJsonSchema()) } + } +} diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParamTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParamTest.kt index 9255940ba..d192c1ec5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParamTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParamTest.kt @@ -24,6 +24,7 @@ internal class BetaResponseConfigurationUpdateItemParamTest { .effort(BetaResponseConfigurationUpdateItemParam.Reasoning.Effort.NONE) .build() ) + .text(BetaResponseConfigurationUpdateItemParam.Text.builder().formatText().build()) .build() assertThat(betaResponseConfigurationUpdateItemParam.id()).contains("cnfu_123") @@ -39,6 +40,8 @@ internal class BetaResponseConfigurationUpdateItemParamTest { .effort(BetaResponseConfigurationUpdateItemParam.Reasoning.Effort.NONE) .build() ) + assertThat(betaResponseConfigurationUpdateItemParam.text()) + .contains(BetaResponseConfigurationUpdateItemParam.Text.builder().formatText().build()) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemTest.kt index 27b177fef..cd8449d26 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemTest.kt @@ -24,6 +24,7 @@ internal class BetaResponseConfigurationUpdateItemTest { .effort(BetaResponseConfigurationUpdateItem.Reasoning.Effort.NONE) .build() ) + .text(BetaResponseConfigurationUpdateItem.Text.builder().formatText().build()) .build() assertThat(betaResponseConfigurationUpdateItem.id()).isEqualTo("cnfu_123") @@ -37,6 +38,8 @@ internal class BetaResponseConfigurationUpdateItemTest { .effort(BetaResponseConfigurationUpdateItem.Reasoning.Effort.NONE) .build() ) + assertThat(betaResponseConfigurationUpdateItem.text()) + .contains(BetaResponseConfigurationUpdateItem.Text.builder().formatText().build()) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt index fae4bc144..006927dcd 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt @@ -1544,6 +1544,7 @@ internal class BetaResponseInputItemTest { .effort(BetaResponseConfigurationUpdateItemParam.Reasoning.Effort.NONE) .build() ) + .text(BetaResponseConfigurationUpdateItemParam.Text.builder().formatText().build()) .build() val betaResponseInputItem = BetaResponseInputItem.ofConfigurationUpdate(configurationUpdate) @@ -1603,6 +1604,9 @@ internal class BetaResponseInputItemTest { .effort(BetaResponseConfigurationUpdateItemParam.Reasoning.Effort.NONE) .build() ) + .text( + BetaResponseConfigurationUpdateItemParam.Text.builder().formatText().build() + ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt index 7e64a1e75..0396af137 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt @@ -1447,6 +1447,7 @@ internal class BetaResponseItemTest { .effort(BetaResponseConfigurationUpdateItem.Reasoning.Effort.NONE) .build() ) + .text(BetaResponseConfigurationUpdateItem.Text.builder().formatText().build()) .build() val betaResponseItem = BetaResponseItem.ofConfigurationUpdate(configurationUpdate) @@ -1503,6 +1504,7 @@ internal class BetaResponseItemTest { .effort(BetaResponseConfigurationUpdateItem.Reasoning.Effort.NONE) .build() ) + .text(BetaResponseConfigurationUpdateItem.Text.builder().formatText().build()) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt index 69d142b66..ab236267e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt @@ -8,6 +8,7 @@ import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.ReasoningEffort +import com.openai.models.ResponseFormatText import com.openai.models.conversations.Message import com.openai.models.responses.ComputerAction import com.openai.models.responses.FunctionTool @@ -1048,6 +1049,11 @@ internal class ConversationItemTest { .effort(ReasoningEffort.NONE) .build() ) + .text( + ResponseConfigurationUpdateItem.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) .build() val conversationItem = ConversationItem.ofConfigurationUpdate(configurationUpdate) @@ -1095,6 +1101,11 @@ internal class ConversationItemTest { .effort(ReasoningEffort.NONE) .build() ) + .text( + ResponseConfigurationUpdateItem.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParamTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParamTest.kt index 926bf2a4f..0d8b73c45 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParamTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParamTest.kt @@ -5,6 +5,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper import com.openai.models.ReasoningEffort +import com.openai.models.ResponseFormatText import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,6 +21,11 @@ internal class ResponseConfigurationUpdateItemParamTest { .effort(ReasoningEffort.NONE) .build() ) + .text( + ResponseConfigurationUpdateItemParam.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) .build() assertThat(responseConfigurationUpdateItemParam.id()).contains("cnfu_123") @@ -29,6 +35,12 @@ internal class ResponseConfigurationUpdateItemParamTest { .effort(ReasoningEffort.NONE) .build() ) + assertThat(responseConfigurationUpdateItemParam.text()) + .contains( + ResponseConfigurationUpdateItemParam.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemTest.kt index fc00694c1..74a34e0e8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemTest.kt @@ -5,6 +5,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper import com.openai.models.ReasoningEffort +import com.openai.models.ResponseFormatText import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,6 +21,11 @@ internal class ResponseConfigurationUpdateItemTest { .effort(ReasoningEffort.NONE) .build() ) + .text( + ResponseConfigurationUpdateItem.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) .build() assertThat(responseConfigurationUpdateItem.id()).isEqualTo("cnfu_123") @@ -29,6 +35,12 @@ internal class ResponseConfigurationUpdateItemTest { .effort(ReasoningEffort.NONE) .build() ) + assertThat(responseConfigurationUpdateItem.text()) + .contains( + ResponseConfigurationUpdateItem.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt index cf2939b75..e315411d0 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt @@ -8,6 +8,7 @@ import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.ReasoningEffort +import com.openai.models.ResponseFormatText import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -1124,6 +1125,11 @@ internal class ResponseInputItemTest { .effort(ReasoningEffort.NONE) .build() ) + .text( + ResponseConfigurationUpdateItemParam.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) .build() val responseInputItem = ResponseInputItem.ofConfigurationUpdate(configurationUpdate) @@ -1175,6 +1181,11 @@ internal class ResponseInputItemTest { .effort(ReasoningEffort.NONE) .build() ) + .text( + ResponseConfigurationUpdateItemParam.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt index a473f2c10..ef88b5ed2 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt @@ -8,6 +8,7 @@ import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.ReasoningEffort +import com.openai.models.ResponseFormatText import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -1034,6 +1035,11 @@ internal class ResponseItemTest { .effort(ReasoningEffort.NONE) .build() ) + .text( + ResponseConfigurationUpdateItem.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) .build() val responseItem = ResponseItem.ofConfigurationUpdate(configurationUpdate) @@ -1082,6 +1088,11 @@ internal class ResponseItemTest { .effort(ReasoningEffort.NONE) .build() ) + .text( + ResponseConfigurationUpdateItem.Text.builder() + .format(ResponseFormatText.builder().build()) + .build() + ) .build() ) diff --git a/scripts/castiron/generated-files.json b/scripts/castiron/generated-files.json index 05330e7f0..046b3d132 100644 --- a/scripts/castiron/generated-files.json +++ b/scripts/castiron/generated-files.json @@ -2763,11 +2763,11 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItem.kt": { "mode": "100644", - "sha256": "b606ba1b21c4046f0016155fd917e91886a2f920e0b44739a9dd02bde9194a53" + "sha256": "6094ff989abead782f33e39d09908f1d72107f34e5cc80f9f3bc0cecb5be148b" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParam.kt": { "mode": "100644", - "sha256": "ae3c1b7fd1d48c199461e581cf62850ef0c4125df0b99cfeba103600f2c79033" + "sha256": "f889658061b144fc73d60551c919a97684db518f8bc26b7a6b95406a6ebe49f7" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseContainerReference.kt": { "mode": "100644", @@ -2959,7 +2959,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputItem.kt": { "mode": "100644", - "sha256": "86748a47c4c95565de8c548fb1200d8a0373d9ac368a10ecea5222aec45ee987" + "sha256": "e82e464c1754166505087b57463a7532b1db5bbf0b12d0ad0a27ef64f550b232" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputMessageItem.kt": { "mode": "100644", @@ -2975,7 +2975,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt": { "mode": "100644", - "sha256": "dce8fd67b50087e05baa735bfca06a9179ded4360267e08c63d557b97570008c" + "sha256": "4fa723a579c331911bf33e18ebd67f649fa063448c60ccc0c5c3a4ad455b616d" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseLocalEnvironment.kt": { "mode": "100644", @@ -3979,7 +3979,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt": { "mode": "100644", - "sha256": "226259601cf7a36fa7613888c5e237e55cf349a78fa2ea1c99a4da31d16a5dea" + "sha256": "7c35f3dc863b942434d61f13d9e84564c9b5a6ecf60a918aebf417cf6b47708c" }, "openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt": { "mode": "100644", @@ -5591,11 +5591,11 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItem.kt": { "mode": "100644", - "sha256": "d300efa7492b0de461264f16368bb7c0f432aea966ef2f930c33ddcf1e259964" + "sha256": "ec5c9f2a6c280413650f2dacd21e9bbf3b23d9fd5c3fe9feb78dd8a23307723b" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParam.kt": { "mode": "100644", - "sha256": "4ca9c5a023a60ee59ac4f66ef1d9949d36af7b31bbe381acef2dfaa4b44d7904" + "sha256": "e044b14fbc7820620011182364a69155e71a0ef861135c8a97e4696e4b3ce30d" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContainerReference.kt": { "mode": "100644", @@ -5783,7 +5783,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt": { "mode": "100644", - "sha256": "a73116467457869574b0bd1575aaadeb8130a3f9ea3097ec7580a28ca67a8743" + "sha256": "910c52963f99856bae09b5413e0e82e89b3f0e5d918a2fcc234a18ed38a180c2" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt": { "mode": "100644", @@ -5799,7 +5799,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt": { "mode": "100644", - "sha256": "83342a4dcd03456a957efcc873e02f4cfb4a07fefb90c96354ba0f011509931d" + "sha256": "eb8f7412c56f8a3402c65829ef4ea7f3ed40cd39c88b3dcf99f25abb72750681" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseLocalEnvironment.kt": { "mode": "100644", @@ -10999,11 +10999,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemParamTest.kt": { "mode": "100644", - "sha256": "9a5de1ec1329aee86249be5034095041450f6c177db3d250a51a788e16735b80" + "sha256": "695be774e606ef3fb4035491b0d3d38d8de4972d74f75895fd5eedd0fadfd73f" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConfigurationUpdateItemTest.kt": { "mode": "100644", - "sha256": "f13ff616a8e9fdd2bd83d517854d56cc8b936dd732c4beea11d1d0bc74467854" + "sha256": "3d6054334b36f105bd4b11a565fc3f9a0ecf5fe3eff94ae98ee09d5e5d6c3949" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseContainerReferenceTest.kt": { "mode": "100644", @@ -11191,7 +11191,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt": { "mode": "100644", - "sha256": "94b2c2194d61f6ad240768cdb8eddf59fbec3752463db9d4b6e55b29d60c0084" + "sha256": "77452e50945a6491cea0a781c4e01fb5a011a3bb8c4af7a41652b6364f8a4cde" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputMessageItemTest.kt": { "mode": "100644", @@ -11207,7 +11207,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt": { "mode": "100644", - "sha256": "194a5f0950d469baa6973e55f4f225616d4f7edf59321d5ecd73adab9531ebff" + "sha256": "78c6dec1e0f8c267220be67d94066ae58820175548e26577f647916a5bde9556" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseLocalEnvironmentTest.kt": { "mode": "100644", @@ -12119,7 +12119,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt": { "mode": "100644", - "sha256": "26b56e2c6e00ddd0c36835d7ec4cce3c051d470a2823caec18365a8c8eed6986" + "sha256": "4ff30cbcfb98a71b79074fc2734a43d6f9afc935012e2019a3edf4a31d6c3cd3" }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ItemCreateParamsTest.kt": { "mode": "100644", @@ -13583,11 +13583,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemParamTest.kt": { "mode": "100644", - "sha256": "164f57cb099298a17d1e8727c4f0681ee76925868063a740491996fcc769cb0f" + "sha256": "b3c43ea3379f005d9eb3ccf580b2acf0342f0995e588ad347478ad91dfd7d10a" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConfigurationUpdateItemTest.kt": { "mode": "100644", - "sha256": "8fda282f79083f9f4c26a6571ccbd86be2410f994e8eae95cb0112da53796cda" + "sha256": "61082424796c969e8e289313c97b9f43f0f1d8acecec080acf342c8e550dfe65" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContainerReferenceTest.kt": { "mode": "100644", @@ -13771,7 +13771,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt": { "mode": "100644", - "sha256": "1ba0035681c06060ef33e05d55cb517b8beb1c7fea3abfe4e52d98e76c831d48" + "sha256": "0bdc461ab5e7eb60f8d286049108588b95eb8cef5ddc81715ecc9165b67b3dbb" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputMessageItemTest.kt": { "mode": "100644", @@ -13787,7 +13787,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt": { "mode": "100644", - "sha256": "b49a79c740dac33d0d195840d895def2965426b387887667669f2969335bbf0b" + "sha256": "db8cc222aad20263610870497a19647ae5e6b8091b5b2652b6954ae3550876b2" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseLocalEnvironmentTest.kt": { "mode": "100644",