diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7f3f5c84..354c2fa8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.23.0" + ".": "0.23.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 36a3c7f5..2aa16be8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 118 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-7807ec6037efcee1af7decbfd3974a42b761fb6c6a71b4050fe43484d7fcbac4.yml -openapi_spec_hash: da6851e3891ad2659a50ed6a736fd32a -config_hash: 74d955cdc2377213f5268ea309090f6c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-16cb18bed32bae8c5840fb39a1bf664026cc40463ad0c487dcb0df1bd3d72db0.yml +openapi_spec_hash: 4cb51b22f98dee1a90bc7add82d1d132 +config_hash: 930dac3aa861344867e4ac84f037b5df diff --git a/CHANGELOG.md b/CHANGELOG.md index b997b4c3..d8b3a290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.23.1 (2025-09-10) + +Full Changelog: [v0.23.0...v0.23.1](https://github.com/openai/openai-ruby/compare/v0.23.0...v0.23.1) + +### Chores + +* **api:** fix realtime GA types ([342f8d9](https://github.com/openai/openai-ruby/commit/342f8d9a4322cc1afba9aeabc1ff0fda5daec5c3)) + ## 0.23.0 (2025-09-08) Full Changelog: [v0.22.1...v0.23.0](https://github.com/openai/openai-ruby/compare/v0.22.1...v0.23.0) diff --git a/Gemfile.lock b/Gemfile.lock index 8884cf10..85e14eb4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - openai (0.23.0) + openai (0.23.1) connection_pool GEM diff --git a/README.md b/README.md index 886f17cc..ace31963 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "openai", "~> 0.23.0" +gem "openai", "~> 0.23.1" ``` diff --git a/lib/openai.rb b/lib/openai.rb index 62c0ab89..90c25945 100644 --- a/lib/openai.rb +++ b/lib/openai.rb @@ -411,7 +411,6 @@ require_relative "openai/models/realtime/mcp_list_tools_completed" require_relative "openai/models/realtime/mcp_list_tools_failed" require_relative "openai/models/realtime/mcp_list_tools_in_progress" -require_relative "openai/models/realtime/models" require_relative "openai/models/realtime/noise_reduction_type" require_relative "openai/models/realtime/output_audio_buffer_clear_event" require_relative "openai/models/realtime/rate_limits_updated_event" @@ -428,6 +427,7 @@ require_relative "openai/models/realtime/realtime_conversation_item_user_message" require_relative "openai/models/realtime/realtime_error" require_relative "openai/models/realtime/realtime_error_event" +require_relative "openai/models/realtime/realtime_function_tool" require_relative "openai/models/realtime/realtime_mcp_approval_request" require_relative "openai/models/realtime/realtime_mcp_approval_response" require_relative "openai/models/realtime/realtime_mcphttp_error" @@ -455,10 +455,8 @@ require_relative "openai/models/realtime/realtime_transcription_session_audio" require_relative "openai/models/realtime/realtime_transcription_session_audio_input" require_relative "openai/models/realtime/realtime_transcription_session_audio_input_turn_detection" -require_relative "openai/models/realtime/realtime_transcription_session_client_secret" require_relative "openai/models/realtime/realtime_transcription_session_create_request" require_relative "openai/models/realtime/realtime_transcription_session_create_response" -require_relative "openai/models/realtime/realtime_transcription_session_input_audio_transcription" require_relative "openai/models/realtime/realtime_transcription_session_turn_detection" require_relative "openai/models/realtime/realtime_truncation" require_relative "openai/models/realtime/realtime_truncation_retention_ratio" @@ -486,7 +484,6 @@ require_relative "openai/models/realtime/session_created_event" require_relative "openai/models/realtime/session_updated_event" require_relative "openai/models/realtime/session_update_event" -require_relative "openai/models/realtime/transcription_session_created" require_relative "openai/models/realtime/transcription_session_update" require_relative "openai/models/realtime/transcription_session_updated_event" require_relative "openai/models/reasoning" diff --git a/lib/openai/models/realtime/client_secret_create_response.rb b/lib/openai/models/realtime/client_secret_create_response.rb index 47e4a0ba..11c049b8 100644 --- a/lib/openai/models/realtime/client_secret_create_response.rb +++ b/lib/openai/models/realtime/client_secret_create_response.rb @@ -41,16 +41,14 @@ class ClientSecretCreateResponse < OpenAI::Internal::Type::BaseModel module Session extend OpenAI::Internal::Type::Union + discriminator :type + # A new Realtime session configuration, with an ephemeral key. Default TTL # for keys is one minute. - variant -> { OpenAI::Realtime::RealtimeSessionCreateResponse } - - # A new Realtime transcription session configuration. - # - # When a session is created on the server via REST API, the session object - # also contains an ephemeral key. Default TTL for keys is 10 minutes. This - # property is not present when a session is updated via the WebSocket API. - variant -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse } + variant :realtime, -> { OpenAI::Realtime::RealtimeSessionCreateResponse } + + # A Realtime transcription session configuration object. + variant :transcription, -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse } # @!method self.variants # @return [Array(OpenAI::Models::Realtime::RealtimeSessionCreateResponse, OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse)] diff --git a/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb b/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb index c2e87f19..c1695bed 100644 --- a/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb +++ b/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb @@ -22,7 +22,7 @@ class RealtimeAudioInputTurnDetection < OpenAI::Internal::Type::BaseModel # @!attribute idle_timeout_ms # Optional idle timeout after which turn detection will auto-timeout when no - # additional audio is received. + # additional audio is received and emits a `timeout_triggered` event. # # @return [Integer, nil] optional :idle_timeout_ms, Integer, nil?: true diff --git a/lib/openai/models/realtime/realtime_client_event.rb b/lib/openai/models/realtime/realtime_client_event.rb index bd5a4ca0..dae4f6cd 100644 --- a/lib/openai/models/realtime/realtime_client_event.rb +++ b/lib/openai/models/realtime/realtime_client_event.rb @@ -110,8 +110,7 @@ module RealtimeClientEvent # Send this event to update the session’s configuration. # The client may send this event at any time to update any field - # except for `voice` and `model`. `voice` can be updated only if there have been no other - # audio outputs yet. + # except for `voice` and `model`. `voice` can be updated only if there have been no other audio outputs yet. # # When the server receives a `session.update`, it will respond # with a `session.updated` event showing the full, effective configuration. @@ -120,11 +119,8 @@ module RealtimeClientEvent # To clear a field like `turn_detection`, pass `null`. variant :"session.update", -> { OpenAI::Realtime::SessionUpdateEvent } - # Send this event to update a transcription session. - variant :"transcription_session.update", -> { OpenAI::Realtime::TranscriptionSessionUpdate } - # @!method self.variants - # @return [Array(OpenAI::Models::Realtime::ConversationItemCreateEvent, OpenAI::Models::Realtime::ConversationItemDeleteEvent, OpenAI::Models::Realtime::ConversationItemRetrieveEvent, OpenAI::Models::Realtime::ConversationItemTruncateEvent, OpenAI::Models::Realtime::InputAudioBufferAppendEvent, OpenAI::Models::Realtime::InputAudioBufferClearEvent, OpenAI::Models::Realtime::OutputAudioBufferClearEvent, OpenAI::Models::Realtime::InputAudioBufferCommitEvent, OpenAI::Models::Realtime::ResponseCancelEvent, OpenAI::Models::Realtime::ResponseCreateEvent, OpenAI::Models::Realtime::SessionUpdateEvent, OpenAI::Models::Realtime::TranscriptionSessionUpdate)] + # @return [Array(OpenAI::Models::Realtime::ConversationItemCreateEvent, OpenAI::Models::Realtime::ConversationItemDeleteEvent, OpenAI::Models::Realtime::ConversationItemRetrieveEvent, OpenAI::Models::Realtime::ConversationItemTruncateEvent, OpenAI::Models::Realtime::InputAudioBufferAppendEvent, OpenAI::Models::Realtime::InputAudioBufferClearEvent, OpenAI::Models::Realtime::OutputAudioBufferClearEvent, OpenAI::Models::Realtime::InputAudioBufferCommitEvent, OpenAI::Models::Realtime::ResponseCancelEvent, OpenAI::Models::Realtime::ResponseCreateEvent, OpenAI::Models::Realtime::SessionUpdateEvent)] end end end diff --git a/lib/openai/models/realtime/models.rb b/lib/openai/models/realtime/realtime_function_tool.rb similarity index 74% rename from lib/openai/models/realtime/models.rb rename to lib/openai/models/realtime/realtime_function_tool.rb index 332349c1..ae178fcd 100644 --- a/lib/openai/models/realtime/models.rb +++ b/lib/openai/models/realtime/realtime_function_tool.rb @@ -3,7 +3,7 @@ module OpenAI module Models module Realtime - class Models < OpenAI::Internal::Type::BaseModel + class RealtimeFunctionTool < OpenAI::Internal::Type::BaseModel # @!attribute description # The description of the function, including guidance on when and how to call it, # and guidance about what to tell the user when calling (if anything). @@ -26,12 +26,12 @@ class Models < OpenAI::Internal::Type::BaseModel # @!attribute type # The type of the tool, i.e. `function`. # - # @return [Symbol, OpenAI::Models::Realtime::Models::Type, nil] - optional :type, enum: -> { OpenAI::Realtime::Models::Type } + # @return [Symbol, OpenAI::Models::Realtime::RealtimeFunctionTool::Type, nil] + optional :type, enum: -> { OpenAI::Realtime::RealtimeFunctionTool::Type } # @!method initialize(description: nil, name: nil, parameters: nil, type: nil) # Some parameter documentations has been truncated, see - # {OpenAI::Models::Realtime::Models} for more details. + # {OpenAI::Models::Realtime::RealtimeFunctionTool} for more details. # # @param description [String] The description of the function, including guidance on when and how # @@ -39,11 +39,11 @@ class Models < OpenAI::Internal::Type::BaseModel # # @param parameters [Object] Parameters of the function in JSON Schema. # - # @param type [Symbol, OpenAI::Models::Realtime::Models::Type] The type of the tool, i.e. `function`. + # @param type [Symbol, OpenAI::Models::Realtime::RealtimeFunctionTool::Type] The type of the tool, i.e. `function`. # The type of the tool, i.e. `function`. # - # @see OpenAI::Models::Realtime::Models#type + # @see OpenAI::Models::Realtime::RealtimeFunctionTool#type module Type extend OpenAI::Internal::Type::Enum diff --git a/lib/openai/models/realtime/realtime_response_create_params.rb b/lib/openai/models/realtime/realtime_response_create_params.rb index c6f9458f..31378b94 100644 --- a/lib/openai/models/realtime/realtime_response_create_params.rb +++ b/lib/openai/models/realtime/realtime_response_create_params.rb @@ -90,7 +90,7 @@ class RealtimeResponseCreateParams < OpenAI::Internal::Type::BaseModel # @!attribute tools # Tools available to the model. # - # @return [Array, nil] + # @return [Array, nil] optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::RealtimeResponseCreateParams::Tool] } @@ -118,7 +118,7 @@ class RealtimeResponseCreateParams < OpenAI::Internal::Type::BaseModel # # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific # - # @param tools [Array] Tools available to the model. + # @param tools [Array] Tools available to the model. # Controls which conversation the response is added to. Currently supports `auto` # and `none`, with `auto` as the default value. The `auto` value means that the @@ -210,14 +210,14 @@ module ToolChoice module Tool extend OpenAI::Internal::Type::Union - variant -> { OpenAI::Realtime::Models } + variant -> { OpenAI::Realtime::RealtimeFunctionTool } # Give the model access to additional tools via remote Model Context Protocol # (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp). variant -> { OpenAI::Realtime::RealtimeResponseCreateMcpTool } # @!method self.variants - # @return [Array(OpenAI::Models::Realtime::Models, OpenAI::Models::Realtime::RealtimeResponseCreateMcpTool)] + # @return [Array(OpenAI::Models::Realtime::RealtimeFunctionTool, OpenAI::Models::Realtime::RealtimeResponseCreateMcpTool)] end end end diff --git a/lib/openai/models/realtime/realtime_server_event.rb b/lib/openai/models/realtime/realtime_server_event.rb index 33b083c2..af9f4692 100644 --- a/lib/openai/models/realtime/realtime_server_event.rb +++ b/lib/openai/models/realtime/realtime_server_event.rb @@ -173,13 +173,6 @@ module RealtimeServerEvent # there is an error. variant :"session.updated", -> { OpenAI::Realtime::SessionUpdatedEvent } - # Returned when a transcription session is updated with a `transcription_session.update` event, unless - # there is an error. - variant :"transcription_session.updated", -> { OpenAI::Realtime::TranscriptionSessionUpdatedEvent } - - # Returned when a transcription session is created. - variant :"transcription_session.created", -> { OpenAI::Realtime::TranscriptionSessionCreated } - # **WebRTC Only:** Emitted when the server begins streaming audio to the client. This event is # emitted after an audio content part has been added (`response.content_part.added`) # to the response. @@ -378,7 +371,7 @@ class OutputAudioBufferCleared < OpenAI::Internal::Type::BaseModel end # @!method self.variants - # @return [Array(OpenAI::Models::Realtime::ConversationCreatedEvent, OpenAI::Models::Realtime::ConversationItemCreatedEvent, OpenAI::Models::Realtime::ConversationItemDeletedEvent, OpenAI::Models::Realtime::ConversationItemInputAudioTranscriptionCompletedEvent, OpenAI::Models::Realtime::ConversationItemInputAudioTranscriptionDeltaEvent, OpenAI::Models::Realtime::ConversationItemInputAudioTranscriptionFailedEvent, OpenAI::Models::Realtime::RealtimeServerEvent::ConversationItemRetrieved, OpenAI::Models::Realtime::ConversationItemTruncatedEvent, OpenAI::Models::Realtime::RealtimeErrorEvent, OpenAI::Models::Realtime::InputAudioBufferClearedEvent, OpenAI::Models::Realtime::InputAudioBufferCommittedEvent, OpenAI::Models::Realtime::InputAudioBufferSpeechStartedEvent, OpenAI::Models::Realtime::InputAudioBufferSpeechStoppedEvent, OpenAI::Models::Realtime::RateLimitsUpdatedEvent, OpenAI::Models::Realtime::ResponseAudioDeltaEvent, OpenAI::Models::Realtime::ResponseAudioDoneEvent, OpenAI::Models::Realtime::ResponseAudioTranscriptDeltaEvent, OpenAI::Models::Realtime::ResponseAudioTranscriptDoneEvent, OpenAI::Models::Realtime::ResponseContentPartAddedEvent, OpenAI::Models::Realtime::ResponseContentPartDoneEvent, OpenAI::Models::Realtime::ResponseCreatedEvent, OpenAI::Models::Realtime::ResponseDoneEvent, OpenAI::Models::Realtime::ResponseFunctionCallArgumentsDeltaEvent, OpenAI::Models::Realtime::ResponseFunctionCallArgumentsDoneEvent, OpenAI::Models::Realtime::ResponseOutputItemAddedEvent, OpenAI::Models::Realtime::ResponseOutputItemDoneEvent, OpenAI::Models::Realtime::ResponseTextDeltaEvent, OpenAI::Models::Realtime::ResponseTextDoneEvent, OpenAI::Models::Realtime::SessionCreatedEvent, OpenAI::Models::Realtime::SessionUpdatedEvent, OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent, OpenAI::Models::Realtime::TranscriptionSessionCreated, OpenAI::Models::Realtime::RealtimeServerEvent::OutputAudioBufferStarted, OpenAI::Models::Realtime::RealtimeServerEvent::OutputAudioBufferStopped, OpenAI::Models::Realtime::RealtimeServerEvent::OutputAudioBufferCleared, OpenAI::Models::Realtime::ConversationItemAdded, OpenAI::Models::Realtime::ConversationItemDone, OpenAI::Models::Realtime::InputAudioBufferTimeoutTriggered, OpenAI::Models::Realtime::ConversationItemInputAudioTranscriptionSegment, OpenAI::Models::Realtime::McpListToolsInProgress, OpenAI::Models::Realtime::McpListToolsCompleted, OpenAI::Models::Realtime::McpListToolsFailed, OpenAI::Models::Realtime::ResponseMcpCallArgumentsDelta, OpenAI::Models::Realtime::ResponseMcpCallArgumentsDone, OpenAI::Models::Realtime::ResponseMcpCallInProgress, OpenAI::Models::Realtime::ResponseMcpCallCompleted, OpenAI::Models::Realtime::ResponseMcpCallFailed)] + # @return [Array(OpenAI::Models::Realtime::ConversationCreatedEvent, OpenAI::Models::Realtime::ConversationItemCreatedEvent, OpenAI::Models::Realtime::ConversationItemDeletedEvent, OpenAI::Models::Realtime::ConversationItemInputAudioTranscriptionCompletedEvent, OpenAI::Models::Realtime::ConversationItemInputAudioTranscriptionDeltaEvent, OpenAI::Models::Realtime::ConversationItemInputAudioTranscriptionFailedEvent, OpenAI::Models::Realtime::RealtimeServerEvent::ConversationItemRetrieved, OpenAI::Models::Realtime::ConversationItemTruncatedEvent, OpenAI::Models::Realtime::RealtimeErrorEvent, OpenAI::Models::Realtime::InputAudioBufferClearedEvent, OpenAI::Models::Realtime::InputAudioBufferCommittedEvent, OpenAI::Models::Realtime::InputAudioBufferSpeechStartedEvent, OpenAI::Models::Realtime::InputAudioBufferSpeechStoppedEvent, OpenAI::Models::Realtime::RateLimitsUpdatedEvent, OpenAI::Models::Realtime::ResponseAudioDeltaEvent, OpenAI::Models::Realtime::ResponseAudioDoneEvent, OpenAI::Models::Realtime::ResponseAudioTranscriptDeltaEvent, OpenAI::Models::Realtime::ResponseAudioTranscriptDoneEvent, OpenAI::Models::Realtime::ResponseContentPartAddedEvent, OpenAI::Models::Realtime::ResponseContentPartDoneEvent, OpenAI::Models::Realtime::ResponseCreatedEvent, OpenAI::Models::Realtime::ResponseDoneEvent, OpenAI::Models::Realtime::ResponseFunctionCallArgumentsDeltaEvent, OpenAI::Models::Realtime::ResponseFunctionCallArgumentsDoneEvent, OpenAI::Models::Realtime::ResponseOutputItemAddedEvent, OpenAI::Models::Realtime::ResponseOutputItemDoneEvent, OpenAI::Models::Realtime::ResponseTextDeltaEvent, OpenAI::Models::Realtime::ResponseTextDoneEvent, OpenAI::Models::Realtime::SessionCreatedEvent, OpenAI::Models::Realtime::SessionUpdatedEvent, OpenAI::Models::Realtime::RealtimeServerEvent::OutputAudioBufferStarted, OpenAI::Models::Realtime::RealtimeServerEvent::OutputAudioBufferStopped, OpenAI::Models::Realtime::RealtimeServerEvent::OutputAudioBufferCleared, OpenAI::Models::Realtime::ConversationItemAdded, OpenAI::Models::Realtime::ConversationItemDone, OpenAI::Models::Realtime::InputAudioBufferTimeoutTriggered, OpenAI::Models::Realtime::ConversationItemInputAudioTranscriptionSegment, OpenAI::Models::Realtime::McpListToolsInProgress, OpenAI::Models::Realtime::McpListToolsCompleted, OpenAI::Models::Realtime::McpListToolsFailed, OpenAI::Models::Realtime::ResponseMcpCallArgumentsDelta, OpenAI::Models::Realtime::ResponseMcpCallArgumentsDone, OpenAI::Models::Realtime::ResponseMcpCallInProgress, OpenAI::Models::Realtime::ResponseMcpCallCompleted, OpenAI::Models::Realtime::ResponseMcpCallFailed)] end end end diff --git a/lib/openai/models/realtime/realtime_session.rb b/lib/openai/models/realtime/realtime_session.rb index 69f3c37c..035c49f7 100644 --- a/lib/openai/models/realtime/realtime_session.rb +++ b/lib/openai/models/realtime/realtime_session.rb @@ -142,8 +142,8 @@ class RealtimeSession < OpenAI::Internal::Type::BaseModel # @!attribute tools # Tools (functions) available to the model. # - # @return [Array, nil] - optional :tools, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Realtime::Models] } + # @return [Array, nil] + optional :tools, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Realtime::RealtimeFunctionTool] } # @!attribute tracing # Configuration options for tracing. Set to null to disable tracing. Once tracing @@ -216,7 +216,7 @@ class RealtimeSession < OpenAI::Internal::Type::BaseModel # # @param tool_choice [String] How the model chooses tools. Options are `auto`, `none`, `required`, or # - # @param tools [Array] Tools (functions) available to the model. + # @param tools [Array] Tools (functions) available to the model. # # @param tracing [Symbol, :auto, OpenAI::Models::Realtime::RealtimeSession::Tracing::TracingConfiguration, nil] Configuration options for tracing. Set to null to disable tracing. Once # diff --git a/lib/openai/models/realtime/realtime_session_create_request.rb b/lib/openai/models/realtime/realtime_session_create_request.rb index 62e0e9e5..e668357e 100644 --- a/lib/openai/models/realtime/realtime_session_create_request.rb +++ b/lib/openai/models/realtime/realtime_session_create_request.rb @@ -83,7 +83,7 @@ class RealtimeSessionCreateRequest < OpenAI::Internal::Type::BaseModel # @!attribute tools # Tools available to the model. # - # @return [Array, nil] + # @return [Array, nil] optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::RealtimeToolsConfigUnion] } # @!attribute tracing @@ -126,7 +126,7 @@ class RealtimeSessionCreateRequest < OpenAI::Internal::Type::BaseModel # # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific # - # @param tools [Array] Tools available to the model. + # @param tools [Array] Tools available to the model. # # @param tracing [Symbol, :auto, OpenAI::Models::Realtime::RealtimeTracingConfig::TracingConfiguration, nil] Realtime API can write session traces to the [Traces Dashboard](/logs?api=traces # diff --git a/lib/openai/models/realtime/realtime_session_create_response.rb b/lib/openai/models/realtime/realtime_session_create_response.rb index 9824439c..3adf8f09 100644 --- a/lib/openai/models/realtime/realtime_session_create_response.rb +++ b/lib/openai/models/realtime/realtime_session_create_response.rb @@ -4,18 +4,24 @@ module OpenAI module Models module Realtime class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel + # @!attribute client_secret + # Ephemeral key returned by the API. + # + # @return [OpenAI::Models::Realtime::RealtimeSessionClientSecret] + required :client_secret, -> { OpenAI::Realtime::RealtimeSessionClientSecret } + + # @!attribute type + # The type of session to create. Always `realtime` for the Realtime API. + # + # @return [Symbol, :realtime] + required :type, const: :realtime + # @!attribute audio # Configuration for input and output audio. # # @return [OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio, nil] optional :audio, -> { OpenAI::Realtime::RealtimeSessionCreateResponse::Audio } - # @!attribute client_secret - # Ephemeral key returned by the API. - # - # @return [OpenAI::Models::Realtime::RealtimeSessionClientSecret, nil] - optional :client_secret, -> { OpenAI::Realtime::RealtimeSessionClientSecret } - # @!attribute include # Additional fields to include in server outputs. # @@ -84,7 +90,7 @@ class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel # @!attribute tools # Tools available to the model. # - # @return [Array, nil] + # @return [Array, nil] optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::RealtimeSessionCreateResponse::Tool] } @@ -106,23 +112,17 @@ class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel # @return [Symbol, OpenAI::Models::Realtime::RealtimeTruncation::RealtimeTruncationStrategy, OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio, nil] optional :truncation, union: -> { OpenAI::Realtime::RealtimeTruncation } - # @!attribute type - # The type of session to create. Always `realtime` for the Realtime API. - # - # @return [Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Type, nil] - optional :type, enum: -> { OpenAI::Realtime::RealtimeSessionCreateResponse::Type } - - # @!method initialize(audio: nil, client_secret: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: nil) + # @!method initialize(client_secret:, audio: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: :realtime) # Some parameter documentations has been truncated, see # {OpenAI::Models::Realtime::RealtimeSessionCreateResponse} for more details. # # A new Realtime session configuration, with an ephemeral key. Default TTL for # keys is one minute. # - # @param audio [OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio] Configuration for input and output audio. - # # @param client_secret [OpenAI::Models::Realtime::RealtimeSessionClientSecret] Ephemeral key returned by the API. # + # @param audio [OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio] Configuration for input and output audio. + # # @param include [Array] Additional fields to include in server outputs. # # @param instructions [String] The default system instructions (i.e. system message) prepended to model calls. @@ -137,13 +137,13 @@ class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel # # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific # - # @param tools [Array] Tools available to the model. + # @param tools [Array] Tools available to the model. # # @param tracing [Symbol, :auto, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Tracing::TracingConfiguration, nil] Realtime API can write session traces to the [Traces Dashboard](/logs?api=traces # # @param truncation [Symbol, OpenAI::Models::Realtime::RealtimeTruncation::RealtimeTruncationStrategy, OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio] Controls how the realtime conversation is truncated prior to model inference. # - # @param type [Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Type] The type of session to create. Always `realtime` for the Realtime API. + # @param type [Symbol, :realtime] The type of session to create. Always `realtime` for the Realtime API. # @see OpenAI::Models::Realtime::RealtimeSessionCreateResponse#audio class Audio < OpenAI::Internal::Type::BaseModel @@ -269,7 +269,7 @@ class TurnDetection < OpenAI::Internal::Type::BaseModel # @!attribute idle_timeout_ms # Optional idle timeout after which turn detection will auto-timeout when no - # additional audio is received. + # additional audio is received and emits a `timeout_triggered` event. # # @return [Integer, nil] optional :idle_timeout_ms, Integer, nil?: true @@ -586,7 +586,7 @@ module ToolChoice module Tool extend OpenAI::Internal::Type::Union - variant -> { OpenAI::Realtime::Models } + variant -> { OpenAI::Realtime::RealtimeFunctionTool } # Give the model access to additional tools via remote Model Context Protocol # (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp). @@ -902,7 +902,7 @@ module McpToolApprovalSetting end # @!method self.variants - # @return [Array(OpenAI::Models::Realtime::Models, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Tool::McpTool)] + # @return [Array(OpenAI::Models::Realtime::RealtimeFunctionTool, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Tool::McpTool)] end # Realtime API can write session traces to the @@ -961,18 +961,6 @@ class TracingConfiguration < OpenAI::Internal::Type::BaseModel # @!method self.variants # @return [Array(Symbol, :auto, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Tracing::TracingConfiguration)] end - - # The type of session to create. Always `realtime` for the Realtime API. - # - # @see OpenAI::Models::Realtime::RealtimeSessionCreateResponse#type - module Type - extend OpenAI::Internal::Type::Enum - - REALTIME = :realtime - - # @!method self.values - # @return [Array] - end end end diff --git a/lib/openai/models/realtime/realtime_tools_config_union.rb b/lib/openai/models/realtime/realtime_tools_config_union.rb index 4919d145..0cf5bb62 100644 --- a/lib/openai/models/realtime/realtime_tools_config_union.rb +++ b/lib/openai/models/realtime/realtime_tools_config_union.rb @@ -11,7 +11,7 @@ module RealtimeToolsConfigUnion discriminator :type - variant :function, -> { OpenAI::Realtime::Models } + variant :function, -> { OpenAI::Realtime::RealtimeFunctionTool } # Give the model access to additional tools via remote Model Context Protocol # (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp). @@ -321,7 +321,7 @@ module McpToolApprovalSetting end # @!method self.variants - # @return [Array(OpenAI::Models::Realtime::Models, OpenAI::Models::Realtime::RealtimeToolsConfigUnion::Mcp)] + # @return [Array(OpenAI::Models::Realtime::RealtimeFunctionTool, OpenAI::Models::Realtime::RealtimeToolsConfigUnion::Mcp)] end end end diff --git a/lib/openai/models/realtime/realtime_transcription_session_client_secret.rb b/lib/openai/models/realtime/realtime_transcription_session_client_secret.rb deleted file mode 100644 index b50cf6d9..00000000 --- a/lib/openai/models/realtime/realtime_transcription_session_client_secret.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module OpenAI - module Models - module Realtime - class RealtimeTranscriptionSessionClientSecret < OpenAI::Internal::Type::BaseModel - # @!attribute expires_at - # Timestamp for when the token expires. Currently, all tokens expire after one - # minute. - # - # @return [Integer] - required :expires_at, Integer - - # @!attribute value - # Ephemeral key usable in client environments to authenticate connections to the - # Realtime API. Use this in client-side environments rather than a standard API - # token, which should only be used server-side. - # - # @return [String] - required :value, String - - # @!method initialize(expires_at:, value:) - # Some parameter documentations has been truncated, see - # {OpenAI::Models::Realtime::RealtimeTranscriptionSessionClientSecret} for more - # details. - # - # Ephemeral key returned by the API. Only present when the session is created on - # the server via REST API. - # - # @param expires_at [Integer] Timestamp for when the token expires. Currently, all tokens expire - # - # @param value [String] Ephemeral key usable in client environments to authenticate connections - end - end - - RealtimeTranscriptionSessionClientSecret = Realtime::RealtimeTranscriptionSessionClientSecret - end -end diff --git a/lib/openai/models/realtime/realtime_transcription_session_create_response.rb b/lib/openai/models/realtime/realtime_transcription_session_create_response.rb index 59a1518e..56b2509f 100644 --- a/lib/openai/models/realtime/realtime_transcription_session_create_response.rb +++ b/lib/openai/models/realtime/realtime_transcription_session_create_response.rb @@ -4,68 +4,145 @@ module OpenAI module Models module Realtime class RealtimeTranscriptionSessionCreateResponse < OpenAI::Internal::Type::BaseModel - # @!attribute client_secret - # Ephemeral key returned by the API. Only present when the session is created on - # the server via REST API. + # @!attribute id + # Unique identifier for the session that looks like `sess_1234567890abcdef`. # - # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionClientSecret] - required :client_secret, -> { OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret } + # @return [String] + required :id, String - # @!attribute input_audio_format - # The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + # @!attribute object + # The object type. Always `realtime.transcription_session`. # - # @return [String, nil] - optional :input_audio_format, String + # @return [String] + required :object, String - # @!attribute input_audio_transcription - # Configuration of the transcription model. + # @!attribute type + # The type of session. Always `transcription` for transcription sessions. # - # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription, nil] - optional :input_audio_transcription, - -> { OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription } + # @return [Symbol, :transcription] + required :type, const: :transcription - # @!attribute modalities - # The set of modalities the model can respond with. To disable audio, set this to - # ["text"]. + # @!attribute audio + # Configuration for input audio for the session. # - # @return [Array, nil] - optional :modalities, - -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality] } - - # @!attribute turn_detection - # Configuration for turn detection. Can be set to `null` to turn off. Server VAD - # means that the model will detect the start and end of speech based on audio - # volume and respond at the end of user speech. + # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio, nil] + optional :audio, -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio } + + # @!attribute expires_at + # Expiration timestamp for the session, in seconds since epoch. + # + # @return [Integer, nil] + optional :expires_at, Integer + + # @!attribute include + # Additional fields to include in server outputs. + # + # - `item.input_audio_transcription.logprobs`: Include logprobs for input audio + # transcription. # - # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionTurnDetection, nil] - optional :turn_detection, -> { OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection } + # @return [Array, nil] + optional :include, + -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Include] } - # @!method initialize(client_secret:, input_audio_format: nil, input_audio_transcription: nil, modalities: nil, turn_detection: nil) + # @!method initialize(id:, object:, audio: nil, expires_at: nil, include: nil, type: :transcription) # Some parameter documentations has been truncated, see # {OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse} for more # details. # - # A new Realtime transcription session configuration. + # A Realtime transcription session configuration object. # - # When a session is created on the server via REST API, the session object also - # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is - # not present when a session is updated via the WebSocket API. + # @param id [String] Unique identifier for the session that looks like `sess_1234567890abcdef`. # - # @param client_secret [OpenAI::Models::Realtime::RealtimeTranscriptionSessionClientSecret] Ephemeral key returned by the API. Only present when the session is + # @param object [String] The object type. Always `realtime.transcription_session`. # - # @param input_audio_format [String] The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + # @param audio [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio] Configuration for input audio for the session. # - # @param input_audio_transcription [OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription] Configuration of the transcription model. + # @param expires_at [Integer] Expiration timestamp for the session, in seconds since epoch. # - # @param modalities [Array] The set of modalities the model can respond with. To disable audio, + # @param include [Array] Additional fields to include in server outputs. # - # @param turn_detection [OpenAI::Models::Realtime::RealtimeTranscriptionSessionTurnDetection] Configuration for turn detection. Can be set to `null` to turn off. Server + # @param type [Symbol, :transcription] The type of session. Always `transcription` for transcription sessions. + + # @see OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute input + # + # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input, nil] + optional :input, -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input } + + # @!method initialize(input: nil) + # Configuration for input audio for the session. + # + # @param input [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input] + + # @see OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio#input + class Input < OpenAI::Internal::Type::BaseModel + # @!attribute format_ + # The PCM audio format. Only a 24kHz sample rate is supported. + # + # @return [OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCM, OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCMU, OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCMA, nil] + optional :format_, union: -> { OpenAI::Realtime::RealtimeAudioFormats }, api_name: :format + + # @!attribute noise_reduction + # Configuration for input audio noise reduction. + # + # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, nil] + optional :noise_reduction, + -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction } + + # @!attribute transcription + # Configuration of the transcription model. + # + # @return [OpenAI::Models::Realtime::AudioTranscription, nil] + optional :transcription, -> { OpenAI::Realtime::AudioTranscription } + + # @!attribute turn_detection + # Configuration for turn detection. Can be set to `null` to turn off. Server VAD + # means that the model will detect the start and end of speech based on audio + # volume and respond at the end of user speech. + # + # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionTurnDetection, nil] + optional :turn_detection, -> { OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection } + + # @!method initialize(format_: nil, noise_reduction: nil, transcription: nil, turn_detection: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input} + # for more details. + # + # @param format_ [OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCM, OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCMU, OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCMA] The PCM audio format. Only a 24kHz sample rate is supported. + # + # @param noise_reduction [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction] Configuration for input audio noise reduction. + # + # @param transcription [OpenAI::Models::Realtime::AudioTranscription] Configuration of the transcription model. + # + # @param turn_detection [OpenAI::Models::Realtime::RealtimeTranscriptionSessionTurnDetection] Configuration for turn detection. Can be set to `null` to turn off. Server + + # @see OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input#noise_reduction + class NoiseReduction < OpenAI::Internal::Type::BaseModel + # @!attribute type + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + # + # @return [Symbol, OpenAI::Models::Realtime::NoiseReductionType, nil] + optional :type, enum: -> { OpenAI::Realtime::NoiseReductionType } + + # @!method initialize(type: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction} + # for more details. + # + # Configuration for input audio noise reduction. + # + # @param type [Symbol, OpenAI::Models::Realtime::NoiseReductionType] Type of noise reduction. `near_field` is for close-talking microphones such as h + end + end + end - module Modality + module Include extend OpenAI::Internal::Type::Enum - TEXT = :text - AUDIO = :audio + ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS = :"item.input_audio_transcription.logprobs" # @!method self.values # @return [Array] diff --git a/lib/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rb b/lib/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rb deleted file mode 100644 index a8b4c51e..00000000 --- a/lib/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -module OpenAI - module Models - module Realtime - class RealtimeTranscriptionSessionInputAudioTranscription < OpenAI::Internal::Type::BaseModel - # @!attribute language - # The language of the input audio. Supplying the input language in - # [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) - # format will improve accuracy and latency. - # - # @return [String, nil] - optional :language, String - - # @!attribute model - # The model to use for transcription. Current options are `whisper-1`, - # `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, and `gpt-4o-transcribe`. - # - # @return [Symbol, OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model, nil] - optional :model, enum: -> { OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model } - - # @!attribute prompt - # An optional text to guide the model's style or continue a previous audio - # segment. For `whisper-1`, the - # [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). - # For `gpt-4o-transcribe` models, the prompt is a free text string, for example - # "expect words related to technology". - # - # @return [String, nil] - optional :prompt, String - - # @!method initialize(language: nil, model: nil, prompt: nil) - # Some parameter documentations has been truncated, see - # {OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription} - # for more details. - # - # Configuration of the transcription model. - # - # @param language [String] The language of the input audio. Supplying the input language in - # - # @param model [Symbol, OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model] The model to use for transcription. Current options are `whisper-1`, `gpt-4o-tra - # - # @param prompt [String] An optional text to guide the model's style or continue a previous audio - - # The model to use for transcription. Current options are `whisper-1`, - # `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, and `gpt-4o-transcribe`. - # - # @see OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription#model - module Model - extend OpenAI::Internal::Type::Enum - - WHISPER_1 = :"whisper-1" - GPT_4O_TRANSCRIBE_LATEST = :"gpt-4o-transcribe-latest" - GPT_4O_MINI_TRANSCRIBE = :"gpt-4o-mini-transcribe" - GPT_4O_TRANSCRIBE = :"gpt-4o-transcribe" - - # @!method self.values - # @return [Array] - end - end - end - - RealtimeTranscriptionSessionInputAudioTranscription = - Realtime::RealtimeTranscriptionSessionInputAudioTranscription - end -end diff --git a/lib/openai/models/realtime/transcription_session_created.rb b/lib/openai/models/realtime/transcription_session_created.rb deleted file mode 100644 index 2d4e9c46..00000000 --- a/lib/openai/models/realtime/transcription_session_created.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -module OpenAI - module Models - module Realtime - class TranscriptionSessionCreated < OpenAI::Internal::Type::BaseModel - # @!attribute event_id - # The unique ID of the server event. - # - # @return [String] - required :event_id, String - - # @!attribute session - # A new Realtime transcription session configuration. - # - # When a session is created on the server via REST API, the session object also - # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is - # not present when a session is updated via the WebSocket API. - # - # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse] - required :session, -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse } - - # @!attribute type - # The event type, must be `transcription_session.created`. - # - # @return [Symbol, :"transcription_session.created"] - required :type, const: :"transcription_session.created" - - # @!method initialize(event_id:, session:, type: :"transcription_session.created") - # Some parameter documentations has been truncated, see - # {OpenAI::Models::Realtime::TranscriptionSessionCreated} for more details. - # - # Returned when a transcription session is created. - # - # @param event_id [String] The unique ID of the server event. - # - # @param session [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse] A new Realtime transcription session configuration. - # - # @param type [Symbol, :"transcription_session.created"] The event type, must be `transcription_session.created`. - end - end - end -end diff --git a/lib/openai/models/realtime/transcription_session_updated_event.rb b/lib/openai/models/realtime/transcription_session_updated_event.rb index c0b74534..4896696e 100644 --- a/lib/openai/models/realtime/transcription_session_updated_event.rb +++ b/lib/openai/models/realtime/transcription_session_updated_event.rb @@ -17,8 +17,8 @@ class TranscriptionSessionUpdatedEvent < OpenAI::Internal::Type::BaseModel # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is # not present when a session is updated via the WebSocket API. # - # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse] - required :session, -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse } + # @return [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session] + required :session, -> { OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session } # @!attribute type # The event type, must be `transcription_session.updated`. @@ -35,9 +35,158 @@ class TranscriptionSessionUpdatedEvent < OpenAI::Internal::Type::BaseModel # # @param event_id [String] The unique ID of the server event. # - # @param session [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse] A new Realtime transcription session configuration. + # @param session [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session] A new Realtime transcription session configuration. # # @param type [Symbol, :"transcription_session.updated"] The event type, must be `transcription_session.updated`. + + # @see OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent#session + class Session < OpenAI::Internal::Type::BaseModel + # @!attribute client_secret + # Ephemeral key returned by the API. Only present when the session is created on + # the server via REST API. + # + # @return [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret] + required :client_secret, -> { OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret } + + # @!attribute input_audio_format + # The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + # + # @return [String, nil] + optional :input_audio_format, String + + # @!attribute input_audio_transcription + # Configuration of the transcription model. + # + # @return [OpenAI::Models::Realtime::AudioTranscription, nil] + optional :input_audio_transcription, -> { OpenAI::Realtime::AudioTranscription } + + # @!attribute modalities + # The set of modalities the model can respond with. To disable audio, set this to + # ["text"]. + # + # @return [Array, nil] + optional :modalities, + -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality] } + + # @!attribute turn_detection + # Configuration for turn detection. Can be set to `null` to turn off. Server VAD + # means that the model will detect the start and end of speech based on audio + # volume and respond at the end of user speech. + # + # @return [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection, nil] + optional :turn_detection, + -> { OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection } + + # @!method initialize(client_secret:, input_audio_format: nil, input_audio_transcription: nil, modalities: nil, turn_detection: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session} for more + # details. + # + # A new Realtime transcription session configuration. + # + # When a session is created on the server via REST API, the session object also + # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is + # not present when a session is updated via the WebSocket API. + # + # @param client_secret [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret] Ephemeral key returned by the API. Only present when the session is + # + # @param input_audio_format [String] The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + # + # @param input_audio_transcription [OpenAI::Models::Realtime::AudioTranscription] Configuration of the transcription model. + # + # @param modalities [Array] The set of modalities the model can respond with. To disable audio, + # + # @param turn_detection [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection] Configuration for turn detection. Can be set to `null` to turn off. Server + + # @see OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session#client_secret + class ClientSecret < OpenAI::Internal::Type::BaseModel + # @!attribute expires_at + # Timestamp for when the token expires. Currently, all tokens expire after one + # minute. + # + # @return [Integer] + required :expires_at, Integer + + # @!attribute value + # Ephemeral key usable in client environments to authenticate connections to the + # Realtime API. Use this in client-side environments rather than a standard API + # token, which should only be used server-side. + # + # @return [String] + required :value, String + + # @!method initialize(expires_at:, value:) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret} + # for more details. + # + # Ephemeral key returned by the API. Only present when the session is created on + # the server via REST API. + # + # @param expires_at [Integer] Timestamp for when the token expires. Currently, all tokens expire + # + # @param value [String] Ephemeral key usable in client environments to authenticate connections + end + + module Modality + extend OpenAI::Internal::Type::Enum + + TEXT = :text + AUDIO = :audio + + # @!method self.values + # @return [Array] + end + + # @see OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session#turn_detection + class TurnDetection < OpenAI::Internal::Type::BaseModel + # @!attribute prefix_padding_ms + # Amount of audio to include before the VAD detected speech (in milliseconds). + # Defaults to 300ms. + # + # @return [Integer, nil] + optional :prefix_padding_ms, Integer + + # @!attribute silence_duration_ms + # Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + # With shorter values the model will respond more quickly, but may jump in on + # short pauses from the user. + # + # @return [Integer, nil] + optional :silence_duration_ms, Integer + + # @!attribute threshold + # Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + # threshold will require louder audio to activate the model, and thus might + # perform better in noisy environments. + # + # @return [Float, nil] + optional :threshold, Float + + # @!attribute type + # Type of turn detection, only `server_vad` is currently supported. + # + # @return [String, nil] + optional :type, String + + # @!method initialize(prefix_padding_ms: nil, silence_duration_ms: nil, threshold: nil, type: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection} + # for more details. + # + # Configuration for turn detection. Can be set to `null` to turn off. Server VAD + # means that the model will detect the start and end of speech based on audio + # volume and respond at the end of user speech. + # + # @param prefix_padding_ms [Integer] Amount of audio to include before the VAD detected speech (in + # + # @param silence_duration_ms [Integer] Duration of silence to detect speech stop (in milliseconds). Defaults + # + # @param threshold [Float] Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + # + # @param type [String] Type of turn detection, only `server_vad` is currently supported. + end + end end end end diff --git a/lib/openai/version.rb b/lib/openai/version.rb index f6f2a771..4ec01a14 100644 --- a/lib/openai/version.rb +++ b/lib/openai/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenAI - VERSION = "0.23.0" + VERSION = "0.23.1" end diff --git a/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi b/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi index 5febcfa0..08a137c8 100644 --- a/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi +++ b/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi @@ -42,7 +42,7 @@ module OpenAI attr_writer :eagerness # Optional idle timeout after which turn detection will auto-timeout when no - # additional audio is received. + # additional audio is received and emits a `timeout_triggered` event. sig { returns(T.nilable(Integer)) } attr_accessor :idle_timeout_ms @@ -133,7 +133,7 @@ module OpenAI # and `high` have max timeouts of 8s, 4s, and 2s respectively. eagerness: nil, # Optional idle timeout after which turn detection will auto-timeout when no - # additional audio is received. + # additional audio is received and emits a `timeout_triggered` event. idle_timeout_ms: nil, # Whether or not to automatically interrupt any ongoing response with output to # the default conversation (i.e. `conversation` of `auto`) when a VAD start event diff --git a/rbi/openai/models/realtime/realtime_client_event.rbi b/rbi/openai/models/realtime/realtime_client_event.rbi index 9feb138f..adcd3499 100644 --- a/rbi/openai/models/realtime/realtime_client_event.rbi +++ b/rbi/openai/models/realtime/realtime_client_event.rbi @@ -20,8 +20,7 @@ module OpenAI OpenAI::Realtime::InputAudioBufferCommitEvent, OpenAI::Realtime::ResponseCancelEvent, OpenAI::Realtime::ResponseCreateEvent, - OpenAI::Realtime::SessionUpdateEvent, - OpenAI::Realtime::TranscriptionSessionUpdate + OpenAI::Realtime::SessionUpdateEvent ) end diff --git a/rbi/openai/models/realtime/models.rbi b/rbi/openai/models/realtime/realtime_function_tool.rbi similarity index 69% rename from rbi/openai/models/realtime/models.rbi rename to rbi/openai/models/realtime/realtime_function_tool.rbi index fecd47c3..3d9b5268 100644 --- a/rbi/openai/models/realtime/models.rbi +++ b/rbi/openai/models/realtime/realtime_function_tool.rbi @@ -3,10 +3,13 @@ module OpenAI module Models module Realtime - class Models < OpenAI::Internal::Type::BaseModel + class RealtimeFunctionTool < OpenAI::Internal::Type::BaseModel OrHash = T.type_alias do - T.any(OpenAI::Realtime::Models, OpenAI::Internal::AnyHash) + T.any( + OpenAI::Realtime::RealtimeFunctionTool, + OpenAI::Internal::AnyHash + ) end # The description of the function, including guidance on when and how to call it, @@ -32,10 +35,18 @@ module OpenAI attr_writer :parameters # The type of the tool, i.e. `function`. - sig { returns(T.nilable(OpenAI::Realtime::Models::Type::OrSymbol)) } + sig do + returns( + T.nilable(OpenAI::Realtime::RealtimeFunctionTool::Type::OrSymbol) + ) + end attr_reader :type - sig { params(type: OpenAI::Realtime::Models::Type::OrSymbol).void } + sig do + params( + type: OpenAI::Realtime::RealtimeFunctionTool::Type::OrSymbol + ).void + end attr_writer :type sig do @@ -43,7 +54,7 @@ module OpenAI description: String, name: String, parameters: T.anything, - type: OpenAI::Realtime::Models::Type::OrSymbol + type: OpenAI::Realtime::RealtimeFunctionTool::Type::OrSymbol ).returns(T.attached_class) end def self.new( @@ -65,7 +76,7 @@ module OpenAI description: String, name: String, parameters: T.anything, - type: OpenAI::Realtime::Models::Type::OrSymbol + type: OpenAI::Realtime::RealtimeFunctionTool::Type::OrSymbol } ) end @@ -77,15 +88,22 @@ module OpenAI extend OpenAI::Internal::Type::Enum TaggedSymbol = - T.type_alias { T.all(Symbol, OpenAI::Realtime::Models::Type) } + T.type_alias do + T.all(Symbol, OpenAI::Realtime::RealtimeFunctionTool::Type) + end OrSymbol = T.type_alias { T.any(Symbol, String) } FUNCTION = - T.let(:function, OpenAI::Realtime::Models::Type::TaggedSymbol) + T.let( + :function, + OpenAI::Realtime::RealtimeFunctionTool::Type::TaggedSymbol + ) sig do override.returns( - T::Array[OpenAI::Realtime::Models::Type::TaggedSymbol] + T::Array[ + OpenAI::Realtime::RealtimeFunctionTool::Type::TaggedSymbol + ] ) end def self.values diff --git a/rbi/openai/models/realtime/realtime_response_create_params.rbi b/rbi/openai/models/realtime/realtime_response_create_params.rbi index e5e98c2f..18dbbadf 100644 --- a/rbi/openai/models/realtime/realtime_response_create_params.rbi +++ b/rbi/openai/models/realtime/realtime_response_create_params.rbi @@ -204,7 +204,7 @@ module OpenAI T.nilable( T::Array[ T.any( - OpenAI::Realtime::Models, + OpenAI::Realtime::RealtimeFunctionTool, OpenAI::Realtime::RealtimeResponseCreateMcpTool ) ] @@ -218,7 +218,7 @@ module OpenAI tools: T::Array[ T.any( - OpenAI::Realtime::Models::OrHash, + OpenAI::Realtime::RealtimeFunctionTool::OrHash, OpenAI::Realtime::RealtimeResponseCreateMcpTool::OrHash ) ] @@ -266,7 +266,7 @@ module OpenAI tools: T::Array[ T.any( - OpenAI::Realtime::Models::OrHash, + OpenAI::Realtime::RealtimeFunctionTool::OrHash, OpenAI::Realtime::RealtimeResponseCreateMcpTool::OrHash ) ] @@ -364,7 +364,7 @@ module OpenAI tools: T::Array[ T.any( - OpenAI::Realtime::Models, + OpenAI::Realtime::RealtimeFunctionTool, OpenAI::Realtime::RealtimeResponseCreateMcpTool ) ] @@ -508,7 +508,7 @@ module OpenAI Variants = T.type_alias do T.any( - OpenAI::Realtime::Models, + OpenAI::Realtime::RealtimeFunctionTool, OpenAI::Realtime::RealtimeResponseCreateMcpTool ) end diff --git a/rbi/openai/models/realtime/realtime_server_event.rbi b/rbi/openai/models/realtime/realtime_server_event.rbi index 971b61f2..6e248f2b 100644 --- a/rbi/openai/models/realtime/realtime_server_event.rbi +++ b/rbi/openai/models/realtime/realtime_server_event.rbi @@ -40,8 +40,6 @@ module OpenAI OpenAI::Realtime::ResponseTextDoneEvent, OpenAI::Realtime::SessionCreatedEvent, OpenAI::Realtime::SessionUpdatedEvent, - OpenAI::Realtime::TranscriptionSessionUpdatedEvent, - OpenAI::Realtime::TranscriptionSessionCreated, OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferStarted, OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferStopped, OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferCleared, diff --git a/rbi/openai/models/realtime/realtime_session.rbi b/rbi/openai/models/realtime/realtime_session.rbi index ba69f375..42a7c70d 100644 --- a/rbi/openai/models/realtime/realtime_session.rbi +++ b/rbi/openai/models/realtime/realtime_session.rbi @@ -225,10 +225,16 @@ module OpenAI attr_writer :tool_choice # Tools (functions) available to the model. - sig { returns(T.nilable(T::Array[OpenAI::Realtime::Models])) } + sig do + returns(T.nilable(T::Array[OpenAI::Realtime::RealtimeFunctionTool])) + end attr_reader :tools - sig { params(tools: T::Array[OpenAI::Realtime::Models::OrHash]).void } + sig do + params( + tools: T::Array[OpenAI::Realtime::RealtimeFunctionTool::OrHash] + ).void + end attr_writer :tools # Configuration options for tracing. Set to null to disable tracing. Once tracing @@ -320,7 +326,7 @@ module OpenAI speed: Float, temperature: Float, tool_choice: String, - tools: T::Array[OpenAI::Realtime::Models::OrHash], + tools: T::Array[OpenAI::Realtime::RealtimeFunctionTool::OrHash], tracing: T.nilable( T.any( @@ -457,7 +463,7 @@ module OpenAI speed: Float, temperature: Float, tool_choice: String, - tools: T::Array[OpenAI::Realtime::Models], + tools: T::Array[OpenAI::Realtime::RealtimeFunctionTool], tracing: T.nilable( T.any( diff --git a/rbi/openai/models/realtime/realtime_session_create_request.rbi b/rbi/openai/models/realtime/realtime_session_create_request.rbi index c5b7f7c2..ef235540 100644 --- a/rbi/openai/models/realtime/realtime_session_create_request.rbi +++ b/rbi/openai/models/realtime/realtime_session_create_request.rbi @@ -170,7 +170,7 @@ module OpenAI T.nilable( T::Array[ T.any( - OpenAI::Realtime::Models, + OpenAI::Realtime::RealtimeFunctionTool, OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp ) ] @@ -184,7 +184,7 @@ module OpenAI tools: T::Array[ T.any( - OpenAI::Realtime::Models::OrHash, + OpenAI::Realtime::RealtimeFunctionTool::OrHash, OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::OrHash ) ] @@ -264,7 +264,7 @@ module OpenAI tools: T::Array[ T.any( - OpenAI::Realtime::Models::OrHash, + OpenAI::Realtime::RealtimeFunctionTool::OrHash, OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::OrHash ) ], @@ -367,7 +367,7 @@ module OpenAI tools: T::Array[ T.any( - OpenAI::Realtime::Models, + OpenAI::Realtime::RealtimeFunctionTool, OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp ) ], diff --git a/rbi/openai/models/realtime/realtime_session_create_response.rbi b/rbi/openai/models/realtime/realtime_session_create_response.rbi index 3fbccb98..0518a759 100644 --- a/rbi/openai/models/realtime/realtime_session_create_response.rbi +++ b/rbi/openai/models/realtime/realtime_session_create_response.rbi @@ -14,6 +14,21 @@ module OpenAI ) end + # Ephemeral key returned by the API. + sig { returns(OpenAI::Realtime::RealtimeSessionClientSecret) } + attr_reader :client_secret + + sig do + params( + client_secret: OpenAI::Realtime::RealtimeSessionClientSecret::OrHash + ).void + end + attr_writer :client_secret + + # The type of session to create. Always `realtime` for the Realtime API. + sig { returns(Symbol) } + attr_accessor :type + # Configuration for input and output audio. sig do returns( @@ -30,19 +45,6 @@ module OpenAI end attr_writer :audio - # Ephemeral key returned by the API. - sig do - returns(T.nilable(OpenAI::Realtime::RealtimeSessionClientSecret)) - end - attr_reader :client_secret - - sig do - params( - client_secret: OpenAI::Realtime::RealtimeSessionClientSecret::OrHash - ).void - end - attr_writer :client_secret - # Additional fields to include in server outputs. # # `item.input_audio_transcription.logprobs`: Include logprobs for input audio @@ -198,7 +200,7 @@ module OpenAI tools: T::Array[ T.any( - OpenAI::Realtime::Models::OrHash, + OpenAI::Realtime::RealtimeFunctionTool::OrHash, OpenAI::Realtime::RealtimeSessionCreateResponse::Tool::McpTool::OrHash ) ] @@ -239,32 +241,14 @@ module OpenAI end attr_writer :truncation - # The type of session to create. Always `realtime` for the Realtime API. - sig do - returns( - T.nilable( - OpenAI::Realtime::RealtimeSessionCreateResponse::Type::TaggedSymbol - ) - ) - end - attr_reader :type - - sig do - params( - type: - OpenAI::Realtime::RealtimeSessionCreateResponse::Type::OrSymbol - ).void - end - attr_writer :type - # A new Realtime session configuration, with an ephemeral key. Default TTL for # keys is one minute. sig do params( - audio: - OpenAI::Realtime::RealtimeSessionCreateResponse::Audio::OrHash, client_secret: OpenAI::Realtime::RealtimeSessionClientSecret::OrHash, + audio: + OpenAI::Realtime::RealtimeSessionCreateResponse::Audio::OrHash, include: T::Array[ OpenAI::Realtime::RealtimeSessionCreateResponse::Include::OrSymbol @@ -290,7 +274,7 @@ module OpenAI tools: T::Array[ T.any( - OpenAI::Realtime::Models::OrHash, + OpenAI::Realtime::RealtimeFunctionTool::OrHash, OpenAI::Realtime::RealtimeSessionCreateResponse::Tool::McpTool::OrHash ) ], @@ -306,15 +290,14 @@ module OpenAI OpenAI::Realtime::RealtimeTruncation::RealtimeTruncationStrategy::OrSymbol, OpenAI::Realtime::RealtimeTruncationRetentionRatio::OrHash ), - type: - OpenAI::Realtime::RealtimeSessionCreateResponse::Type::OrSymbol + type: Symbol ).returns(T.attached_class) end def self.new( + # Ephemeral key returned by the API. + client_secret:, # Configuration for input and output audio. audio: nil, - # Ephemeral key returned by the API. - client_secret: nil, # Additional fields to include in server outputs. # # `item.input_audio_transcription.logprobs`: Include logprobs for input audio @@ -362,15 +345,16 @@ module OpenAI # The default is `auto`. truncation: nil, # The type of session to create. Always `realtime` for the Realtime API. - type: nil + type: :realtime ) end sig do override.returns( { - audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, + type: Symbol, + audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, include: T::Array[ OpenAI::Realtime::RealtimeSessionCreateResponse::Include::TaggedSymbol @@ -395,9 +379,7 @@ module OpenAI T.nilable( OpenAI::Realtime::RealtimeSessionCreateResponse::Tracing::Variants ), - truncation: OpenAI::Realtime::RealtimeTruncation::Variants, - type: - OpenAI::Realtime::RealtimeSessionCreateResponse::Type::TaggedSymbol + truncation: OpenAI::Realtime::RealtimeTruncation::Variants } ) end @@ -722,7 +704,7 @@ module OpenAI attr_writer :eagerness # Optional idle timeout after which turn detection will auto-timeout when no - # additional audio is received. + # additional audio is received and emits a `timeout_triggered` event. sig { returns(T.nilable(Integer)) } attr_accessor :idle_timeout_ms @@ -813,7 +795,7 @@ module OpenAI # and `high` have max timeouts of 8s, 4s, and 2s respectively. eagerness: nil, # Optional idle timeout after which turn detection will auto-timeout when no - # additional audio is received. + # additional audio is received and emits a `timeout_triggered` event. idle_timeout_ms: nil, # Whether or not to automatically interrupt any ongoing response with output to # the default conversation (i.e. `conversation` of `auto`) when a VAD start event @@ -1330,7 +1312,7 @@ module OpenAI Variants = T.type_alias do T.any( - OpenAI::Realtime::Models, + OpenAI::Realtime::RealtimeFunctionTool, OpenAI::Realtime::RealtimeSessionCreateResponse::Tool::McpTool ) end @@ -2037,36 +2019,6 @@ module OpenAI def self.variants end end - - # The type of session to create. Always `realtime` for the Realtime API. - module Type - extend OpenAI::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - OpenAI::Realtime::RealtimeSessionCreateResponse::Type - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - REALTIME = - T.let( - :realtime, - OpenAI::Realtime::RealtimeSessionCreateResponse::Type::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - OpenAI::Realtime::RealtimeSessionCreateResponse::Type::TaggedSymbol - ] - ) - end - def self.values - end - end end end end diff --git a/rbi/openai/models/realtime/realtime_tools_config_union.rbi b/rbi/openai/models/realtime/realtime_tools_config_union.rbi index 97033485..5daa4aef 100644 --- a/rbi/openai/models/realtime/realtime_tools_config_union.rbi +++ b/rbi/openai/models/realtime/realtime_tools_config_union.rbi @@ -12,7 +12,7 @@ module OpenAI Variants = T.type_alias do T.any( - OpenAI::Realtime::Models, + OpenAI::Realtime::RealtimeFunctionTool, OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp ) end diff --git a/rbi/openai/models/realtime/realtime_transcription_session_client_secret.rbi b/rbi/openai/models/realtime/realtime_transcription_session_client_secret.rbi deleted file mode 100644 index 3e0f16be..00000000 --- a/rbi/openai/models/realtime/realtime_transcription_session_client_secret.rbi +++ /dev/null @@ -1,51 +0,0 @@ -# typed: strong - -module OpenAI - module Models - RealtimeTranscriptionSessionClientSecret = - Realtime::RealtimeTranscriptionSessionClientSecret - - module Realtime - class RealtimeTranscriptionSessionClientSecret < OpenAI::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret, - OpenAI::Internal::AnyHash - ) - end - - # Timestamp for when the token expires. Currently, all tokens expire after one - # minute. - sig { returns(Integer) } - attr_accessor :expires_at - - # Ephemeral key usable in client environments to authenticate connections to the - # Realtime API. Use this in client-side environments rather than a standard API - # token, which should only be used server-side. - sig { returns(String) } - attr_accessor :value - - # Ephemeral key returned by the API. Only present when the session is created on - # the server via REST API. - sig do - params(expires_at: Integer, value: String).returns(T.attached_class) - end - def self.new( - # Timestamp for when the token expires. Currently, all tokens expire after one - # minute. - expires_at:, - # Ephemeral key usable in client environments to authenticate connections to the - # Realtime API. Use this in client-side environments rather than a standard API - # token, which should only be used server-side. - value: - ) - end - - sig { override.returns({ expires_at: Integer, value: String }) } - def to_hash - end - end - end - end -end diff --git a/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi b/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi index ac8e98ae..8f72c8d3 100644 --- a/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi +++ b/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi @@ -15,174 +15,363 @@ module OpenAI ) end - # Ephemeral key returned by the API. Only present when the session is created on - # the server via REST API. - sig do - returns(OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret) - end - attr_reader :client_secret + # Unique identifier for the session that looks like `sess_1234567890abcdef`. + sig { returns(String) } + attr_accessor :id - sig do - params( - client_secret: - OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret::OrHash - ).void - end - attr_writer :client_secret + # The object type. Always `realtime.transcription_session`. + sig { returns(String) } + attr_accessor :object - # The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - sig { returns(T.nilable(String)) } - attr_reader :input_audio_format + # The type of session. Always `transcription` for transcription sessions. + sig { returns(Symbol) } + attr_accessor :type - sig { params(input_audio_format: String).void } - attr_writer :input_audio_format - - # Configuration of the transcription model. + # Configuration for input audio for the session. sig do returns( T.nilable( - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio ) ) end - attr_reader :input_audio_transcription + attr_reader :audio sig do params( - input_audio_transcription: - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::OrHash + audio: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::OrHash ).void end - attr_writer :input_audio_transcription + attr_writer :audio + + # Expiration timestamp for the session, in seconds since epoch. + sig { returns(T.nilable(Integer)) } + attr_reader :expires_at + + sig { params(expires_at: Integer).void } + attr_writer :expires_at - # The set of modalities the model can respond with. To disable audio, set this to - # ["text"]. + # Additional fields to include in server outputs. + # + # - `item.input_audio_transcription.logprobs`: Include logprobs for input audio + # transcription. sig do returns( T.nilable( T::Array[ - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality::TaggedSymbol + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Include::TaggedSymbol ] ) ) end - attr_reader :modalities + attr_reader :include sig do params( - modalities: + include: T::Array[ - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality::OrSymbol + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Include::OrSymbol ] ).void end - attr_writer :modalities - - # Configuration for turn detection. Can be set to `null` to turn off. Server VAD - # means that the model will detect the start and end of speech based on audio - # volume and respond at the end of user speech. - sig do - returns( - T.nilable( - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection - ) - ) - end - attr_reader :turn_detection - - sig do - params( - turn_detection: - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash - ).void - end - attr_writer :turn_detection + attr_writer :include - # A new Realtime transcription session configuration. - # - # When a session is created on the server via REST API, the session object also - # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is - # not present when a session is updated via the WebSocket API. + # A Realtime transcription session configuration object. sig do params( - client_secret: - OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret::OrHash, - input_audio_format: String, - input_audio_transcription: - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::OrHash, - modalities: + id: String, + object: String, + audio: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::OrHash, + expires_at: Integer, + include: T::Array[ - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality::OrSymbol + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Include::OrSymbol ], - turn_detection: - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash + type: Symbol ).returns(T.attached_class) end def self.new( - # Ephemeral key returned by the API. Only present when the session is created on - # the server via REST API. - client_secret:, - # The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - input_audio_format: nil, - # Configuration of the transcription model. - input_audio_transcription: nil, - # The set of modalities the model can respond with. To disable audio, set this to - # ["text"]. - modalities: nil, - # Configuration for turn detection. Can be set to `null` to turn off. Server VAD - # means that the model will detect the start and end of speech based on audio - # volume and respond at the end of user speech. - turn_detection: nil + # Unique identifier for the session that looks like `sess_1234567890abcdef`. + id:, + # The object type. Always `realtime.transcription_session`. + object:, + # Configuration for input audio for the session. + audio: nil, + # Expiration timestamp for the session, in seconds since epoch. + expires_at: nil, + # Additional fields to include in server outputs. + # + # - `item.input_audio_transcription.logprobs`: Include logprobs for input audio + # transcription. + include: nil, + # The type of session. Always `transcription` for transcription sessions. + type: :transcription ) end sig do override.returns( { - client_secret: - OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret, - input_audio_format: String, - input_audio_transcription: - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription, - modalities: + id: String, + object: String, + type: Symbol, + audio: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio, + expires_at: Integer, + include: T::Array[ - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality::TaggedSymbol - ], - turn_detection: - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Include::TaggedSymbol + ] } ) end def to_hash end - module Modality + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio, + OpenAI::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input + ) + ) + end + attr_reader :input + + sig do + params( + input: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::OrHash + ).void + end + attr_writer :input + + # Configuration for input audio for the session. + sig do + params( + input: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::OrHash + ).returns(T.attached_class) + end + def self.new(input: nil) + end + + sig do + override.returns( + { + input: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input + } + ) + end + def to_hash + end + + class Input < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input, + OpenAI::Internal::AnyHash + ) + end + + # The PCM audio format. Only a 24kHz sample rate is supported. + sig do + returns( + T.nilable(OpenAI::Realtime::RealtimeAudioFormats::Variants) + ) + end + attr_reader :format_ + + sig do + params( + format_: + T.any( + OpenAI::Realtime::RealtimeAudioFormats::AudioPCM::OrHash, + OpenAI::Realtime::RealtimeAudioFormats::AudioPCMU::OrHash, + OpenAI::Realtime::RealtimeAudioFormats::AudioPCMA::OrHash + ) + ).void + end + attr_writer :format_ + + # Configuration for input audio noise reduction. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction + ) + ) + end + attr_reader :noise_reduction + + sig do + params( + noise_reduction: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction::OrHash + ).void + end + attr_writer :noise_reduction + + # Configuration of the transcription model. + sig { returns(T.nilable(OpenAI::Realtime::AudioTranscription)) } + attr_reader :transcription + + sig do + params( + transcription: OpenAI::Realtime::AudioTranscription::OrHash + ).void + end + attr_writer :transcription + + # Configuration for turn detection. Can be set to `null` to turn off. Server VAD + # means that the model will detect the start and end of speech based on audio + # volume and respond at the end of user speech. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + ) + ) + end + attr_reader :turn_detection + + sig do + params( + turn_detection: + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash + ).void + end + attr_writer :turn_detection + + sig do + params( + format_: + T.any( + OpenAI::Realtime::RealtimeAudioFormats::AudioPCM::OrHash, + OpenAI::Realtime::RealtimeAudioFormats::AudioPCMU::OrHash, + OpenAI::Realtime::RealtimeAudioFormats::AudioPCMA::OrHash + ), + noise_reduction: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction::OrHash, + transcription: OpenAI::Realtime::AudioTranscription::OrHash, + turn_detection: + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash + ).returns(T.attached_class) + end + def self.new( + # The PCM audio format. Only a 24kHz sample rate is supported. + format_: nil, + # Configuration for input audio noise reduction. + noise_reduction: nil, + # Configuration of the transcription model. + transcription: nil, + # Configuration for turn detection. Can be set to `null` to turn off. Server VAD + # means that the model will detect the start and end of speech based on audio + # volume and respond at the end of user speech. + turn_detection: nil + ) + end + + sig do + override.returns( + { + format_: OpenAI::Realtime::RealtimeAudioFormats::Variants, + noise_reduction: + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, + transcription: OpenAI::Realtime::AudioTranscription, + turn_detection: + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + } + ) + end + def to_hash + end + + class NoiseReduction < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, + OpenAI::Internal::AnyHash + ) + end + + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + sig do + returns( + T.nilable(OpenAI::Realtime::NoiseReductionType::TaggedSymbol) + ) + end + attr_reader :type + + sig do + params( + type: OpenAI::Realtime::NoiseReductionType::OrSymbol + ).void + end + attr_writer :type + + # Configuration for input audio noise reduction. + sig do + params( + type: OpenAI::Realtime::NoiseReductionType::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + type: nil + ) + end + + sig do + override.returns( + { type: OpenAI::Realtime::NoiseReductionType::TaggedSymbol } + ) + end + def to_hash + end + end + end + end + + module Include extend OpenAI::Internal::Type::Enum TaggedSymbol = T.type_alias do T.all( Symbol, - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Include ) end OrSymbol = T.type_alias { T.any(Symbol, String) } - TEXT = - T.let( - :text, - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality::TaggedSymbol - ) - AUDIO = + ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS = T.let( - :audio, - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality::TaggedSymbol + :"item.input_audio_transcription.logprobs", + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Include::TaggedSymbol ) sig do override.returns( T::Array[ - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Modality::TaggedSymbol + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Include::TaggedSymbol ] ) end diff --git a/rbi/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbi b/rbi/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbi deleted file mode 100644 index 2aee3f4a..00000000 --- a/rbi/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbi +++ /dev/null @@ -1,144 +0,0 @@ -# typed: strong - -module OpenAI - module Models - RealtimeTranscriptionSessionInputAudioTranscription = - Realtime::RealtimeTranscriptionSessionInputAudioTranscription - - module Realtime - class RealtimeTranscriptionSessionInputAudioTranscription < OpenAI::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription, - OpenAI::Internal::AnyHash - ) - end - - # The language of the input audio. Supplying the input language in - # [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) - # format will improve accuracy and latency. - sig { returns(T.nilable(String)) } - attr_reader :language - - sig { params(language: String).void } - attr_writer :language - - # The model to use for transcription. Current options are `whisper-1`, - # `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, and `gpt-4o-transcribe`. - sig do - returns( - T.nilable( - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::TaggedSymbol - ) - ) - end - attr_reader :model - - sig do - params( - model: - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::OrSymbol - ).void - end - attr_writer :model - - # An optional text to guide the model's style or continue a previous audio - # segment. For `whisper-1`, the - # [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). - # For `gpt-4o-transcribe` models, the prompt is a free text string, for example - # "expect words related to technology". - sig { returns(T.nilable(String)) } - attr_reader :prompt - - sig { params(prompt: String).void } - attr_writer :prompt - - # Configuration of the transcription model. - sig do - params( - language: String, - model: - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::OrSymbol, - prompt: String - ).returns(T.attached_class) - end - def self.new( - # The language of the input audio. Supplying the input language in - # [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) - # format will improve accuracy and latency. - language: nil, - # The model to use for transcription. Current options are `whisper-1`, - # `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, and `gpt-4o-transcribe`. - model: nil, - # An optional text to guide the model's style or continue a previous audio - # segment. For `whisper-1`, the - # [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). - # For `gpt-4o-transcribe` models, the prompt is a free text string, for example - # "expect words related to technology". - prompt: nil - ) - end - - sig do - override.returns( - { - language: String, - model: - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::TaggedSymbol, - prompt: String - } - ) - end - def to_hash - end - - # The model to use for transcription. Current options are `whisper-1`, - # `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, and `gpt-4o-transcribe`. - module Model - extend OpenAI::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - WHISPER_1 = - T.let( - :"whisper-1", - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::TaggedSymbol - ) - GPT_4O_TRANSCRIBE_LATEST = - T.let( - :"gpt-4o-transcribe-latest", - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::TaggedSymbol - ) - GPT_4O_MINI_TRANSCRIBE = - T.let( - :"gpt-4o-mini-transcribe", - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::TaggedSymbol - ) - GPT_4O_TRANSCRIBE = - T.let( - :"gpt-4o-transcribe", - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::Model::TaggedSymbol - ] - ) - end - def self.values - end - end - end - end - end -end diff --git a/rbi/openai/models/realtime/transcription_session_created.rbi b/rbi/openai/models/realtime/transcription_session_created.rbi deleted file mode 100644 index 9ca459db..00000000 --- a/rbi/openai/models/realtime/transcription_session_created.rbi +++ /dev/null @@ -1,79 +0,0 @@ -# typed: strong - -module OpenAI - module Models - module Realtime - class TranscriptionSessionCreated < OpenAI::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - OpenAI::Realtime::TranscriptionSessionCreated, - OpenAI::Internal::AnyHash - ) - end - - # The unique ID of the server event. - sig { returns(String) } - attr_accessor :event_id - - # A new Realtime transcription session configuration. - # - # When a session is created on the server via REST API, the session object also - # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is - # not present when a session is updated via the WebSocket API. - sig do - returns(OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse) - end - attr_reader :session - - sig do - params( - session: - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::OrHash - ).void - end - attr_writer :session - - # The event type, must be `transcription_session.created`. - sig { returns(Symbol) } - attr_accessor :type - - # Returned when a transcription session is created. - sig do - params( - event_id: String, - session: - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::OrHash, - type: Symbol - ).returns(T.attached_class) - end - def self.new( - # The unique ID of the server event. - event_id:, - # A new Realtime transcription session configuration. - # - # When a session is created on the server via REST API, the session object also - # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is - # not present when a session is updated via the WebSocket API. - session:, - # The event type, must be `transcription_session.created`. - type: :"transcription_session.created" - ) - end - - sig do - override.returns( - { - event_id: String, - session: - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse, - type: Symbol - } - ) - end - def to_hash - end - end - end - end -end diff --git a/rbi/openai/models/realtime/transcription_session_updated_event.rbi b/rbi/openai/models/realtime/transcription_session_updated_event.rbi index a930600a..1f2d287d 100644 --- a/rbi/openai/models/realtime/transcription_session_updated_event.rbi +++ b/rbi/openai/models/realtime/transcription_session_updated_event.rbi @@ -22,14 +22,14 @@ module OpenAI # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is # not present when a session is updated via the WebSocket API. sig do - returns(OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse) + returns(OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session) end attr_reader :session sig do params( session: - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::OrHash + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::OrHash ).void end attr_writer :session @@ -44,7 +44,7 @@ module OpenAI params( event_id: String, session: - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::OrHash, + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::OrHash, type: Symbol ).returns(T.attached_class) end @@ -67,13 +67,320 @@ module OpenAI { event_id: String, session: - OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse, + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session, type: Symbol } ) end def to_hash end + + class Session < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session, + OpenAI::Internal::AnyHash + ) + end + + # Ephemeral key returned by the API. Only present when the session is created on + # the server via REST API. + sig do + returns( + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret + ) + end + attr_reader :client_secret + + sig do + params( + client_secret: + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret::OrHash + ).void + end + attr_writer :client_secret + + # The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + sig { returns(T.nilable(String)) } + attr_reader :input_audio_format + + sig { params(input_audio_format: String).void } + attr_writer :input_audio_format + + # Configuration of the transcription model. + sig { returns(T.nilable(OpenAI::Realtime::AudioTranscription)) } + attr_reader :input_audio_transcription + + sig do + params( + input_audio_transcription: + OpenAI::Realtime::AudioTranscription::OrHash + ).void + end + attr_writer :input_audio_transcription + + # The set of modalities the model can respond with. To disable audio, set this to + # ["text"]. + sig do + returns( + T.nilable( + T::Array[ + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality::OrSymbol + ] + ) + ) + end + attr_reader :modalities + + sig do + params( + modalities: + T::Array[ + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality::OrSymbol + ] + ).void + end + attr_writer :modalities + + # Configuration for turn detection. Can be set to `null` to turn off. Server VAD + # means that the model will detect the start and end of speech based on audio + # volume and respond at the end of user speech. + sig do + returns( + T.nilable( + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection + ) + ) + end + attr_reader :turn_detection + + sig do + params( + turn_detection: + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection::OrHash + ).void + end + attr_writer :turn_detection + + # A new Realtime transcription session configuration. + # + # When a session is created on the server via REST API, the session object also + # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is + # not present when a session is updated via the WebSocket API. + sig do + params( + client_secret: + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret::OrHash, + input_audio_format: String, + input_audio_transcription: + OpenAI::Realtime::AudioTranscription::OrHash, + modalities: + T::Array[ + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality::OrSymbol + ], + turn_detection: + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection::OrHash + ).returns(T.attached_class) + end + def self.new( + # Ephemeral key returned by the API. Only present when the session is created on + # the server via REST API. + client_secret:, + # The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + input_audio_format: nil, + # Configuration of the transcription model. + input_audio_transcription: nil, + # The set of modalities the model can respond with. To disable audio, set this to + # ["text"]. + modalities: nil, + # Configuration for turn detection. Can be set to `null` to turn off. Server VAD + # means that the model will detect the start and end of speech based on audio + # volume and respond at the end of user speech. + turn_detection: nil + ) + end + + sig do + override.returns( + { + client_secret: + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret, + input_audio_format: String, + input_audio_transcription: OpenAI::Realtime::AudioTranscription, + modalities: + T::Array[ + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality::OrSymbol + ], + turn_detection: + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection + } + ) + end + def to_hash + end + + class ClientSecret < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret, + OpenAI::Internal::AnyHash + ) + end + + # Timestamp for when the token expires. Currently, all tokens expire after one + # minute. + sig { returns(Integer) } + attr_accessor :expires_at + + # Ephemeral key usable in client environments to authenticate connections to the + # Realtime API. Use this in client-side environments rather than a standard API + # token, which should only be used server-side. + sig { returns(String) } + attr_accessor :value + + # Ephemeral key returned by the API. Only present when the session is created on + # the server via REST API. + sig do + params(expires_at: Integer, value: String).returns( + T.attached_class + ) + end + def self.new( + # Timestamp for when the token expires. Currently, all tokens expire after one + # minute. + expires_at:, + # Ephemeral key usable in client environments to authenticate connections to the + # Realtime API. Use this in client-side environments rather than a standard API + # token, which should only be used server-side. + value: + ) + end + + sig { override.returns({ expires_at: Integer, value: String }) } + def to_hash + end + end + + module Modality + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TEXT = + T.let( + :text, + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality::TaggedSymbol + ) + AUDIO = + T.let( + :audio, + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality::TaggedSymbol + ] + ) + end + def self.values + end + end + + class TurnDetection < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection, + OpenAI::Internal::AnyHash + ) + end + + # Amount of audio to include before the VAD detected speech (in milliseconds). + # Defaults to 300ms. + sig { returns(T.nilable(Integer)) } + attr_reader :prefix_padding_ms + + sig { params(prefix_padding_ms: Integer).void } + attr_writer :prefix_padding_ms + + # Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + # With shorter values the model will respond more quickly, but may jump in on + # short pauses from the user. + sig { returns(T.nilable(Integer)) } + attr_reader :silence_duration_ms + + sig { params(silence_duration_ms: Integer).void } + attr_writer :silence_duration_ms + + # Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + # threshold will require louder audio to activate the model, and thus might + # perform better in noisy environments. + sig { returns(T.nilable(Float)) } + attr_reader :threshold + + sig { params(threshold: Float).void } + attr_writer :threshold + + # Type of turn detection, only `server_vad` is currently supported. + sig { returns(T.nilable(String)) } + attr_reader :type + + sig { params(type: String).void } + attr_writer :type + + # Configuration for turn detection. Can be set to `null` to turn off. Server VAD + # means that the model will detect the start and end of speech based on audio + # volume and respond at the end of user speech. + sig do + params( + prefix_padding_ms: Integer, + silence_duration_ms: Integer, + threshold: Float, + type: String + ).returns(T.attached_class) + end + def self.new( + # Amount of audio to include before the VAD detected speech (in milliseconds). + # Defaults to 300ms. + prefix_padding_ms: nil, + # Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + # With shorter values the model will respond more quickly, but may jump in on + # short pauses from the user. + silence_duration_ms: nil, + # Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + # threshold will require louder audio to activate the model, and thus might + # perform better in noisy environments. + threshold: nil, + # Type of turn detection, only `server_vad` is currently supported. + type: nil + ) + end + + sig do + override.returns( + { + prefix_padding_ms: Integer, + silence_duration_ms: Integer, + threshold: Float, + type: String + } + ) + end + def to_hash + end + end + end end end end diff --git a/sig/openai/models/realtime/realtime_client_event.rbs b/sig/openai/models/realtime/realtime_client_event.rbs index d6a0867e..92c7759b 100644 --- a/sig/openai/models/realtime/realtime_client_event.rbs +++ b/sig/openai/models/realtime/realtime_client_event.rbs @@ -13,7 +13,6 @@ module OpenAI | OpenAI::Realtime::ResponseCancelEvent | OpenAI::Realtime::ResponseCreateEvent | OpenAI::Realtime::SessionUpdateEvent - | OpenAI::Realtime::TranscriptionSessionUpdate module RealtimeClientEvent extend OpenAI::Internal::Type::Union diff --git a/sig/openai/models/realtime/models.rbs b/sig/openai/models/realtime/realtime_function_tool.rbs similarity index 61% rename from sig/openai/models/realtime/models.rbs rename to sig/openai/models/realtime/realtime_function_tool.rbs index 79d6fe86..0f9ba3f9 100644 --- a/sig/openai/models/realtime/models.rbs +++ b/sig/openai/models/realtime/realtime_function_tool.rbs @@ -1,15 +1,15 @@ module OpenAI module Models module Realtime - type models = + type realtime_function_tool = { description: String, name: String, parameters: top, - type: OpenAI::Models::Realtime::Models::type_ + type: OpenAI::Models::Realtime::RealtimeFunctionTool::type_ } - class Models < OpenAI::Internal::Type::BaseModel + class RealtimeFunctionTool < OpenAI::Internal::Type::BaseModel attr_reader description: String? def description=: (String) -> String @@ -22,24 +22,24 @@ module OpenAI def parameters=: (top) -> top - attr_reader type: OpenAI::Models::Realtime::Models::type_? + attr_reader type: OpenAI::Models::Realtime::RealtimeFunctionTool::type_? def type=: ( - OpenAI::Models::Realtime::Models::type_ - ) -> OpenAI::Models::Realtime::Models::type_ + OpenAI::Models::Realtime::RealtimeFunctionTool::type_ + ) -> OpenAI::Models::Realtime::RealtimeFunctionTool::type_ def initialize: ( ?description: String, ?name: String, ?parameters: top, - ?type: OpenAI::Models::Realtime::Models::type_ + ?type: OpenAI::Models::Realtime::RealtimeFunctionTool::type_ ) -> void def to_hash: -> { description: String, name: String, parameters: top, - type: OpenAI::Models::Realtime::Models::type_ + type: OpenAI::Models::Realtime::RealtimeFunctionTool::type_ } type type_ = :function @@ -49,7 +49,7 @@ module OpenAI FUNCTION: :function - def self?.values: -> ::Array[OpenAI::Models::Realtime::Models::type_] + def self?.values: -> ::Array[OpenAI::Models::Realtime::RealtimeFunctionTool::type_] end end end diff --git a/sig/openai/models/realtime/realtime_response_create_params.rbs b/sig/openai/models/realtime/realtime_response_create_params.rbs index 791fadbe..c07c4534 100644 --- a/sig/openai/models/realtime/realtime_response_create_params.rbs +++ b/sig/openai/models/realtime/realtime_response_create_params.rbs @@ -134,7 +134,7 @@ module OpenAI end type tool = - OpenAI::Realtime::Models + OpenAI::Realtime::RealtimeFunctionTool | OpenAI::Realtime::RealtimeResponseCreateMcpTool module Tool diff --git a/sig/openai/models/realtime/realtime_server_event.rbs b/sig/openai/models/realtime/realtime_server_event.rbs index a7f8e12f..d460f5f5 100644 --- a/sig/openai/models/realtime/realtime_server_event.rbs +++ b/sig/openai/models/realtime/realtime_server_event.rbs @@ -32,8 +32,6 @@ module OpenAI | OpenAI::Realtime::ResponseTextDoneEvent | OpenAI::Realtime::SessionCreatedEvent | OpenAI::Realtime::SessionUpdatedEvent - | OpenAI::Realtime::TranscriptionSessionUpdatedEvent - | OpenAI::Realtime::TranscriptionSessionCreated | OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferStarted | OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferStopped | OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferCleared diff --git a/sig/openai/models/realtime/realtime_session.rbs b/sig/openai/models/realtime/realtime_session.rbs index a7955ca2..3f239c05 100644 --- a/sig/openai/models/realtime/realtime_session.rbs +++ b/sig/openai/models/realtime/realtime_session.rbs @@ -19,7 +19,7 @@ module OpenAI speed: Float, temperature: Float, tool_choice: String, - tools: ::Array[OpenAI::Realtime::Models], + tools: ::Array[OpenAI::Realtime::RealtimeFunctionTool], tracing: OpenAI::Models::Realtime::RealtimeSession::tracing?, turn_detection: OpenAI::Realtime::RealtimeSession::TurnDetection?, voice: OpenAI::Models::Realtime::RealtimeSession::voice @@ -98,11 +98,11 @@ module OpenAI def tool_choice=: (String) -> String - attr_reader tools: ::Array[OpenAI::Realtime::Models]? + attr_reader tools: ::Array[OpenAI::Realtime::RealtimeFunctionTool]? def tools=: ( - ::Array[OpenAI::Realtime::Models] - ) -> ::Array[OpenAI::Realtime::Models] + ::Array[OpenAI::Realtime::RealtimeFunctionTool] + ) -> ::Array[OpenAI::Realtime::RealtimeFunctionTool] attr_accessor tracing: OpenAI::Models::Realtime::RealtimeSession::tracing? @@ -131,7 +131,7 @@ module OpenAI ?speed: Float, ?temperature: Float, ?tool_choice: String, - ?tools: ::Array[OpenAI::Realtime::Models], + ?tools: ::Array[OpenAI::Realtime::RealtimeFunctionTool], ?tracing: OpenAI::Models::Realtime::RealtimeSession::tracing?, ?turn_detection: OpenAI::Realtime::RealtimeSession::TurnDetection?, ?voice: OpenAI::Models::Realtime::RealtimeSession::voice @@ -154,7 +154,7 @@ module OpenAI speed: Float, temperature: Float, tool_choice: String, - tools: ::Array[OpenAI::Realtime::Models], + tools: ::Array[OpenAI::Realtime::RealtimeFunctionTool], tracing: OpenAI::Models::Realtime::RealtimeSession::tracing?, turn_detection: OpenAI::Realtime::RealtimeSession::TurnDetection?, voice: OpenAI::Models::Realtime::RealtimeSession::voice diff --git a/sig/openai/models/realtime/realtime_session_create_response.rbs b/sig/openai/models/realtime/realtime_session_create_response.rbs index 86d7963a..fbecbd5d 100644 --- a/sig/openai/models/realtime/realtime_session_create_response.rbs +++ b/sig/openai/models/realtime/realtime_session_create_response.rbs @@ -5,8 +5,9 @@ module OpenAI module Realtime type realtime_session_create_response = { - audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, + type: :realtime, + audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::include_], instructions: String, max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::max_output_tokens, @@ -16,23 +17,20 @@ module OpenAI tool_choice: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool_choice, tools: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool], tracing: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tracing?, - truncation: OpenAI::Models::Realtime::realtime_truncation, - type: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::type_ + truncation: OpenAI::Models::Realtime::realtime_truncation } class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel + attr_accessor client_secret: OpenAI::Realtime::RealtimeSessionClientSecret + + attr_accessor type: :realtime + attr_reader audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio? def audio=: ( OpenAI::Realtime::RealtimeSessionCreateResponse::Audio ) -> OpenAI::Realtime::RealtimeSessionCreateResponse::Audio - attr_reader client_secret: OpenAI::Realtime::RealtimeSessionClientSecret? - - def client_secret=: ( - OpenAI::Realtime::RealtimeSessionClientSecret - ) -> OpenAI::Realtime::RealtimeSessionClientSecret - attr_reader include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::include_]? def include=: ( @@ -83,15 +81,9 @@ module OpenAI OpenAI::Models::Realtime::realtime_truncation ) -> OpenAI::Models::Realtime::realtime_truncation - attr_reader type: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::type_? - - def type=: ( - OpenAI::Models::Realtime::RealtimeSessionCreateResponse::type_ - ) -> OpenAI::Models::Realtime::RealtimeSessionCreateResponse::type_ - def initialize: ( + client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, ?audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, - ?client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, ?include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::include_], ?instructions: String, ?max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::max_output_tokens, @@ -102,12 +94,13 @@ module OpenAI ?tools: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool], ?tracing: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tracing?, ?truncation: OpenAI::Models::Realtime::realtime_truncation, - ?type: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::type_ + ?type: :realtime ) -> void def to_hash: -> { - audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, + type: :realtime, + audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::include_], instructions: String, max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::max_output_tokens, @@ -117,8 +110,7 @@ module OpenAI tool_choice: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool_choice, tools: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool], tracing: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tracing?, - truncation: OpenAI::Models::Realtime::realtime_truncation, - type: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::type_ + truncation: OpenAI::Models::Realtime::realtime_truncation } type audio = @@ -446,7 +438,7 @@ module OpenAI end type tool = - OpenAI::Realtime::Models + OpenAI::Realtime::RealtimeFunctionTool | OpenAI::Realtime::RealtimeSessionCreateResponse::Tool::McpTool module Tool @@ -712,16 +704,6 @@ module OpenAI def self?.variants: -> ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tracing] end - - type type_ = :realtime - - module Type - extend OpenAI::Internal::Type::Enum - - REALTIME: :realtime - - def self?.values: -> ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::type_] - end end end end diff --git a/sig/openai/models/realtime/realtime_tools_config_union.rbs b/sig/openai/models/realtime/realtime_tools_config_union.rbs index dd53d8ea..4bcb800c 100644 --- a/sig/openai/models/realtime/realtime_tools_config_union.rbs +++ b/sig/openai/models/realtime/realtime_tools_config_union.rbs @@ -2,7 +2,7 @@ module OpenAI module Models module Realtime type realtime_tools_config_union = - OpenAI::Realtime::Models + OpenAI::Realtime::RealtimeFunctionTool | OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp module RealtimeToolsConfigUnion diff --git a/sig/openai/models/realtime/realtime_transcription_session_client_secret.rbs b/sig/openai/models/realtime/realtime_transcription_session_client_secret.rbs deleted file mode 100644 index 06e0d731..00000000 --- a/sig/openai/models/realtime/realtime_transcription_session_client_secret.rbs +++ /dev/null @@ -1,20 +0,0 @@ -module OpenAI - module Models - class RealtimeTranscriptionSessionClientSecret = Realtime::RealtimeTranscriptionSessionClientSecret - - module Realtime - type realtime_transcription_session_client_secret = - { expires_at: Integer, value: String } - - class RealtimeTranscriptionSessionClientSecret < OpenAI::Internal::Type::BaseModel - attr_accessor expires_at: Integer - - attr_accessor value: String - - def initialize: (expires_at: Integer, value: String) -> void - - def to_hash: -> { expires_at: Integer, value: String } - end - end - end -end diff --git a/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs b/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs index 9b28ed78..195d2a4d 100644 --- a/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs +++ b/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs @@ -5,63 +5,151 @@ module OpenAI module Realtime type realtime_transcription_session_create_response = { - client_secret: OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret, - input_audio_format: String, - input_audio_transcription: OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription, - modalities: ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::modality], - turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + id: String, + object: String, + type: :transcription, + audio: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio, + expires_at: Integer, + include: ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::include_] } class RealtimeTranscriptionSessionCreateResponse < OpenAI::Internal::Type::BaseModel - attr_accessor client_secret: OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret + attr_accessor id: String - attr_reader input_audio_format: String? + attr_accessor object: String - def input_audio_format=: (String) -> String + attr_accessor type: :transcription - attr_reader input_audio_transcription: OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription? + attr_reader audio: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio? - def input_audio_transcription=: ( - OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription - ) -> OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription + def audio=: ( + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio + ) -> OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio - attr_reader modalities: ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::modality]? + attr_reader expires_at: Integer? - def modalities=: ( - ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::modality] - ) -> ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::modality] + def expires_at=: (Integer) -> Integer - attr_reader turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection? + attr_reader include: ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::include_]? - def turn_detection=: ( - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection - ) -> OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + def include=: ( + ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::include_] + ) -> ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::include_] def initialize: ( - client_secret: OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret, - ?input_audio_format: String, - ?input_audio_transcription: OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription, - ?modalities: ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::modality], - ?turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + id: String, + object: String, + ?audio: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio, + ?expires_at: Integer, + ?include: ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::include_], + ?type: :transcription ) -> void def to_hash: -> { - client_secret: OpenAI::Realtime::RealtimeTranscriptionSessionClientSecret, - input_audio_format: String, - input_audio_transcription: OpenAI::Realtime::RealtimeTranscriptionSessionInputAudioTranscription, - modalities: ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::modality], - turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + id: String, + object: String, + type: :transcription, + audio: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio, + expires_at: Integer, + include: ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::include_] } - type modality = :text | :audio + type audio = + { + input: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input + } - module Modality + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader input: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input? + + def input=: ( + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input + ) -> OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input + + def initialize: ( + ?input: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input + ) -> void + + def to_hash: -> { + input: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input + } + + type input = + { + format_: OpenAI::Models::Realtime::realtime_audio_formats, + noise_reduction: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, + transcription: OpenAI::Realtime::AudioTranscription, + turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + } + + class Input < OpenAI::Internal::Type::BaseModel + attr_reader format_: OpenAI::Models::Realtime::realtime_audio_formats? + + def format_=: ( + OpenAI::Models::Realtime::realtime_audio_formats + ) -> OpenAI::Models::Realtime::realtime_audio_formats + + attr_reader noise_reduction: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction? + + def noise_reduction=: ( + OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction + ) -> OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction + + attr_reader transcription: OpenAI::Realtime::AudioTranscription? + + def transcription=: ( + OpenAI::Realtime::AudioTranscription + ) -> OpenAI::Realtime::AudioTranscription + + attr_reader turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection? + + def turn_detection=: ( + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + ) -> OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + + def initialize: ( + ?format_: OpenAI::Models::Realtime::realtime_audio_formats, + ?noise_reduction: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, + ?transcription: OpenAI::Realtime::AudioTranscription, + ?turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + ) -> void + + def to_hash: -> { + format_: OpenAI::Models::Realtime::realtime_audio_formats, + noise_reduction: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, + transcription: OpenAI::Realtime::AudioTranscription, + turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + } + + type noise_reduction = + { type: OpenAI::Models::Realtime::noise_reduction_type } + + class NoiseReduction < OpenAI::Internal::Type::BaseModel + attr_reader type: OpenAI::Models::Realtime::noise_reduction_type? + + def type=: ( + OpenAI::Models::Realtime::noise_reduction_type + ) -> OpenAI::Models::Realtime::noise_reduction_type + + def initialize: ( + ?type: OpenAI::Models::Realtime::noise_reduction_type + ) -> void + + def to_hash: -> { + type: OpenAI::Models::Realtime::noise_reduction_type + } + end + end + end + + type include_ = :"item.input_audio_transcription.logprobs" + + module Include extend OpenAI::Internal::Type::Enum - TEXT: :text - AUDIO: :audio + ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS: :"item.input_audio_transcription.logprobs" - def self?.values: -> ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::modality] + def self?.values: -> ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::include_] end end end diff --git a/sig/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbs b/sig/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbs deleted file mode 100644 index 7da5320d..00000000 --- a/sig/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbs +++ /dev/null @@ -1,59 +0,0 @@ -module OpenAI - module Models - class RealtimeTranscriptionSessionInputAudioTranscription = Realtime::RealtimeTranscriptionSessionInputAudioTranscription - - module Realtime - type realtime_transcription_session_input_audio_transcription = - { - language: String, - model: OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::model, - prompt: String - } - - class RealtimeTranscriptionSessionInputAudioTranscription < OpenAI::Internal::Type::BaseModel - attr_reader language: String? - - def language=: (String) -> String - - attr_reader model: OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::model? - - def model=: ( - OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::model - ) -> OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::model - - attr_reader prompt: String? - - def prompt=: (String) -> String - - def initialize: ( - ?language: String, - ?model: OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::model, - ?prompt: String - ) -> void - - def to_hash: -> { - language: String, - model: OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::model, - prompt: String - } - - type model = - :"whisper-1" - | :"gpt-4o-transcribe-latest" - | :"gpt-4o-mini-transcribe" - | :"gpt-4o-transcribe" - - module Model - extend OpenAI::Internal::Type::Enum - - WHISPER_1: :"whisper-1" - GPT_4O_TRANSCRIBE_LATEST: :"gpt-4o-transcribe-latest" - GPT_4O_MINI_TRANSCRIBE: :"gpt-4o-mini-transcribe" - GPT_4O_TRANSCRIBE: :"gpt-4o-transcribe" - - def self?.values: -> ::Array[OpenAI::Models::Realtime::RealtimeTranscriptionSessionInputAudioTranscription::model] - end - end - end - end -end diff --git a/sig/openai/models/realtime/transcription_session_created.rbs b/sig/openai/models/realtime/transcription_session_created.rbs deleted file mode 100644 index 73c1a673..00000000 --- a/sig/openai/models/realtime/transcription_session_created.rbs +++ /dev/null @@ -1,32 +0,0 @@ -module OpenAI - module Models - module Realtime - type transcription_session_created = - { - event_id: String, - session: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse, - type: :"transcription_session.created" - } - - class TranscriptionSessionCreated < OpenAI::Internal::Type::BaseModel - attr_accessor event_id: String - - attr_accessor session: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse - - attr_accessor type: :"transcription_session.created" - - def initialize: ( - event_id: String, - session: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse, - ?type: :"transcription_session.created" - ) -> void - - def to_hash: -> { - event_id: String, - session: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse, - type: :"transcription_session.created" - } - end - end - end -end diff --git a/sig/openai/models/realtime/transcription_session_updated_event.rbs b/sig/openai/models/realtime/transcription_session_updated_event.rbs index ac91e4e9..fdcfbf42 100644 --- a/sig/openai/models/realtime/transcription_session_updated_event.rbs +++ b/sig/openai/models/realtime/transcription_session_updated_event.rbs @@ -4,28 +4,142 @@ module OpenAI type transcription_session_updated_event = { event_id: String, - session: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse, + session: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session, type: :"transcription_session.updated" } class TranscriptionSessionUpdatedEvent < OpenAI::Internal::Type::BaseModel attr_accessor event_id: String - attr_accessor session: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse + attr_accessor session: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session attr_accessor type: :"transcription_session.updated" def initialize: ( event_id: String, - session: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse, + session: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session, ?type: :"transcription_session.updated" ) -> void def to_hash: -> { event_id: String, - session: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse, + session: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session, type: :"transcription_session.updated" } + + type session = + { + client_secret: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret, + input_audio_format: String, + input_audio_transcription: OpenAI::Realtime::AudioTranscription, + modalities: ::Array[OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::modality], + turn_detection: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection + } + + class Session < OpenAI::Internal::Type::BaseModel + attr_accessor client_secret: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret + + attr_reader input_audio_format: String? + + def input_audio_format=: (String) -> String + + attr_reader input_audio_transcription: OpenAI::Realtime::AudioTranscription? + + def input_audio_transcription=: ( + OpenAI::Realtime::AudioTranscription + ) -> OpenAI::Realtime::AudioTranscription + + attr_reader modalities: ::Array[OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::modality]? + + def modalities=: ( + ::Array[OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::modality] + ) -> ::Array[OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::modality] + + attr_reader turn_detection: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection? + + def turn_detection=: ( + OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection + ) -> OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection + + def initialize: ( + client_secret: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret, + ?input_audio_format: String, + ?input_audio_transcription: OpenAI::Realtime::AudioTranscription, + ?modalities: ::Array[OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::modality], + ?turn_detection: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection + ) -> void + + def to_hash: -> { + client_secret: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret, + input_audio_format: String, + input_audio_transcription: OpenAI::Realtime::AudioTranscription, + modalities: ::Array[OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::modality], + turn_detection: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection + } + + type client_secret = { expires_at: Integer, value: String } + + class ClientSecret < OpenAI::Internal::Type::BaseModel + attr_accessor expires_at: Integer + + attr_accessor value: String + + def initialize: (expires_at: Integer, value: String) -> void + + def to_hash: -> { expires_at: Integer, value: String } + end + + type modality = :text | :audio + + module Modality + extend OpenAI::Internal::Type::Enum + + TEXT: :text + AUDIO: :audio + + def self?.values: -> ::Array[OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::modality] + end + + type turn_detection = + { + prefix_padding_ms: Integer, + silence_duration_ms: Integer, + threshold: Float, + type: String + } + + class TurnDetection < OpenAI::Internal::Type::BaseModel + attr_reader prefix_padding_ms: Integer? + + def prefix_padding_ms=: (Integer) -> Integer + + attr_reader silence_duration_ms: Integer? + + def silence_duration_ms=: (Integer) -> Integer + + attr_reader threshold: Float? + + def threshold=: (Float) -> Float + + attr_reader type: String? + + def type=: (String) -> String + + def initialize: ( + ?prefix_padding_ms: Integer, + ?silence_duration_ms: Integer, + ?threshold: Float, + ?type: String + ) -> void + + def to_hash: -> { + prefix_padding_ms: Integer, + silence_duration_ms: Integer, + threshold: Float, + type: String + } + end + end end end end