diff --git a/.castiron.stats.yml b/.castiron.stats.yml index 7f2789e84c..7fb22f689b 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,6 +1,6 @@ schema_version: 1 -generation_id: 6f16b5a1-6b31-43ea-a1dd-a1a9fc37821e -openapi_spec_hash: 1faf0319c407c6534ef7c381614afbb6 -openapi_transformed_spec_hash: 53eff50caa9d18046e4ff0615bc7512d -config_hash: 4617b0962f16d328804312ac81aac630 -codegen_sha: 20f59b5cced5772bda4c6d6e3e19726d3805e4a1 +generation_id: 53946e0b-ca32-4724-9f42-4155beea8a67 +openapi_spec_hash: 15849b9fe3deb3c72da0825905cc0ad9 +openapi_transformed_spec_hash: 9a60ddf3a1c752e15eb43fce666d6da8 +config_hash: fcda4ecfe265daddba6fad25a8504a3f +codegen_sha: c8ff09541f193ac6671e2b55556913971a35d54c diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f59c0560ba..758a4b729b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -10,6 +10,7 @@ on: workflow_dispatch: permissions: + actions: read contents: read security-events: write diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index c7bd455b7c..7c6feb66ad 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -22529,6 +22529,7 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoResource' + deprecated: true x-oaiMeta: name: Create video group: videos @@ -22651,6 +22652,7 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoListResource' + deprecated: true x-oaiMeta: name: List videos group: videos @@ -22753,6 +22755,7 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoCharacterResource' + deprecated: true description: Create a character from an uploaded video. /videos/characters/{character_id}: get: @@ -22775,6 +22778,7 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoCharacterResource' + deprecated: true description: Fetch a character. /videos/edits: post: @@ -22795,6 +22799,7 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoResource' + deprecated: true description: Create a new video generation job by editing a source video or existing generated video. /videos/extensions: post: @@ -22815,6 +22820,7 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoResource' + deprecated: true description: Create an extension of a completed video. /videos/{video_id}: get: @@ -22837,6 +22843,7 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoResource' + deprecated: true x-oaiMeta: name: Retrieve video group: videos @@ -22924,6 +22931,7 @@ paths: application/json: schema: $ref: '#/components/schemas/DeletedVideoResource' + deprecated: true x-oaiMeta: name: Delete video group: videos @@ -23026,6 +23034,7 @@ paths: application/json: schema: type: string + deprecated: true x-oaiMeta: name: Retrieve video content group: videos @@ -23136,6 +23145,7 @@ paths: application/json: schema: $ref: '#/components/schemas/VideoResource' + deprecated: true x-oaiMeta: name: Remix video group: videos @@ -28325,6 +28335,7 @@ components: - tenant.workload_identity.mapping.archived - tenant.workload_identity.binding.created - tenant.workload_identity.principal.provisioned + - tenant.workload_identity.access_token.issued - tenant.admin_api_key.created - tenant.admin_api_key.updated - tenant.admin_api_key.deleted @@ -54654,20 +54665,36 @@ components: description: | The type of the client event. Always `response.create`. x-stainless-const: true + stream_id: + type: string + minLength: 1 + maxLength: 256 + pattern: ^[A-Za-z0-9_.-]+$ + description: | + The WebSocket lane for this response. Requests with the same + `stream_id` are processed FIFO, and events for the response echo the + same `stream_id`. + + `stream_id` controls routing; `previous_response_id` controls + conversation lineage, so a new lane can fork from a response created + on another lane. required: - type - $ref: '#/components/schemas/CreateResponse' description: | Client event for creating a response over a persistent WebSocket connection. - This payload uses the same top-level fields as `POST /v1/responses`. + This payload uses the same top-level fields as `POST /v1/responses`, plus + WebSocket-only envelope metadata. Notes: - `stream` is implicit over WebSocket and should not be sent. - `background` is not supported over WebSocket. + - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`. x-oaiMeta: example: | { "type": "response.create", + "stream_id": "agent_1", "model": "gpt-5.5", "input": "Say hello." } @@ -54677,7 +54704,672 @@ components: description: | Server events emitted by the Responses WebSocket server. anyOf: + - title: ResponseAudioWsDelta + description: Emitted when there is a partial audio response. + allOf: + - $ref: '#/components/schemas/ResponseAudioDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseAudioWsDone + description: Emitted when the audio response is complete. + allOf: + - $ref: '#/components/schemas/ResponseAudioDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseAudioTranscriptWsDelta + description: Emitted when there is a partial transcript of audio. + allOf: + - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseAudioTranscriptWsDone + description: Emitted when the full audio transcript is completed. + allOf: + - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallCodeWsDelta + description: Emitted when a partial code snippet is streamed by the code interpreter. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallCodeWsDone + description: Emitted when the code snippet is finalized by the code interpreter. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallWsCompleted + description: Emitted when the code interpreter call is completed. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallInWsProgress + description: Emitted when a code interpreter call is in progress. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallWsInterpreting + description: Emitted when the code interpreter is actively interpreting the code snippet. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsCompleted + description: Emitted when the model response is complete. + allOf: + - $ref: '#/components/schemas/ResponseCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseContentPartWsAdded + description: Emitted when a new content part is added. + allOf: + - $ref: '#/components/schemas/ResponseContentPartAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseContentPartWsDone + description: Emitted when a content part is done. + allOf: + - $ref: '#/components/schemas/ResponseContentPartDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsCreated + description: | + An event that is emitted when a response is created. + allOf: + - $ref: '#/components/schemas/ResponseCreatedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsError + description: Emitted when an error occurs. + allOf: + - $ref: '#/components/schemas/ResponseErrorEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFileSearchCallWsCompleted + description: Emitted when a file search call is completed (results found). + allOf: + - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFileSearchCallInWsProgress + description: Emitted when a file search call is initiated. + allOf: + - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFileSearchCallWsSearching + description: Emitted when a file search is currently searching. + allOf: + - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFunctionCallArgumentsWsDelta + description: Emitted when there is a partial function-call arguments delta. + allOf: + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFunctionCallArgumentsWsDone + description: Emitted when function-call arguments are finalized. + allOf: + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseInWsProgress + description: Emitted when the response is in progress. + allOf: + - $ref: '#/components/schemas/ResponseInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsFailed + description: | + An event that is emitted when a response fails. + allOf: + - $ref: '#/components/schemas/ResponseFailedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsIncomplete + description: | + An event that is emitted when a response finishes as incomplete. + allOf: + - $ref: '#/components/schemas/ResponseIncompleteEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseOutputItemWsAdded + description: Emitted when a new output item is added. + allOf: + - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseOutputItemWsDone + description: Emitted when an output item is marked done. + allOf: + - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningSummaryPartWsAdded + description: Emitted when a new reasoning summary part is added. + allOf: + - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningSummaryPartWsDone + description: Emitted when a reasoning summary part is completed. + allOf: + - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningSummaryTextWsDelta + description: Emitted when a delta is added to a reasoning summary text. + allOf: + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningSummaryTextWsDone + description: Emitted when a reasoning summary text is completed. + allOf: + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningTextWsDelta + description: Emitted when a delta is added to a reasoning text. + allOf: + - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningTextWsDone + description: Emitted when a reasoning text is completed. + allOf: + - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseRefusalWsDelta + description: Emitted when there is a partial refusal text. + allOf: + - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseRefusalWsDone + description: Emitted when refusal text is finalized. + allOf: + - $ref: '#/components/schemas/ResponseRefusalDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseTextWsDelta + description: Emitted when there is an additional text delta. + allOf: + - $ref: '#/components/schemas/ResponseTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseTextWsDone + description: Emitted when text content is finalized. + allOf: + - $ref: '#/components/schemas/ResponseTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWebSearchCallWsCompleted + description: Emitted when a web search call is completed. + allOf: + - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWebSearchCallInWsProgress + description: Emitted when a web search call is initiated. + allOf: + - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWebSearchCallWsSearching + description: Emitted when a web search call is executing. + allOf: + - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseImageGenCallWsCompleted + description: | + Emitted when an image generation tool call has completed and the final image is available. + allOf: + - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseImageGenCallWsGenerating + description: | + Emitted when an image generation tool call is actively generating an image (intermediate state). + allOf: + - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseImageGenCallInWsProgress + description: | + Emitted when an image generation tool call is in progress. + allOf: + - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseImageGenCallPartialWsImage + description: | + Emitted when a partial image is available during image generation streaming. + allOf: + - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallArgumentsWsDelta + description: | + Emitted when there is a delta (partial update) to the arguments of an MCP tool call. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallArgumentsWsDone + description: | + Emitted when the arguments for an MCP tool call are finalized. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallWsCompleted + description: | + Emitted when an MCP tool call has completed successfully. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallWsFailed + description: | + Emitted when an MCP tool call has failed. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallInWsProgress + description: | + Emitted when an MCP tool call is in progress. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpListToolsWsCompleted + description: | + Emitted when the list of available MCP tools has been successfully retrieved. + allOf: + - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpListToolsWsFailed + description: | + Emitted when the attempt to list available MCP tools has failed. + allOf: + - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpListToolsInWsProgress + description: | + Emitted when the system is in the process of retrieving the list of available MCP tools. + allOf: + - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseOutputTextAnnotationWsAdded + description: | + Emitted when an annotation is added to output text content. + allOf: + - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsQueued + description: | + Emitted when a response is queued and waiting to be processed. + allOf: + - $ref: '#/components/schemas/ResponseQueuedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCustomToolCallInputWsDelta + description: | + Event representing a delta (partial update) to the input of a custom tool call. + allOf: + - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCustomToolCallInputWsDone + description: | + Event indicating that input for a custom tool call is complete. + allOf: + - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + ResponsesWebSocketStreamEvent: + allOf: - $ref: '#/components/schemas/ResponseStreamEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. Role: type: object description: Details about a role that can be assigned through the public Roles API. @@ -75680,7 +76372,661 @@ components: description: | Server events emitted by the Responses WebSocket server. anyOf: - - $ref: '#/components/schemas/BetaResponseStreamEvent' + - title: BetaResponseAudioWsDelta + description: Emitted when there is a partial audio response. + allOf: + - $ref: '#/components/schemas/BetaResponseAudioDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseAudioWsDone + description: Emitted when the audio response is complete. + allOf: + - $ref: '#/components/schemas/BetaResponseAudioDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseAudioTranscriptWsDelta + description: Emitted when there is a partial transcript of audio. + allOf: + - $ref: '#/components/schemas/BetaResponseAudioTranscriptDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseAudioTranscriptWsDone + description: Emitted when the full audio transcript is completed. + allOf: + - $ref: '#/components/schemas/BetaResponseAudioTranscriptDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseCodeInterpreterCallCodeWsDelta + description: Emitted when a partial code snippet is streamed by the code interpreter. + allOf: + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallCodeDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseCodeInterpreterCallCodeWsDone + description: Emitted when the code snippet is finalized by the code interpreter. + allOf: + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallCodeDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseCodeInterpreterCallWsCompleted + description: Emitted when the code interpreter call is completed. + allOf: + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseCodeInterpreterCallInWsProgress + description: Emitted when a code interpreter call is in progress. + allOf: + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseCodeInterpreterCallWsInterpreting + description: Emitted when the code interpreter is actively interpreting the code snippet. + allOf: + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallInterpretingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWsCompleted + description: Emitted when the model response is complete. + allOf: + - $ref: '#/components/schemas/BetaResponseCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseContentPartWsAdded + description: Emitted when a new content part is added. + allOf: + - $ref: '#/components/schemas/BetaResponseContentPartAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseContentPartWsDone + description: Emitted when a content part is done. + allOf: + - $ref: '#/components/schemas/BetaResponseContentPartDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWsCreated + description: | + An event that is emitted when a response is created. + allOf: + - $ref: '#/components/schemas/BetaResponseCreatedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWsError + description: Emitted when an error occurs. + allOf: + - $ref: '#/components/schemas/BetaResponseErrorEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseFileSearchCallWsCompleted + description: Emitted when a file search call is completed (results found). + allOf: + - $ref: '#/components/schemas/BetaResponseFileSearchCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseFileSearchCallInWsProgress + description: Emitted when a file search call is initiated. + allOf: + - $ref: '#/components/schemas/BetaResponseFileSearchCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseFileSearchCallWsSearching + description: Emitted when a file search is currently searching. + allOf: + - $ref: '#/components/schemas/BetaResponseFileSearchCallSearchingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseFunctionCallArgumentsWsDelta + description: Emitted when there is a partial function-call arguments delta. + allOf: + - $ref: '#/components/schemas/BetaResponseFunctionCallArgumentsDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseFunctionCallArgumentsWsDone + description: Emitted when function-call arguments are finalized. + allOf: + - $ref: '#/components/schemas/BetaResponseFunctionCallArgumentsDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseInWsProgress + description: Emitted when the response is in progress. + allOf: + - $ref: '#/components/schemas/BetaResponseInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWsFailed + description: | + An event that is emitted when a response fails. + allOf: + - $ref: '#/components/schemas/BetaResponseFailedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWsIncomplete + description: | + An event that is emitted when a response finishes as incomplete. + allOf: + - $ref: '#/components/schemas/BetaResponseIncompleteEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseOutputItemWsAdded + description: Emitted when a new output item is added. + allOf: + - $ref: '#/components/schemas/BetaResponseOutputItemAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseOutputItemWsDone + description: Emitted when an output item is marked done. + allOf: + - $ref: '#/components/schemas/BetaResponseOutputItemDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseReasoningSummaryPartWsAdded + description: Emitted when a new reasoning summary part is added. + allOf: + - $ref: '#/components/schemas/BetaResponseReasoningSummaryPartAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseReasoningSummaryPartWsDone + description: Emitted when a reasoning summary part is completed. + allOf: + - $ref: '#/components/schemas/BetaResponseReasoningSummaryPartDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseReasoningSummaryTextWsDelta + description: Emitted when a delta is added to a reasoning summary text. + allOf: + - $ref: '#/components/schemas/BetaResponseReasoningSummaryTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseReasoningSummaryTextWsDone + description: Emitted when a reasoning summary text is completed. + allOf: + - $ref: '#/components/schemas/BetaResponseReasoningSummaryTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseReasoningTextWsDelta + description: Emitted when a delta is added to a reasoning text. + allOf: + - $ref: '#/components/schemas/BetaResponseReasoningTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseReasoningTextWsDone + description: Emitted when a reasoning text is completed. + allOf: + - $ref: '#/components/schemas/BetaResponseReasoningTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseRefusalWsDelta + description: Emitted when there is a partial refusal text. + allOf: + - $ref: '#/components/schemas/BetaResponseRefusalDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseRefusalWsDone + description: Emitted when refusal text is finalized. + allOf: + - $ref: '#/components/schemas/BetaResponseRefusalDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseTextWsDelta + description: Emitted when there is an additional text delta. + allOf: + - $ref: '#/components/schemas/BetaResponseTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseTextWsDone + description: Emitted when text content is finalized. + allOf: + - $ref: '#/components/schemas/BetaResponseTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWebSearchCallWsCompleted + description: Emitted when a web search call is completed. + allOf: + - $ref: '#/components/schemas/BetaResponseWebSearchCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWebSearchCallInWsProgress + description: Emitted when a web search call is initiated. + allOf: + - $ref: '#/components/schemas/BetaResponseWebSearchCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWebSearchCallWsSearching + description: Emitted when a web search call is executing. + allOf: + - $ref: '#/components/schemas/BetaResponseWebSearchCallSearchingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseImageGenCallWsCompleted + description: | + Emitted when an image generation tool call has completed and the final image is available. + allOf: + - $ref: '#/components/schemas/BetaResponseImageGenCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseImageGenCallWsGenerating + description: | + Emitted when an image generation tool call is actively generating an image (intermediate state). + allOf: + - $ref: '#/components/schemas/BetaResponseImageGenCallGeneratingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseImageGenCallInWsProgress + description: | + Emitted when an image generation tool call is in progress. + allOf: + - $ref: '#/components/schemas/BetaResponseImageGenCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseImageGenCallPartialWsImage + description: | + Emitted when a partial image is available during image generation streaming. + allOf: + - $ref: '#/components/schemas/BetaResponseImageGenCallPartialImageEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseMcpCallArgumentsWsDelta + description: | + Emitted when there is a delta (partial update) to the arguments of an MCP tool call. + allOf: + - $ref: '#/components/schemas/BetaResponseMCPCallArgumentsDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseMcpCallArgumentsWsDone + description: | + Emitted when the arguments for an MCP tool call are finalized. + allOf: + - $ref: '#/components/schemas/BetaResponseMCPCallArgumentsDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseMcpCallWsCompleted + description: | + Emitted when an MCP tool call has completed successfully. + allOf: + - $ref: '#/components/schemas/BetaResponseMCPCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseMcpCallWsFailed + description: | + Emitted when an MCP tool call has failed. + allOf: + - $ref: '#/components/schemas/BetaResponseMCPCallFailedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseMcpCallInWsProgress + description: | + Emitted when an MCP tool call is in progress. + allOf: + - $ref: '#/components/schemas/BetaResponseMCPCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseMcpListToolsWsCompleted + description: | + Emitted when the list of available MCP tools has been successfully retrieved. + allOf: + - $ref: '#/components/schemas/BetaResponseMCPListToolsCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseMcpListToolsWsFailed + description: | + Emitted when the attempt to list available MCP tools has failed. + allOf: + - $ref: '#/components/schemas/BetaResponseMCPListToolsFailedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseMcpListToolsInWsProgress + description: | + Emitted when the system is in the process of retrieving the list of available MCP tools. + allOf: + - $ref: '#/components/schemas/BetaResponseMCPListToolsInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseOutputTextAnnotationWsAdded + description: | + Emitted when an annotation is added to output text content. + allOf: + - $ref: '#/components/schemas/BetaResponseOutputTextAnnotationAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseWsQueued + description: | + Emitted when a response is queued and waiting to be processed. + allOf: + - $ref: '#/components/schemas/BetaResponseQueuedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseCustomToolCallInputWsDelta + description: | + Event representing a delta (partial update) to the input of a custom tool call. + allOf: + - $ref: '#/components/schemas/BetaResponseCustomToolCallInputDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: BetaResponseCustomToolCallInputWsDone + description: | + Event indicating that input for a custom tool call is complete. + allOf: + - $ref: '#/components/schemas/BetaResponseCustomToolCallInputDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. - $ref: '#/components/schemas/BetaResponseInjectCreatedEvent' - $ref: '#/components/schemas/BetaResponseInjectFailedEvent' BetaResponseInjectFailedEvent: @@ -75790,6 +77136,17 @@ components: "response_id": "resp_123", "sequence_number": 8 } + BetaResponsesWebSocketStreamEvent: + allOf: + - $ref: '#/components/schemas/BetaResponseStreamEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. BetaResponseStreamEvent: anyOf: - $ref: '#/components/schemas/BetaResponseAudioDeltaEvent' @@ -75907,20 +77264,36 @@ components: description: | The type of the client event. Always `response.create`. x-stainless-const: true + stream_id: + type: string + minLength: 1 + maxLength: 256 + pattern: ^[A-Za-z0-9_.-]+$ + description: | + The WebSocket lane for this response. Requests with the same + `stream_id` are processed FIFO, and events for the response echo the + same `stream_id`. + + `stream_id` controls routing; `previous_response_id` controls + conversation lineage, so a new lane can fork from a response created + on another lane. required: - type - $ref: '#/components/schemas/BetaCreateResponse' description: | Client event for creating a response over a persistent WebSocket connection. - This payload uses the same top-level fields as `POST /v1/responses`. + This payload uses the same top-level fields as `POST /v1/responses`, plus + WebSocket-only envelope metadata. Notes: - `stream` is implicit over WebSocket and should not be sent. - `background` is not supported over WebSocket. + - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`. x-oaiMeta: example: | { "type": "response.create", + "stream_id": "agent_1", "model": "gpt-5.5", "input": "Say hello." } diff --git a/examples/video.py b/examples/video.py index ee89e64697..b9346a7e77 100644 --- a/examples/video.py +++ b/examples/video.py @@ -8,7 +8,7 @@ async def main() -> None: - video = await client.videos.create_and_poll( + video = await client.videos.create_and_poll( # pyright: ignore[reportDeprecated] model="sora-2", prompt="A video of the words 'Thank you' in sparkling letters", ) diff --git a/src/openai/resources/admin/organization/audit_logs.py b/src/openai/resources/admin/organization/audit_logs.py index 5fc61feae3..a0530d27a7 100644 --- a/src/openai/resources/admin/organization/audit_logs.py +++ b/src/openai/resources/admin/organization/audit_logs.py @@ -123,6 +123,7 @@ def list( "tenant.workload_identity.mapping.archived", "tenant.workload_identity.binding.created", "tenant.workload_identity.principal.provisioned", + "tenant.workload_identity.access_token.issued", "tenant.admin_api_key.created", "tenant.admin_api_key.updated", "tenant.admin_api_key.deleted", @@ -388,6 +389,7 @@ def list( "tenant.workload_identity.mapping.archived", "tenant.workload_identity.binding.created", "tenant.workload_identity.principal.provisioned", + "tenant.workload_identity.access_token.issued", "tenant.admin_api_key.created", "tenant.admin_api_key.updated", "tenant.admin_api_key.deleted", diff --git a/src/openai/resources/beta/responses/responses.py b/src/openai/resources/beta/responses/responses.py index 2b4217db8f..6c837efa0d 100644 --- a/src/openai/resources/beta/responses/responses.py +++ b/src/openai/resources/beta/responses/responses.py @@ -4259,11 +4259,11 @@ def on( Can be used as a method (returns ``self`` for chaining):: - connection.on("response.audio.delta", my_handler) + connection.on("response.inject.created", my_handler) Or as a decorator:: - @connection.on("response.audio.delta") + @connection.on("response.inject.created") async def my_handler(event): ... """ if handler is not None: @@ -4710,11 +4710,11 @@ def on( Can be used as a method (returns ``self`` for chaining):: - connection.on("response.audio.delta", my_handler) + connection.on("response.inject.created", my_handler) Or as a decorator:: - @connection.on("response.audio.delta") + @connection.on("response.inject.created") def my_handler(event): ... """ if handler is not None: @@ -5094,6 +5094,7 @@ def create( service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority", "fast"]] | Omit = omit, store: Optional[bool] | Omit = omit, stream: Optional[bool] | Omit = omit, + stream_id: str | Omit = omit, stream_options: Optional[beta_responses_client_event_param.ResponseCreateStreamOptions] | Omit = omit, temperature: Optional[float] | Omit = omit, text: BetaResponseTextConfigParam | Omit = omit, @@ -5106,11 +5107,13 @@ def create( ) -> None: """ Client event for creating a response over a persistent WebSocket connection. - This payload uses the same top-level fields as `POST /v1/responses`. + This payload uses the same top-level fields as `POST /v1/responses`, plus + WebSocket-only envelope metadata. Notes: - `stream` is implicit over WebSocket and should not be sent. - `background` is not supported over WebSocket. + - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`. """ self._connection.send( cast( @@ -5141,6 +5144,7 @@ def create( "service_tier": service_tier, "store": store, "stream": stream, + "stream_id": stream_id, "stream_options": stream_options, "temperature": temperature, "text": text, @@ -5301,6 +5305,7 @@ async def create( service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority", "fast"]] | Omit = omit, store: Optional[bool] | Omit = omit, stream: Optional[bool] | Omit = omit, + stream_id: str | Omit = omit, stream_options: Optional[beta_responses_client_event_param.ResponseCreateStreamOptions] | Omit = omit, temperature: Optional[float] | Omit = omit, text: BetaResponseTextConfigParam | Omit = omit, @@ -5313,11 +5318,13 @@ async def create( ) -> None: """ Client event for creating a response over a persistent WebSocket connection. - This payload uses the same top-level fields as `POST /v1/responses`. + This payload uses the same top-level fields as `POST /v1/responses`, plus + WebSocket-only envelope metadata. Notes: - `stream` is implicit over WebSocket and should not be sent. - `background` is not supported over WebSocket. + - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`. """ await self._connection.send( cast( @@ -5348,6 +5355,7 @@ async def create( "service_tier": service_tier, "store": store, "stream": stream, + "stream_id": stream_id, "stream_options": stream_options, "temperature": temperature, "text": text, diff --git a/src/openai/resources/responses/responses.py b/src/openai/resources/responses/responses.py index bbb4a7a443..ee918fed35 100644 --- a/src/openai/resources/responses/responses.py +++ b/src/openai/resources/responses/responses.py @@ -4178,11 +4178,11 @@ def on( Can be used as a method (returns ``self`` for chaining):: - connection.on("response.audio.delta", my_handler) + connection.on("error", my_handler) Or as a decorator:: - @connection.on("response.audio.delta") + @connection.on("error") async def my_handler(event): ... """ if handler is not None: @@ -4629,11 +4629,11 @@ def on( Can be used as a method (returns ``self`` for chaining):: - connection.on("response.audio.delta", my_handler) + connection.on("error", my_handler) Or as a decorator:: - @connection.on("response.audio.delta") + @connection.on("error") def my_handler(event): ... """ if handler is not None: @@ -4899,6 +4899,7 @@ def create( service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority", "fast"]] | Omit = omit, store: Optional[bool] | Omit = omit, stream: Optional[bool] | Omit = omit, + stream_id: str | Omit = omit, stream_options: Optional[responses_client_event_param.StreamOptions] | Omit = omit, temperature: Optional[float] | Omit = omit, text: ResponseTextConfigParam | Omit = omit, @@ -4937,6 +4938,7 @@ def create( "service_tier": service_tier, "store": store, "stream": stream, + "stream_id": stream_id, "stream_options": stream_options, "temperature": temperature, "text": text, @@ -4983,6 +4985,7 @@ async def create( service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority", "fast"]] | Omit = omit, store: Optional[bool] | Omit = omit, stream: Optional[bool] | Omit = omit, + stream_id: str | Omit = omit, stream_options: Optional[responses_client_event_param.StreamOptions] | Omit = omit, temperature: Optional[float] | Omit = omit, text: ResponseTextConfigParam | Omit = omit, @@ -5021,6 +5024,7 @@ async def create( "service_tier": service_tier, "store": store, "stream": stream, + "stream_id": stream_id, "stream_options": stream_options, "temperature": temperature, "text": text, diff --git a/src/openai/resources/videos.py b/src/openai/resources/videos.py index 37ceb9a660..d4c84ea1f3 100644 --- a/src/openai/resources/videos.py +++ b/src/openai/resources/videos.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import TYPE_CHECKING, Mapping, cast from typing_extensions import Literal, assert_never @@ -66,6 +67,7 @@ def with_streaming_response(self) -> VideosWithStreamingResponse: """ return VideosWithStreamingResponse(self) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def create( self, *, @@ -134,6 +136,7 @@ def create( cast_to=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def create_and_poll( self, *, @@ -151,7 +154,7 @@ def create_and_poll( timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> Video: """Create a video and wait for it to be processed.""" - video = self.create( + video = self.create( # pyright: ignore[reportDeprecated] model=model, prompt=prompt, input_reference=input_reference, @@ -163,11 +166,12 @@ def create_and_poll( timeout=timeout, ) - return self.poll( + return self.poll( # pyright: ignore[reportDeprecated] video.id, poll_interval_ms=poll_interval_ms, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def poll( self, video_id: str, @@ -184,7 +188,7 @@ def poll( headers["X-Stainless-Custom-Poll-Interval"] = str(poll_interval_ms) while True: - response = self.with_raw_response.retrieve( + response = self.with_raw_response.retrieve( # pyright: ignore[reportDeprecated] video_id, extra_headers=headers, ) @@ -207,6 +211,7 @@ def poll( else: return video + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def retrieve( self, video_id: str, @@ -244,6 +249,7 @@ def retrieve( cast_to=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def list( self, *, @@ -297,6 +303,7 @@ def list( model=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def delete( self, video_id: str, @@ -334,6 +341,7 @@ def delete( cast_to=VideoDeleteResponse, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def create_character( self, *, @@ -388,6 +396,7 @@ def create_character( cast_to=VideoCreateCharacterResponse, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def download_content( self, video_id: str, @@ -432,6 +441,7 @@ def download_content( cast_to=_legacy_response.HttpxBinaryResponseContent, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def edit( self, *, @@ -487,6 +497,7 @@ def edit( cast_to=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def extend( self, *, @@ -546,6 +557,7 @@ def extend( cast_to=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def get_character( self, character_id: str, @@ -583,6 +595,7 @@ def get_character( cast_to=VideoGetCharacterResponse, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def remix( self, video_id: str, @@ -645,6 +658,7 @@ def with_streaming_response(self) -> AsyncVideosWithStreamingResponse: """ return AsyncVideosWithStreamingResponse(self) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def create( self, *, @@ -713,6 +727,7 @@ async def create( cast_to=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def create_and_poll( self, *, @@ -730,7 +745,7 @@ async def create_and_poll( timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> Video: """Create a video and wait for it to be processed.""" - video = await self.create( + video = await self.create( # pyright: ignore[reportDeprecated] model=model, prompt=prompt, input_reference=input_reference, @@ -742,11 +757,12 @@ async def create_and_poll( timeout=timeout, ) - return await self.poll( + return await self.poll( # pyright: ignore[reportDeprecated] video.id, poll_interval_ms=poll_interval_ms, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def poll( self, video_id: str, @@ -763,7 +779,7 @@ async def poll( headers["X-Stainless-Custom-Poll-Interval"] = str(poll_interval_ms) while True: - response = await self.with_raw_response.retrieve( + response = await self.with_raw_response.retrieve( # pyright: ignore[reportDeprecated] video_id, extra_headers=headers, ) @@ -786,6 +802,7 @@ async def poll( else: return video + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def retrieve( self, video_id: str, @@ -823,6 +840,7 @@ async def retrieve( cast_to=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") def list( self, *, @@ -876,6 +894,7 @@ def list( model=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def delete( self, video_id: str, @@ -913,6 +932,7 @@ async def delete( cast_to=VideoDeleteResponse, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def create_character( self, *, @@ -967,6 +987,7 @@ async def create_character( cast_to=VideoCreateCharacterResponse, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def download_content( self, video_id: str, @@ -1013,6 +1034,7 @@ async def download_content( cast_to=_legacy_response.HttpxBinaryResponseContent, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def edit( self, *, @@ -1068,6 +1090,7 @@ async def edit( cast_to=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def extend( self, *, @@ -1127,6 +1150,7 @@ async def extend( cast_to=Video, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def get_character( self, character_id: str, @@ -1164,6 +1188,7 @@ async def get_character( cast_to=VideoGetCharacterResponse, ) + @typing_extensions.deprecated("The Sora API is scheduled to permanently shut down on September 24, 2026.") async def remix( self, video_id: str, @@ -1210,35 +1235,55 @@ class VideosWithRawResponse: def __init__(self, videos: Videos) -> None: self._videos = videos - self.create = _legacy_response.to_raw_response_wrapper( - videos.create, + self.create = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.create, # pyright: ignore[reportDeprecated], + ) ) - self.retrieve = _legacy_response.to_raw_response_wrapper( - videos.retrieve, + self.retrieve = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.retrieve, # pyright: ignore[reportDeprecated], + ) ) - self.list = _legacy_response.to_raw_response_wrapper( - videos.list, + self.list = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.list, # pyright: ignore[reportDeprecated], + ) ) - self.delete = _legacy_response.to_raw_response_wrapper( - videos.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.delete, # pyright: ignore[reportDeprecated], + ) ) - self.create_character = _legacy_response.to_raw_response_wrapper( - videos.create_character, + self.create_character = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.create_character, # pyright: ignore[reportDeprecated], + ) ) - self.download_content = _legacy_response.to_raw_response_wrapper( - videos.download_content, + self.download_content = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.download_content, # pyright: ignore[reportDeprecated], + ) ) - self.edit = _legacy_response.to_raw_response_wrapper( - videos.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.edit, # pyright: ignore[reportDeprecated], + ) ) - self.extend = _legacy_response.to_raw_response_wrapper( - videos.extend, + self.extend = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.extend, # pyright: ignore[reportDeprecated], + ) ) - self.get_character = _legacy_response.to_raw_response_wrapper( - videos.get_character, + self.get_character = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.get_character, # pyright: ignore[reportDeprecated], + ) ) - self.remix = _legacy_response.to_raw_response_wrapper( - videos.remix, + self.remix = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + videos.remix, # pyright: ignore[reportDeprecated], + ) ) @@ -1246,35 +1291,55 @@ class AsyncVideosWithRawResponse: def __init__(self, videos: AsyncVideos) -> None: self._videos = videos - self.create = _legacy_response.async_to_raw_response_wrapper( - videos.create, + self.create = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.create, # pyright: ignore[reportDeprecated], + ) ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( - videos.retrieve, + self.retrieve = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.retrieve, # pyright: ignore[reportDeprecated], + ) ) - self.list = _legacy_response.async_to_raw_response_wrapper( - videos.list, + self.list = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.list, # pyright: ignore[reportDeprecated], + ) ) - self.delete = _legacy_response.async_to_raw_response_wrapper( - videos.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.delete, # pyright: ignore[reportDeprecated], + ) ) - self.create_character = _legacy_response.async_to_raw_response_wrapper( - videos.create_character, + self.create_character = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.create_character, # pyright: ignore[reportDeprecated], + ) ) - self.download_content = _legacy_response.async_to_raw_response_wrapper( - videos.download_content, + self.download_content = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.download_content, # pyright: ignore[reportDeprecated], + ) ) - self.edit = _legacy_response.async_to_raw_response_wrapper( - videos.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.edit, # pyright: ignore[reportDeprecated], + ) ) - self.extend = _legacy_response.async_to_raw_response_wrapper( - videos.extend, + self.extend = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.extend, # pyright: ignore[reportDeprecated], + ) ) - self.get_character = _legacy_response.async_to_raw_response_wrapper( - videos.get_character, + self.get_character = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.get_character, # pyright: ignore[reportDeprecated], + ) ) - self.remix = _legacy_response.async_to_raw_response_wrapper( - videos.remix, + self.remix = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + videos.remix, # pyright: ignore[reportDeprecated], + ) ) @@ -1282,36 +1347,56 @@ class VideosWithStreamingResponse: def __init__(self, videos: Videos) -> None: self._videos = videos - self.create = to_streamed_response_wrapper( - videos.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.create, # pyright: ignore[reportDeprecated], + ) ) - self.retrieve = to_streamed_response_wrapper( - videos.retrieve, + self.retrieve = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.retrieve, # pyright: ignore[reportDeprecated], + ) ) - self.list = to_streamed_response_wrapper( - videos.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.list, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - videos.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.delete, # pyright: ignore[reportDeprecated], + ) ) - self.create_character = to_streamed_response_wrapper( - videos.create_character, + self.create_character = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.create_character, # pyright: ignore[reportDeprecated], + ) ) - self.download_content = to_custom_streamed_response_wrapper( - videos.download_content, - StreamedBinaryAPIResponse, + self.download_content = ( # pyright: ignore[reportDeprecated] + to_custom_streamed_response_wrapper( + videos.download_content, # pyright: ignore[reportDeprecated], + StreamedBinaryAPIResponse, + ) ) - self.edit = to_streamed_response_wrapper( - videos.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.edit, # pyright: ignore[reportDeprecated], + ) ) - self.extend = to_streamed_response_wrapper( - videos.extend, + self.extend = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.extend, # pyright: ignore[reportDeprecated], + ) ) - self.get_character = to_streamed_response_wrapper( - videos.get_character, + self.get_character = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.get_character, # pyright: ignore[reportDeprecated], + ) ) - self.remix = to_streamed_response_wrapper( - videos.remix, + self.remix = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + videos.remix, # pyright: ignore[reportDeprecated], + ) ) @@ -1319,34 +1404,54 @@ class AsyncVideosWithStreamingResponse: def __init__(self, videos: AsyncVideos) -> None: self._videos = videos - self.create = async_to_streamed_response_wrapper( - videos.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.create, # pyright: ignore[reportDeprecated], + ) ) - self.retrieve = async_to_streamed_response_wrapper( - videos.retrieve, + self.retrieve = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.retrieve, # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_streamed_response_wrapper( - videos.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.list, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - videos.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.delete, # pyright: ignore[reportDeprecated], + ) ) - self.create_character = async_to_streamed_response_wrapper( - videos.create_character, + self.create_character = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.create_character, # pyright: ignore[reportDeprecated], + ) ) - self.download_content = async_to_custom_streamed_response_wrapper( - videos.download_content, - AsyncStreamedBinaryAPIResponse, + self.download_content = ( # pyright: ignore[reportDeprecated] + async_to_custom_streamed_response_wrapper( + videos.download_content, # pyright: ignore[reportDeprecated], + AsyncStreamedBinaryAPIResponse, + ) ) - self.edit = async_to_streamed_response_wrapper( - videos.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.edit, # pyright: ignore[reportDeprecated], + ) ) - self.extend = async_to_streamed_response_wrapper( - videos.extend, + self.extend = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.extend, # pyright: ignore[reportDeprecated], + ) ) - self.get_character = async_to_streamed_response_wrapper( - videos.get_character, + self.get_character = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.get_character, # pyright: ignore[reportDeprecated], + ) ) - self.remix = async_to_streamed_response_wrapper( - videos.remix, + self.remix = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + videos.remix, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/openai/types/admin/organization/audit_log_list_params.py b/src/openai/types/admin/organization/audit_log_list_params.py index a00891ff33..a5476ff8d9 100644 --- a/src/openai/types/admin/organization/audit_log_list_params.py +++ b/src/openai/types/admin/organization/audit_log_list_params.py @@ -113,6 +113,7 @@ class AuditLogListParams(TypedDict, total=False): "tenant.workload_identity.mapping.archived", "tenant.workload_identity.binding.created", "tenant.workload_identity.principal.provisioned", + "tenant.workload_identity.access_token.issued", "tenant.admin_api_key.created", "tenant.admin_api_key.updated", "tenant.admin_api_key.deleted", diff --git a/src/openai/types/admin/organization/audit_log_list_response.py b/src/openai/types/admin/organization/audit_log_list_response.py index 97d9d60b7d..dd135cc0e1 100644 --- a/src/openai/types/admin/organization/audit_log_list_response.py +++ b/src/openai/types/admin/organization/audit_log_list_response.py @@ -1048,6 +1048,7 @@ class AuditLogListResponse(BaseModel): "tenant.workload_identity.mapping.archived", "tenant.workload_identity.binding.created", "tenant.workload_identity.principal.provisioned", + "tenant.workload_identity.access_token.issued", "tenant.admin_api_key.created", "tenant.admin_api_key.updated", "tenant.admin_api_key.deleted", diff --git a/src/openai/types/beta/beta_responses_client_event.py b/src/openai/types/beta/beta_responses_client_event.py index 203a059621..7f86daa1ed 100644 --- a/src/openai/types/beta/beta_responses_client_event.py +++ b/src/openai/types/beta/beta_responses_client_event.py @@ -215,11 +215,13 @@ class ResponseCreateToolChoiceBetaSpecificProgrammaticToolCallingParam(BaseModel class ResponseCreate(BaseModel): """ Client event for creating a response over a persistent WebSocket connection. - This payload uses the same top-level fields as `POST /v1/responses`. + This payload uses the same top-level fields as `POST /v1/responses`, plus + WebSocket-only envelope metadata. Notes: - `stream` is implicit over WebSocket and should not be sent. - `background` is not supported over WebSocket. + - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`. """ type: Literal["response.create"] @@ -539,6 +541,16 @@ class ResponseCreate(BaseModel): for more information. """ + stream_id: Optional[str] = None + """The WebSocket lane for this response. + + Requests with the same `stream_id` are processed FIFO, and events for the + response echo the same `stream_id`. + + `stream_id` controls routing; `previous_response_id` controls conversation + lineage, so a new lane can fork from a response created on another lane. + """ + stream_options: Optional[ResponseCreateStreamOptions] = None """Options for streaming responses. Only set this when you set `stream: true`.""" diff --git a/src/openai/types/beta/beta_responses_client_event_param.py b/src/openai/types/beta/beta_responses_client_event_param.py index 1b3bdd0603..8f06071750 100644 --- a/src/openai/types/beta/beta_responses_client_event_param.py +++ b/src/openai/types/beta/beta_responses_client_event_param.py @@ -215,11 +215,13 @@ class ResponseCreateToolChoiceBetaSpecificProgrammaticToolCallingParam(TypedDict class ResponseCreate(TypedDict, total=False): """ Client event for creating a response over a persistent WebSocket connection. - This payload uses the same top-level fields as `POST /v1/responses`. + This payload uses the same top-level fields as `POST /v1/responses`, plus + WebSocket-only envelope metadata. Notes: - `stream` is implicit over WebSocket and should not be sent. - `background` is not supported over WebSocket. + - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`. """ type: Required[Literal["response.create"]] @@ -538,6 +540,16 @@ class ResponseCreate(TypedDict, total=False): for more information. """ + stream_id: str + """The WebSocket lane for this response. + + Requests with the same `stream_id` are processed FIFO, and events for the + response echo the same `stream_id`. + + `stream_id` controls routing; `previous_response_id` controls conversation + lineage, so a new lane can fork from a response created on another lane. + """ + stream_options: Optional[ResponseCreateStreamOptions] """Options for streaming responses. Only set this when you set `stream: true`.""" diff --git a/src/openai/types/beta/beta_responses_server_event.py b/src/openai/types/beta/beta_responses_server_event.py index effd70549c..b22ed784fb 100644 --- a/src/openai/types/beta/beta_responses_server_event.py +++ b/src/openai/types/beta/beta_responses_server_event.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional from typing_extensions import Annotated, TypeAlias from ..._utils import PropertyInfo @@ -60,63 +60,710 @@ from .beta_response_code_interpreter_call_in_progress_event import BetaResponseCodeInterpreterCallInProgressEvent from .beta_response_code_interpreter_call_interpreting_event import BetaResponseCodeInterpreterCallInterpretingEvent -__all__ = ["BetaResponsesServerEvent"] +__all__ = [ + "BetaResponsesServerEvent", + "BetaResponseAudioWsDelta", + "BetaResponseAudioWsDone", + "BetaResponseAudioTranscriptWsDelta", + "BetaResponseAudioTranscriptWsDone", + "BetaResponseCodeInterpreterCallCodeWsDelta", + "BetaResponseCodeInterpreterCallCodeWsDone", + "BetaResponseCodeInterpreterCallWsCompleted", + "BetaResponseCodeInterpreterCallInWsProgress", + "BetaResponseCodeInterpreterCallWsInterpreting", + "BetaResponseWsCompleted", + "BetaResponseContentPartWsAdded", + "BetaResponseContentPartWsDone", + "BetaResponseWsCreated", + "BetaResponseWsError", + "BetaResponseFileSearchCallWsCompleted", + "BetaResponseFileSearchCallInWsProgress", + "BetaResponseFileSearchCallWsSearching", + "BetaResponseFunctionCallArgumentsWsDelta", + "BetaResponseFunctionCallArgumentsWsDone", + "BetaResponseInWsProgress", + "BetaResponseWsFailed", + "BetaResponseWsIncomplete", + "BetaResponseOutputItemWsAdded", + "BetaResponseOutputItemWsDone", + "BetaResponseReasoningSummaryPartWsAdded", + "BetaResponseReasoningSummaryPartWsDone", + "BetaResponseReasoningSummaryTextWsDelta", + "BetaResponseReasoningSummaryTextWsDone", + "BetaResponseReasoningTextWsDelta", + "BetaResponseReasoningTextWsDone", + "BetaResponseRefusalWsDelta", + "BetaResponseRefusalWsDone", + "BetaResponseTextWsDelta", + "BetaResponseTextWsDone", + "BetaResponseWebSearchCallWsCompleted", + "BetaResponseWebSearchCallInWsProgress", + "BetaResponseWebSearchCallWsSearching", + "BetaResponseImageGenCallWsCompleted", + "BetaResponseImageGenCallWsGenerating", + "BetaResponseImageGenCallInWsProgress", + "BetaResponseImageGenCallPartialWsImage", + "BetaResponseMcpCallArgumentsWsDelta", + "BetaResponseMcpCallArgumentsWsDone", + "BetaResponseMcpCallWsCompleted", + "BetaResponseMcpCallWsFailed", + "BetaResponseMcpCallInWsProgress", + "BetaResponseMcpListToolsWsCompleted", + "BetaResponseMcpListToolsWsFailed", + "BetaResponseMcpListToolsInWsProgress", + "BetaResponseOutputTextAnnotationWsAdded", + "BetaResponseWsQueued", + "BetaResponseCustomToolCallInputWsDelta", + "BetaResponseCustomToolCallInputWsDone", +] + + +class BetaResponseAudioWsDelta(BetaResponseAudioDeltaEvent): + """Emitted when there is a partial audio response.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseAudioWsDone(BetaResponseAudioDoneEvent): + """Emitted when the audio response is complete.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseAudioTranscriptWsDelta(BetaResponseAudioTranscriptDeltaEvent): + """Emitted when there is a partial transcript of audio.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseAudioTranscriptWsDone(BetaResponseAudioTranscriptDoneEvent): + """Emitted when the full audio transcript is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseCodeInterpreterCallCodeWsDelta(BetaResponseCodeInterpreterCallCodeDeltaEvent): + """Emitted when a partial code snippet is streamed by the code interpreter.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseCodeInterpreterCallCodeWsDone(BetaResponseCodeInterpreterCallCodeDoneEvent): + """Emitted when the code snippet is finalized by the code interpreter.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseCodeInterpreterCallWsCompleted(BetaResponseCodeInterpreterCallCompletedEvent): + """Emitted when the code interpreter call is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseCodeInterpreterCallInWsProgress(BetaResponseCodeInterpreterCallInProgressEvent): + """Emitted when a code interpreter call is in progress.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseCodeInterpreterCallWsInterpreting(BetaResponseCodeInterpreterCallInterpretingEvent): + """Emitted when the code interpreter is actively interpreting the code snippet.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWsCompleted(BetaResponseCompletedEvent): + """Emitted when the model response is complete.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseContentPartWsAdded(BetaResponseContentPartAddedEvent): + """Emitted when a new content part is added.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseContentPartWsDone(BetaResponseContentPartDoneEvent): + """Emitted when a content part is done.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWsCreated(BetaResponseCreatedEvent): + """An event that is emitted when a response is created.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWsError(BetaResponseErrorEvent): + """Emitted when an error occurs.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseFileSearchCallWsCompleted(BetaResponseFileSearchCallCompletedEvent): + """Emitted when a file search call is completed (results found).""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseFileSearchCallInWsProgress(BetaResponseFileSearchCallInProgressEvent): + """Emitted when a file search call is initiated.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseFileSearchCallWsSearching(BetaResponseFileSearchCallSearchingEvent): + """Emitted when a file search is currently searching.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseFunctionCallArgumentsWsDelta(BetaResponseFunctionCallArgumentsDeltaEvent): + """Emitted when there is a partial function-call arguments delta.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseFunctionCallArgumentsWsDone(BetaResponseFunctionCallArgumentsDoneEvent): + """Emitted when function-call arguments are finalized.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseInWsProgress(BetaResponseInProgressEvent): + """Emitted when the response is in progress.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWsFailed(BetaResponseFailedEvent): + """An event that is emitted when a response fails.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWsIncomplete(BetaResponseIncompleteEvent): + """An event that is emitted when a response finishes as incomplete.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseOutputItemWsAdded(BetaResponseOutputItemAddedEvent): + """Emitted when a new output item is added.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseOutputItemWsDone(BetaResponseOutputItemDoneEvent): + """Emitted when an output item is marked done.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseReasoningSummaryPartWsAdded(BetaResponseReasoningSummaryPartAddedEvent): + """Emitted when a new reasoning summary part is added.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseReasoningSummaryPartWsDone(BetaResponseReasoningSummaryPartDoneEvent): + """Emitted when a reasoning summary part is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseReasoningSummaryTextWsDelta(BetaResponseReasoningSummaryTextDeltaEvent): + """Emitted when a delta is added to a reasoning summary text.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseReasoningSummaryTextWsDone(BetaResponseReasoningSummaryTextDoneEvent): + """Emitted when a reasoning summary text is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseReasoningTextWsDelta(BetaResponseReasoningTextDeltaEvent): + """Emitted when a delta is added to a reasoning text.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseReasoningTextWsDone(BetaResponseReasoningTextDoneEvent): + """Emitted when a reasoning text is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseRefusalWsDelta(BetaResponseRefusalDeltaEvent): + """Emitted when there is a partial refusal text.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseRefusalWsDone(BetaResponseRefusalDoneEvent): + """Emitted when refusal text is finalized.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseTextWsDelta(BetaResponseTextDeltaEvent): + """Emitted when there is an additional text delta.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseTextWsDone(BetaResponseTextDoneEvent): + """Emitted when text content is finalized.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWebSearchCallWsCompleted(BetaResponseWebSearchCallCompletedEvent): + """Emitted when a web search call is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWebSearchCallInWsProgress(BetaResponseWebSearchCallInProgressEvent): + """Emitted when a web search call is initiated.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWebSearchCallWsSearching(BetaResponseWebSearchCallSearchingEvent): + """Emitted when a web search call is executing.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseImageGenCallWsCompleted(BetaResponseImageGenCallCompletedEvent): + """ + Emitted when an image generation tool call has completed and the final image is available. + """ + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseImageGenCallWsGenerating(BetaResponseImageGenCallGeneratingEvent): + """ + Emitted when an image generation tool call is actively generating an image (intermediate state). + """ + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseImageGenCallInWsProgress(BetaResponseImageGenCallInProgressEvent): + """Emitted when an image generation tool call is in progress.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseImageGenCallPartialWsImage(BetaResponseImageGenCallPartialImageEvent): + """Emitted when a partial image is available during image generation streaming.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseMcpCallArgumentsWsDelta(BetaResponseMcpCallArgumentsDeltaEvent): + """ + Emitted when there is a delta (partial update) to the arguments of an MCP tool call. + """ + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseMcpCallArgumentsWsDone(BetaResponseMcpCallArgumentsDoneEvent): + """Emitted when the arguments for an MCP tool call are finalized.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseMcpCallWsCompleted(BetaResponseMcpCallCompletedEvent): + """Emitted when an MCP tool call has completed successfully.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseMcpCallWsFailed(BetaResponseMcpCallFailedEvent): + """Emitted when an MCP tool call has failed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseMcpCallInWsProgress(BetaResponseMcpCallInProgressEvent): + """Emitted when an MCP tool call is in progress.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseMcpListToolsWsCompleted(BetaResponseMcpListToolsCompletedEvent): + """Emitted when the list of available MCP tools has been successfully retrieved.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseMcpListToolsWsFailed(BetaResponseMcpListToolsFailedEvent): + """Emitted when the attempt to list available MCP tools has failed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseMcpListToolsInWsProgress(BetaResponseMcpListToolsInProgressEvent): + """ + Emitted when the system is in the process of retrieving the list of available MCP tools. + """ + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseOutputTextAnnotationWsAdded(BetaResponseOutputTextAnnotationAddedEvent): + """Emitted when an annotation is added to output text content.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseWsQueued(BetaResponseQueuedEvent): + """Emitted when a response is queued and waiting to be processed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseCustomToolCallInputWsDelta(BetaResponseCustomToolCallInputDeltaEvent): + """Event representing a delta (partial update) to the input of a custom tool call.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class BetaResponseCustomToolCallInputWsDone(BetaResponseCustomToolCallInputDoneEvent): + """Event indicating that input for a custom tool call is complete.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + BetaResponsesServerEvent: TypeAlias = Annotated[ Union[ - BetaResponseAudioDeltaEvent, - BetaResponseAudioDoneEvent, - BetaResponseAudioTranscriptDeltaEvent, - BetaResponseAudioTranscriptDoneEvent, - BetaResponseCodeInterpreterCallCodeDeltaEvent, - BetaResponseCodeInterpreterCallCodeDoneEvent, - BetaResponseCodeInterpreterCallCompletedEvent, - BetaResponseCodeInterpreterCallInProgressEvent, - BetaResponseCodeInterpreterCallInterpretingEvent, - BetaResponseCompletedEvent, - BetaResponseContentPartAddedEvent, - BetaResponseContentPartDoneEvent, - BetaResponseCreatedEvent, - BetaResponseErrorEvent, - BetaResponseFileSearchCallCompletedEvent, - BetaResponseFileSearchCallInProgressEvent, - BetaResponseFileSearchCallSearchingEvent, - BetaResponseFunctionCallArgumentsDeltaEvent, - BetaResponseFunctionCallArgumentsDoneEvent, - BetaResponseInProgressEvent, - BetaResponseFailedEvent, - BetaResponseIncompleteEvent, - BetaResponseOutputItemAddedEvent, - BetaResponseOutputItemDoneEvent, - BetaResponseReasoningSummaryPartAddedEvent, - BetaResponseReasoningSummaryPartDoneEvent, - BetaResponseReasoningSummaryTextDeltaEvent, - BetaResponseReasoningSummaryTextDoneEvent, - BetaResponseReasoningTextDeltaEvent, - BetaResponseReasoningTextDoneEvent, - BetaResponseRefusalDeltaEvent, - BetaResponseRefusalDoneEvent, - BetaResponseTextDeltaEvent, - BetaResponseTextDoneEvent, - BetaResponseWebSearchCallCompletedEvent, - BetaResponseWebSearchCallInProgressEvent, - BetaResponseWebSearchCallSearchingEvent, - BetaResponseImageGenCallCompletedEvent, - BetaResponseImageGenCallGeneratingEvent, - BetaResponseImageGenCallInProgressEvent, - BetaResponseImageGenCallPartialImageEvent, - BetaResponseMcpCallArgumentsDeltaEvent, - BetaResponseMcpCallArgumentsDoneEvent, - BetaResponseMcpCallCompletedEvent, - BetaResponseMcpCallFailedEvent, - BetaResponseMcpCallInProgressEvent, - BetaResponseMcpListToolsCompletedEvent, - BetaResponseMcpListToolsFailedEvent, - BetaResponseMcpListToolsInProgressEvent, - BetaResponseOutputTextAnnotationAddedEvent, - BetaResponseQueuedEvent, - BetaResponseCustomToolCallInputDeltaEvent, - BetaResponseCustomToolCallInputDoneEvent, + BetaResponseAudioWsDelta, + BetaResponseAudioWsDone, + BetaResponseAudioTranscriptWsDelta, + BetaResponseAudioTranscriptWsDone, + BetaResponseCodeInterpreterCallCodeWsDelta, + BetaResponseCodeInterpreterCallCodeWsDone, + BetaResponseCodeInterpreterCallWsCompleted, + BetaResponseCodeInterpreterCallInWsProgress, + BetaResponseCodeInterpreterCallWsInterpreting, + BetaResponseWsCompleted, + BetaResponseContentPartWsAdded, + BetaResponseContentPartWsDone, + BetaResponseWsCreated, + BetaResponseWsError, + BetaResponseFileSearchCallWsCompleted, + BetaResponseFileSearchCallInWsProgress, + BetaResponseFileSearchCallWsSearching, + BetaResponseFunctionCallArgumentsWsDelta, + BetaResponseFunctionCallArgumentsWsDone, + BetaResponseInWsProgress, + BetaResponseWsFailed, + BetaResponseWsIncomplete, + BetaResponseOutputItemWsAdded, + BetaResponseOutputItemWsDone, + BetaResponseReasoningSummaryPartWsAdded, + BetaResponseReasoningSummaryPartWsDone, + BetaResponseReasoningSummaryTextWsDelta, + BetaResponseReasoningSummaryTextWsDone, + BetaResponseReasoningTextWsDelta, + BetaResponseReasoningTextWsDone, + BetaResponseRefusalWsDelta, + BetaResponseRefusalWsDone, + BetaResponseTextWsDelta, + BetaResponseTextWsDone, + BetaResponseWebSearchCallWsCompleted, + BetaResponseWebSearchCallInWsProgress, + BetaResponseWebSearchCallWsSearching, + BetaResponseImageGenCallWsCompleted, + BetaResponseImageGenCallWsGenerating, + BetaResponseImageGenCallInWsProgress, + BetaResponseImageGenCallPartialWsImage, + BetaResponseMcpCallArgumentsWsDelta, + BetaResponseMcpCallArgumentsWsDone, + BetaResponseMcpCallWsCompleted, + BetaResponseMcpCallWsFailed, + BetaResponseMcpCallInWsProgress, + BetaResponseMcpListToolsWsCompleted, + BetaResponseMcpListToolsWsFailed, + BetaResponseMcpListToolsInWsProgress, + BetaResponseOutputTextAnnotationWsAdded, + BetaResponseWsQueued, + BetaResponseCustomToolCallInputWsDelta, + BetaResponseCustomToolCallInputWsDone, BetaResponseInjectCreatedEvent, BetaResponseInjectFailedEvent, ], diff --git a/src/openai/types/responses/responses_client_event.py b/src/openai/types/responses/responses_client_event.py index 21ef6e17f5..e40f64bd81 100644 --- a/src/openai/types/responses/responses_client_event.py +++ b/src/openai/types/responses/responses_client_event.py @@ -351,6 +351,16 @@ class ResponsesClientEvent(BaseModel): for more information. """ + stream_id: Optional[str] = None + """The WebSocket lane for this response. + + Requests with the same `stream_id` are processed FIFO, and events for the + response echo the same `stream_id`. + + `stream_id` controls routing; `previous_response_id` controls conversation + lineage, so a new lane can fork from a response created on another lane. + """ + stream_options: Optional[StreamOptions] = None """Options for streaming responses. Only set this when you set `stream: true`.""" diff --git a/src/openai/types/responses/responses_client_event_param.py b/src/openai/types/responses/responses_client_event_param.py index 6a86c5a211..ddb0cbedac 100644 --- a/src/openai/types/responses/responses_client_event_param.py +++ b/src/openai/types/responses/responses_client_event_param.py @@ -352,6 +352,16 @@ class ResponsesClientEventParam(TypedDict, total=False): for more information. """ + stream_id: str + """The WebSocket lane for this response. + + Requests with the same `stream_id` are processed FIFO, and events for the + response echo the same `stream_id`. + + `stream_id` controls routing; `previous_response_id` controls conversation + lineage, so a new lane can fork from a response created on another lane. + """ + stream_options: Optional[StreamOptions] """Options for streaming responses. Only set this when you set `stream: true`.""" diff --git a/src/openai/types/responses/responses_server_event.py b/src/openai/types/responses/responses_server_event.py index 9c6c2d5e58..2ae4505366 100644 --- a/src/openai/types/responses/responses_server_event.py +++ b/src/openai/types/responses/responses_server_event.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details. -from typing import Union +from typing import Union, Optional from typing_extensions import Annotated, TypeAlias from ..._utils import PropertyInfo @@ -58,63 +58,710 @@ from .response_code_interpreter_call_in_progress_event import ResponseCodeInterpreterCallInProgressEvent from .response_code_interpreter_call_interpreting_event import ResponseCodeInterpreterCallInterpretingEvent -__all__ = ["ResponsesServerEvent"] +__all__ = [ + "ResponsesServerEvent", + "ResponseAudioWsDelta", + "ResponseAudioWsDone", + "ResponseAudioTranscriptWsDelta", + "ResponseAudioTranscriptWsDone", + "ResponseCodeInterpreterCallCodeWsDelta", + "ResponseCodeInterpreterCallCodeWsDone", + "ResponseCodeInterpreterCallWsCompleted", + "ResponseCodeInterpreterCallInWsProgress", + "ResponseCodeInterpreterCallWsInterpreting", + "ResponseWsCompleted", + "ResponseContentPartWsAdded", + "ResponseContentPartWsDone", + "ResponseWsCreated", + "ResponseWsError", + "ResponseFileSearchCallWsCompleted", + "ResponseFileSearchCallInWsProgress", + "ResponseFileSearchCallWsSearching", + "ResponseFunctionCallArgumentsWsDelta", + "ResponseFunctionCallArgumentsWsDone", + "ResponseInWsProgress", + "ResponseWsFailed", + "ResponseWsIncomplete", + "ResponseOutputItemWsAdded", + "ResponseOutputItemWsDone", + "ResponseReasoningSummaryPartWsAdded", + "ResponseReasoningSummaryPartWsDone", + "ResponseReasoningSummaryTextWsDelta", + "ResponseReasoningSummaryTextWsDone", + "ResponseReasoningTextWsDelta", + "ResponseReasoningTextWsDone", + "ResponseRefusalWsDelta", + "ResponseRefusalWsDone", + "ResponseTextWsDelta", + "ResponseTextWsDone", + "ResponseWebSearchCallWsCompleted", + "ResponseWebSearchCallInWsProgress", + "ResponseWebSearchCallWsSearching", + "ResponseImageGenCallWsCompleted", + "ResponseImageGenCallWsGenerating", + "ResponseImageGenCallInWsProgress", + "ResponseImageGenCallPartialWsImage", + "ResponseMcpCallArgumentsWsDelta", + "ResponseMcpCallArgumentsWsDone", + "ResponseMcpCallWsCompleted", + "ResponseMcpCallWsFailed", + "ResponseMcpCallInWsProgress", + "ResponseMcpListToolsWsCompleted", + "ResponseMcpListToolsWsFailed", + "ResponseMcpListToolsInWsProgress", + "ResponseOutputTextAnnotationWsAdded", + "ResponseWsQueued", + "ResponseCustomToolCallInputWsDelta", + "ResponseCustomToolCallInputWsDone", +] + + +class ResponseAudioWsDelta(ResponseAudioDeltaEvent): + """Emitted when there is a partial audio response.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseAudioWsDone(ResponseAudioDoneEvent): + """Emitted when the audio response is complete.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseAudioTranscriptWsDelta(ResponseAudioTranscriptDeltaEvent): + """Emitted when there is a partial transcript of audio.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseAudioTranscriptWsDone(ResponseAudioTranscriptDoneEvent): + """Emitted when the full audio transcript is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseCodeInterpreterCallCodeWsDelta(ResponseCodeInterpreterCallCodeDeltaEvent): + """Emitted when a partial code snippet is streamed by the code interpreter.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseCodeInterpreterCallCodeWsDone(ResponseCodeInterpreterCallCodeDoneEvent): + """Emitted when the code snippet is finalized by the code interpreter.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseCodeInterpreterCallWsCompleted(ResponseCodeInterpreterCallCompletedEvent): + """Emitted when the code interpreter call is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseCodeInterpreterCallInWsProgress(ResponseCodeInterpreterCallInProgressEvent): + """Emitted when a code interpreter call is in progress.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseCodeInterpreterCallWsInterpreting(ResponseCodeInterpreterCallInterpretingEvent): + """Emitted when the code interpreter is actively interpreting the code snippet.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWsCompleted(ResponseCompletedEvent): + """Emitted when the model response is complete.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseContentPartWsAdded(ResponseContentPartAddedEvent): + """Emitted when a new content part is added.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseContentPartWsDone(ResponseContentPartDoneEvent): + """Emitted when a content part is done.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWsCreated(ResponseCreatedEvent): + """An event that is emitted when a response is created.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWsError(ResponseErrorEvent): + """Emitted when an error occurs.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseFileSearchCallWsCompleted(ResponseFileSearchCallCompletedEvent): + """Emitted when a file search call is completed (results found).""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseFileSearchCallInWsProgress(ResponseFileSearchCallInProgressEvent): + """Emitted when a file search call is initiated.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseFileSearchCallWsSearching(ResponseFileSearchCallSearchingEvent): + """Emitted when a file search is currently searching.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseFunctionCallArgumentsWsDelta(ResponseFunctionCallArgumentsDeltaEvent): + """Emitted when there is a partial function-call arguments delta.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseFunctionCallArgumentsWsDone(ResponseFunctionCallArgumentsDoneEvent): + """Emitted when function-call arguments are finalized.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseInWsProgress(ResponseInProgressEvent): + """Emitted when the response is in progress.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWsFailed(ResponseFailedEvent): + """An event that is emitted when a response fails.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWsIncomplete(ResponseIncompleteEvent): + """An event that is emitted when a response finishes as incomplete.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseOutputItemWsAdded(ResponseOutputItemAddedEvent): + """Emitted when a new output item is added.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseOutputItemWsDone(ResponseOutputItemDoneEvent): + """Emitted when an output item is marked done.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseReasoningSummaryPartWsAdded(ResponseReasoningSummaryPartAddedEvent): + """Emitted when a new reasoning summary part is added.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseReasoningSummaryPartWsDone(ResponseReasoningSummaryPartDoneEvent): + """Emitted when a reasoning summary part is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseReasoningSummaryTextWsDelta(ResponseReasoningSummaryTextDeltaEvent): + """Emitted when a delta is added to a reasoning summary text.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseReasoningSummaryTextWsDone(ResponseReasoningSummaryTextDoneEvent): + """Emitted when a reasoning summary text is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseReasoningTextWsDelta(ResponseReasoningTextDeltaEvent): + """Emitted when a delta is added to a reasoning text.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseReasoningTextWsDone(ResponseReasoningTextDoneEvent): + """Emitted when a reasoning text is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseRefusalWsDelta(ResponseRefusalDeltaEvent): + """Emitted when there is a partial refusal text.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseRefusalWsDone(ResponseRefusalDoneEvent): + """Emitted when refusal text is finalized.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseTextWsDelta(ResponseTextDeltaEvent): + """Emitted when there is an additional text delta.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseTextWsDone(ResponseTextDoneEvent): + """Emitted when text content is finalized.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWebSearchCallWsCompleted(ResponseWebSearchCallCompletedEvent): + """Emitted when a web search call is completed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWebSearchCallInWsProgress(ResponseWebSearchCallInProgressEvent): + """Emitted when a web search call is initiated.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWebSearchCallWsSearching(ResponseWebSearchCallSearchingEvent): + """Emitted when a web search call is executing.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseImageGenCallWsCompleted(ResponseImageGenCallCompletedEvent): + """ + Emitted when an image generation tool call has completed and the final image is available. + """ + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseImageGenCallWsGenerating(ResponseImageGenCallGeneratingEvent): + """ + Emitted when an image generation tool call is actively generating an image (intermediate state). + """ + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseImageGenCallInWsProgress(ResponseImageGenCallInProgressEvent): + """Emitted when an image generation tool call is in progress.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseImageGenCallPartialWsImage(ResponseImageGenCallPartialImageEvent): + """Emitted when a partial image is available during image generation streaming.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseMcpCallArgumentsWsDelta(ResponseMcpCallArgumentsDeltaEvent): + """ + Emitted when there is a delta (partial update) to the arguments of an MCP tool call. + """ + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseMcpCallArgumentsWsDone(ResponseMcpCallArgumentsDoneEvent): + """Emitted when the arguments for an MCP tool call are finalized.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseMcpCallWsCompleted(ResponseMcpCallCompletedEvent): + """Emitted when an MCP tool call has completed successfully.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseMcpCallWsFailed(ResponseMcpCallFailedEvent): + """Emitted when an MCP tool call has failed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseMcpCallInWsProgress(ResponseMcpCallInProgressEvent): + """Emitted when an MCP tool call is in progress.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseMcpListToolsWsCompleted(ResponseMcpListToolsCompletedEvent): + """Emitted when the list of available MCP tools has been successfully retrieved.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseMcpListToolsWsFailed(ResponseMcpListToolsFailedEvent): + """Emitted when the attempt to list available MCP tools has failed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseMcpListToolsInWsProgress(ResponseMcpListToolsInProgressEvent): + """ + Emitted when the system is in the process of retrieving the list of available MCP tools. + """ + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseOutputTextAnnotationWsAdded(ResponseOutputTextAnnotationAddedEvent): + """Emitted when an annotation is added to output text content.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseWsQueued(ResponseQueuedEvent): + """Emitted when a response is queued and waiting to be processed.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseCustomToolCallInputWsDelta(ResponseCustomToolCallInputDeltaEvent): + """Event representing a delta (partial update) to the input of a custom tool call.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + + +class ResponseCustomToolCallInputWsDone(ResponseCustomToolCallInputDoneEvent): + """Event indicating that input for a custom tool call is complete.""" + + stream_id: Optional[str] = None + """The WebSocket lane that emitted this event. + + This field is present when the originating `response.create` event supplied a + `stream_id`. + """ + ResponsesServerEvent: TypeAlias = Annotated[ Union[ - ResponseAudioDeltaEvent, - ResponseAudioDoneEvent, - ResponseAudioTranscriptDeltaEvent, - ResponseAudioTranscriptDoneEvent, - ResponseCodeInterpreterCallCodeDeltaEvent, - ResponseCodeInterpreterCallCodeDoneEvent, - ResponseCodeInterpreterCallCompletedEvent, - ResponseCodeInterpreterCallInProgressEvent, - ResponseCodeInterpreterCallInterpretingEvent, - ResponseCompletedEvent, - ResponseContentPartAddedEvent, - ResponseContentPartDoneEvent, - ResponseCreatedEvent, - ResponseErrorEvent, - ResponseFileSearchCallCompletedEvent, - ResponseFileSearchCallInProgressEvent, - ResponseFileSearchCallSearchingEvent, - ResponseFunctionCallArgumentsDeltaEvent, - ResponseFunctionCallArgumentsDoneEvent, - ResponseInProgressEvent, - ResponseFailedEvent, - ResponseIncompleteEvent, - ResponseOutputItemAddedEvent, - ResponseOutputItemDoneEvent, - ResponseReasoningSummaryPartAddedEvent, - ResponseReasoningSummaryPartDoneEvent, - ResponseReasoningSummaryTextDeltaEvent, - ResponseReasoningSummaryTextDoneEvent, - ResponseReasoningTextDeltaEvent, - ResponseReasoningTextDoneEvent, - ResponseRefusalDeltaEvent, - ResponseRefusalDoneEvent, - ResponseTextDeltaEvent, - ResponseTextDoneEvent, - ResponseWebSearchCallCompletedEvent, - ResponseWebSearchCallInProgressEvent, - ResponseWebSearchCallSearchingEvent, - ResponseImageGenCallCompletedEvent, - ResponseImageGenCallGeneratingEvent, - ResponseImageGenCallInProgressEvent, - ResponseImageGenCallPartialImageEvent, - ResponseMcpCallArgumentsDeltaEvent, - ResponseMcpCallArgumentsDoneEvent, - ResponseMcpCallCompletedEvent, - ResponseMcpCallFailedEvent, - ResponseMcpCallInProgressEvent, - ResponseMcpListToolsCompletedEvent, - ResponseMcpListToolsFailedEvent, - ResponseMcpListToolsInProgressEvent, - ResponseOutputTextAnnotationAddedEvent, - ResponseQueuedEvent, - ResponseCustomToolCallInputDeltaEvent, - ResponseCustomToolCallInputDoneEvent, + ResponseAudioWsDelta, + ResponseAudioWsDone, + ResponseAudioTranscriptWsDelta, + ResponseAudioTranscriptWsDone, + ResponseCodeInterpreterCallCodeWsDelta, + ResponseCodeInterpreterCallCodeWsDone, + ResponseCodeInterpreterCallWsCompleted, + ResponseCodeInterpreterCallInWsProgress, + ResponseCodeInterpreterCallWsInterpreting, + ResponseWsCompleted, + ResponseContentPartWsAdded, + ResponseContentPartWsDone, + ResponseWsCreated, + ResponseWsError, + ResponseFileSearchCallWsCompleted, + ResponseFileSearchCallInWsProgress, + ResponseFileSearchCallWsSearching, + ResponseFunctionCallArgumentsWsDelta, + ResponseFunctionCallArgumentsWsDone, + ResponseInWsProgress, + ResponseWsFailed, + ResponseWsIncomplete, + ResponseOutputItemWsAdded, + ResponseOutputItemWsDone, + ResponseReasoningSummaryPartWsAdded, + ResponseReasoningSummaryPartWsDone, + ResponseReasoningSummaryTextWsDelta, + ResponseReasoningSummaryTextWsDone, + ResponseReasoningTextWsDelta, + ResponseReasoningTextWsDone, + ResponseRefusalWsDelta, + ResponseRefusalWsDone, + ResponseTextWsDelta, + ResponseTextWsDone, + ResponseWebSearchCallWsCompleted, + ResponseWebSearchCallInWsProgress, + ResponseWebSearchCallWsSearching, + ResponseImageGenCallWsCompleted, + ResponseImageGenCallWsGenerating, + ResponseImageGenCallInWsProgress, + ResponseImageGenCallPartialWsImage, + ResponseMcpCallArgumentsWsDelta, + ResponseMcpCallArgumentsWsDone, + ResponseMcpCallWsCompleted, + ResponseMcpCallWsFailed, + ResponseMcpCallInWsProgress, + ResponseMcpListToolsWsCompleted, + ResponseMcpListToolsWsFailed, + ResponseMcpListToolsInWsProgress, + ResponseOutputTextAnnotationWsAdded, + ResponseWsQueued, + ResponseCustomToolCallInputWsDelta, + ResponseCustomToolCallInputWsDone, ], PropertyInfo(discriminator="type"), ] diff --git a/tests/api_resources/test_videos.py b/tests/api_resources/test_videos.py index 71e87a4e4a..d93932c978 100644 --- a/tests/api_resources/test_videos.py +++ b/tests/api_resources/test_videos.py @@ -31,27 +31,32 @@ class TestVideos: @parametrize def test_method_create(self, client: OpenAI) -> None: - video = client.videos.create( - prompt="x", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.create( + prompt="x", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: OpenAI) -> None: - video = client.videos.create( - prompt="x", - input_reference=b"Example data", - model="sora-2", - seconds="4", - size="720x1280", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.create( + prompt="x", + input_reference=b"Example data", + model="sora-2", + seconds="4", + size="720x1280", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize def test_raw_response_create(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.create( - prompt="x", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.create( + prompt="x", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -60,29 +65,33 @@ def test_raw_response_create(self, client: OpenAI) -> None: @parametrize def test_streaming_response_create(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.create( - prompt="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.create( + prompt="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(Video, video, path=["response"]) + video = response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_retrieve(self, client: OpenAI) -> None: - video = client.videos.retrieve( - "video_123", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.retrieve( + "video_123", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.retrieve( - "video_123", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.retrieve( + "video_123", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -91,41 +100,48 @@ def test_raw_response_retrieve(self, client: OpenAI) -> None: @parametrize def test_streaming_response_retrieve(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.retrieve( - "video_123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.retrieve( + "video_123", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(Video, video, path=["response"]) + video = response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): - client.videos.with_raw_response.retrieve( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): + client.videos.with_raw_response.retrieve( + "", + ) @parametrize def test_method_list(self, client: OpenAI) -> None: - video = client.videos.list() + with pytest.warns(DeprecationWarning): + video = client.videos.list() + assert_matches_type(SyncConversationCursorPage[Video], video, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OpenAI) -> None: - video = client.videos.list( - after="after", - limit=0, - order="asc", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.list( + after="after", + limit=0, + order="asc", + ) + assert_matches_type(SyncConversationCursorPage[Video], video, path=["response"]) @parametrize def test_raw_response_list(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -134,27 +150,31 @@ def test_raw_response_list(self, client: OpenAI) -> None: @parametrize def test_streaming_response_list(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(SyncConversationCursorPage[Video], video, path=["response"]) + video = response.parse() + assert_matches_type(SyncConversationCursorPage[Video], video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: OpenAI) -> None: - video = client.videos.delete( - "video_123", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.delete( + "video_123", + ) + assert_matches_type(VideoDeleteResponse, video, path=["response"]) @parametrize def test_raw_response_delete(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.delete( - "video_123", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.delete( + "video_123", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -163,38 +183,43 @@ def test_raw_response_delete(self, client: OpenAI) -> None: @parametrize def test_streaming_response_delete(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.delete( - "video_123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.delete( + "video_123", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(VideoDeleteResponse, video, path=["response"]) + video = response.parse() + assert_matches_type(VideoDeleteResponse, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): - client.videos.with_raw_response.delete( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): + client.videos.with_raw_response.delete( + "", + ) @parametrize def test_method_create_character(self, client: OpenAI) -> None: - video = client.videos.create_character( - name="x", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.create_character( + name="x", + video=b"Example data", + ) + assert_matches_type(VideoCreateCharacterResponse, video, path=["response"]) @parametrize def test_raw_response_create_character(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.create_character( - name="x", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.create_character( + name="x", + video=b"Example data", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -203,15 +228,16 @@ def test_raw_response_create_character(self, client: OpenAI) -> None: @parametrize def test_streaming_response_create_character(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.create_character( - name="x", - video=b"Example data", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.create_character( + name="x", + video=b"Example data", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(VideoCreateCharacterResponse, video, path=["response"]) + video = response.parse() + assert_matches_type(VideoCreateCharacterResponse, video, path=["response"]) assert cast(Any, response.is_closed) is True @@ -219,9 +245,10 @@ def test_streaming_response_create_character(self, client: OpenAI) -> None: @pytest.mark.respx2(base_url=base_url) def test_method_download_content(self, client: OpenAI, respx2_mock: MockRouter) -> None: respx2_mock.get("/videos/video_123/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) - video = client.videos.download_content( - video_id="video_123", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.download_content( + video_id="video_123", + ) assert isinstance(video, _legacy_response.HttpxBinaryResponseContent) assert video.json() == {"foo": "bar"} @@ -229,10 +256,11 @@ def test_method_download_content(self, client: OpenAI, respx2_mock: MockRouter) @pytest.mark.respx2(base_url=base_url) def test_method_download_content_with_all_params(self, client: OpenAI, respx2_mock: MockRouter) -> None: respx2_mock.get("/videos/video_123/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) - video = client.videos.download_content( - video_id="video_123", - variant="video", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.download_content( + video_id="video_123", + variant="video", + ) assert isinstance(video, _legacy_response.HttpxBinaryResponseContent) assert video.json() == {"foo": "bar"} @@ -241,9 +269,10 @@ def test_method_download_content_with_all_params(self, client: OpenAI, respx2_mo def test_raw_response_download_content(self, client: OpenAI, respx2_mock: MockRouter) -> None: respx2_mock.get("/videos/video_123/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) - response = client.videos.with_raw_response.download_content( - video_id="video_123", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.download_content( + video_id="video_123", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -254,39 +283,44 @@ def test_raw_response_download_content(self, client: OpenAI, respx2_mock: MockRo @pytest.mark.respx2(base_url=base_url) def test_streaming_response_download_content(self, client: OpenAI, respx2_mock: MockRouter) -> None: respx2_mock.get("/videos/video_123/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) - with client.videos.with_streaming_response.download_content( - video_id="video_123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.download_content( + video_id="video_123", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(bytes, video, path=["response"]) + video = response.parse() + assert_matches_type(bytes, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize @pytest.mark.respx2(base_url=base_url) def test_path_params_download_content(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): - client.videos.with_raw_response.download_content( - video_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): + client.videos.with_raw_response.download_content( + video_id="", + ) @parametrize def test_method_edit(self, client: OpenAI) -> None: - video = client.videos.edit( - prompt="x", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.edit( + prompt="x", + video=b"Example data", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize def test_raw_response_edit(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.edit( - prompt="x", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.edit( + prompt="x", + video=b"Example data", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -295,34 +329,38 @@ def test_raw_response_edit(self, client: OpenAI) -> None: @parametrize def test_streaming_response_edit(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.edit( - prompt="x", - video=b"Example data", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.edit( + prompt="x", + video=b"Example data", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(Video, video, path=["response"]) + video = response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_extend(self, client: OpenAI) -> None: - video = client.videos.extend( - prompt="x", - seconds="4", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.extend( + prompt="x", + seconds="4", + video=b"Example data", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize def test_raw_response_extend(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.extend( - prompt="x", - seconds="4", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.extend( + prompt="x", + seconds="4", + video=b"Example data", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -331,31 +369,35 @@ def test_raw_response_extend(self, client: OpenAI) -> None: @parametrize def test_streaming_response_extend(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.extend( - prompt="x", - seconds="4", - video=b"Example data", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.extend( + prompt="x", + seconds="4", + video=b"Example data", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(Video, video, path=["response"]) + video = response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_get_character(self, client: OpenAI) -> None: - video = client.videos.get_character( - "char_123", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.get_character( + "char_123", + ) + assert_matches_type(VideoGetCharacterResponse, video, path=["response"]) @parametrize def test_raw_response_get_character(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.get_character( - "char_123", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.get_character( + "char_123", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -364,38 +406,43 @@ def test_raw_response_get_character(self, client: OpenAI) -> None: @parametrize def test_streaming_response_get_character(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.get_character( - "char_123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.get_character( + "char_123", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(VideoGetCharacterResponse, video, path=["response"]) + video = response.parse() + assert_matches_type(VideoGetCharacterResponse, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get_character(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `character_id` but received ''"): - client.videos.with_raw_response.get_character( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `character_id` but received ''"): + client.videos.with_raw_response.get_character( + "", + ) @parametrize def test_method_remix(self, client: OpenAI) -> None: - video = client.videos.remix( - video_id="video_123", - prompt="x", - ) + with pytest.warns(DeprecationWarning): + video = client.videos.remix( + video_id="video_123", + prompt="x", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize def test_raw_response_remix(self, client: OpenAI) -> None: - response = client.videos.with_raw_response.remix( - video_id="video_123", - prompt="x", - ) + with pytest.warns(DeprecationWarning): + response = client.videos.with_raw_response.remix( + video_id="video_123", + prompt="x", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -404,25 +451,27 @@ def test_raw_response_remix(self, client: OpenAI) -> None: @parametrize def test_streaming_response_remix(self, client: OpenAI) -> None: - with client.videos.with_streaming_response.remix( - video_id="video_123", - prompt="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.videos.with_streaming_response.remix( + video_id="video_123", + prompt="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = response.parse() - assert_matches_type(Video, video, path=["response"]) + video = response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_remix(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): - client.videos.with_raw_response.remix( - video_id="", - prompt="x", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): + client.videos.with_raw_response.remix( + video_id="", + prompt="x", + ) class TestAsyncVideos: @@ -432,27 +481,32 @@ class TestAsyncVideos: @parametrize async def test_method_create(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.create( - prompt="x", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.create( + prompt="x", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.create( - prompt="x", - input_reference=b"Example data", - model="sora-2", - seconds="4", - size="720x1280", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.create( + prompt="x", + input_reference=b"Example data", + model="sora-2", + seconds="4", + size="720x1280", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.create( - prompt="x", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.create( + prompt="x", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -461,29 +515,33 @@ async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.create( - prompt="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.create( + prompt="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(Video, video, path=["response"]) + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.retrieve( - "video_123", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.retrieve( + "video_123", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.retrieve( - "video_123", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.retrieve( + "video_123", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -492,41 +550,48 @@ async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.retrieve( - "video_123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.retrieve( + "video_123", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(Video, video, path=["response"]) + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): - await async_client.videos.with_raw_response.retrieve( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): + await async_client.videos.with_raw_response.retrieve( + "", + ) @parametrize async def test_method_list(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.list() + with pytest.warns(DeprecationWarning): + video = await async_client.videos.list() + assert_matches_type(AsyncConversationCursorPage[Video], video, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.list( - after="after", - limit=0, - order="asc", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.list( + after="after", + limit=0, + order="asc", + ) + assert_matches_type(AsyncConversationCursorPage[Video], video, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -535,27 +600,31 @@ async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(AsyncConversationCursorPage[Video], video, path=["response"]) + video = await response.parse() + assert_matches_type(AsyncConversationCursorPage[Video], video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.delete( - "video_123", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.delete( + "video_123", + ) + assert_matches_type(VideoDeleteResponse, video, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.delete( - "video_123", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.delete( + "video_123", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -564,38 +633,43 @@ async def test_raw_response_delete(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.delete( - "video_123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.delete( + "video_123", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(VideoDeleteResponse, video, path=["response"]) + video = await response.parse() + assert_matches_type(VideoDeleteResponse, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): - await async_client.videos.with_raw_response.delete( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): + await async_client.videos.with_raw_response.delete( + "", + ) @parametrize async def test_method_create_character(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.create_character( - name="x", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.create_character( + name="x", + video=b"Example data", + ) + assert_matches_type(VideoCreateCharacterResponse, video, path=["response"]) @parametrize async def test_raw_response_create_character(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.create_character( - name="x", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.create_character( + name="x", + video=b"Example data", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -604,15 +678,16 @@ async def test_raw_response_create_character(self, async_client: AsyncOpenAI) -> @parametrize async def test_streaming_response_create_character(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.create_character( - name="x", - video=b"Example data", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.create_character( + name="x", + video=b"Example data", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(VideoCreateCharacterResponse, video, path=["response"]) + video = await response.parse() + assert_matches_type(VideoCreateCharacterResponse, video, path=["response"]) assert cast(Any, response.is_closed) is True @@ -620,9 +695,10 @@ async def test_streaming_response_create_character(self, async_client: AsyncOpen @pytest.mark.respx2(base_url=base_url) async def test_method_download_content(self, async_client: AsyncOpenAI, respx2_mock: MockRouter) -> None: respx2_mock.get("/videos/video_123/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) - video = await async_client.videos.download_content( - video_id="video_123", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.download_content( + video_id="video_123", + ) assert isinstance(video, _legacy_response.HttpxBinaryResponseContent) assert video.json() == {"foo": "bar"} @@ -632,10 +708,11 @@ async def test_method_download_content_with_all_params( self, async_client: AsyncOpenAI, respx2_mock: MockRouter ) -> None: respx2_mock.get("/videos/video_123/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) - video = await async_client.videos.download_content( - video_id="video_123", - variant="video", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.download_content( + video_id="video_123", + variant="video", + ) assert isinstance(video, _legacy_response.HttpxBinaryResponseContent) assert video.json() == {"foo": "bar"} @@ -644,9 +721,10 @@ async def test_method_download_content_with_all_params( async def test_raw_response_download_content(self, async_client: AsyncOpenAI, respx2_mock: MockRouter) -> None: respx2_mock.get("/videos/video_123/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) - response = await async_client.videos.with_raw_response.download_content( - video_id="video_123", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.download_content( + video_id="video_123", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -659,39 +737,44 @@ async def test_streaming_response_download_content( self, async_client: AsyncOpenAI, respx2_mock: MockRouter ) -> None: respx2_mock.get("/videos/video_123/content").mock(return_value=httpx2.Response(200, json={"foo": "bar"})) - async with async_client.videos.with_streaming_response.download_content( - video_id="video_123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.download_content( + video_id="video_123", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(bytes, video, path=["response"]) + video = await response.parse() + assert_matches_type(bytes, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize @pytest.mark.respx2(base_url=base_url) async def test_path_params_download_content(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): - await async_client.videos.with_raw_response.download_content( - video_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): + await async_client.videos.with_raw_response.download_content( + video_id="", + ) @parametrize async def test_method_edit(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.edit( - prompt="x", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.edit( + prompt="x", + video=b"Example data", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.edit( - prompt="x", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.edit( + prompt="x", + video=b"Example data", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -700,34 +783,38 @@ async def test_raw_response_edit(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_edit(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.edit( - prompt="x", - video=b"Example data", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.edit( + prompt="x", + video=b"Example data", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(Video, video, path=["response"]) + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_extend(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.extend( - prompt="x", - seconds="4", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.extend( + prompt="x", + seconds="4", + video=b"Example data", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize async def test_raw_response_extend(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.extend( - prompt="x", - seconds="4", - video=b"Example data", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.extend( + prompt="x", + seconds="4", + video=b"Example data", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -736,31 +823,35 @@ async def test_raw_response_extend(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_extend(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.extend( - prompt="x", - seconds="4", - video=b"Example data", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.extend( + prompt="x", + seconds="4", + video=b"Example data", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(Video, video, path=["response"]) + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_get_character(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.get_character( - "char_123", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.get_character( + "char_123", + ) + assert_matches_type(VideoGetCharacterResponse, video, path=["response"]) @parametrize async def test_raw_response_get_character(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.get_character( - "char_123", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.get_character( + "char_123", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -769,38 +860,43 @@ async def test_raw_response_get_character(self, async_client: AsyncOpenAI) -> No @parametrize async def test_streaming_response_get_character(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.get_character( - "char_123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.get_character( + "char_123", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(VideoGetCharacterResponse, video, path=["response"]) + video = await response.parse() + assert_matches_type(VideoGetCharacterResponse, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get_character(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `character_id` but received ''"): - await async_client.videos.with_raw_response.get_character( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `character_id` but received ''"): + await async_client.videos.with_raw_response.get_character( + "", + ) @parametrize async def test_method_remix(self, async_client: AsyncOpenAI) -> None: - video = await async_client.videos.remix( - video_id="video_123", - prompt="x", - ) + with pytest.warns(DeprecationWarning): + video = await async_client.videos.remix( + video_id="video_123", + prompt="x", + ) + assert_matches_type(Video, video, path=["response"]) @parametrize async def test_raw_response_remix(self, async_client: AsyncOpenAI) -> None: - response = await async_client.videos.with_raw_response.remix( - video_id="video_123", - prompt="x", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.videos.with_raw_response.remix( + video_id="video_123", + prompt="x", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -809,25 +905,27 @@ async def test_raw_response_remix(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_remix(self, async_client: AsyncOpenAI) -> None: - async with async_client.videos.with_streaming_response.remix( - video_id="video_123", - prompt="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.videos.with_streaming_response.remix( + video_id="video_123", + prompt="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - video = await response.parse() - assert_matches_type(Video, video, path=["response"]) + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_remix(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): - await async_client.videos.with_raw_response.remix( - video_id="", - prompt="x", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `video_id` but received ''"): + await async_client.videos.with_raw_response.remix( + video_id="", + prompt="x", + ) @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) @@ -835,7 +933,7 @@ def test_create_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client checking_client: OpenAI | AsyncOpenAI = client if sync else async_client assert_signatures_in_sync( - checking_client.videos.create, - checking_client.videos.create_and_poll, + checking_client.videos.create, # pyright: ignore[reportDeprecated] + checking_client.videos.create_and_poll, # pyright: ignore[reportDeprecated] exclude_params={"extra_headers", "extra_query", "extra_body", "timeout"}, )