From 7f0bb9ff05e61442e18479774ea0d8abccba23ec Mon Sep 17 00:00:00 2001 From: apcha-oai <228803254+apcha-oai@users.noreply.github.com> Date: Thu, 10 Sep 2026 17:11:09 +0000 Subject: [PATCH] feat(api) Add Live API Castiron-Internal-PR: https://github.com/openai/openai-ruby-internal/pull/86 Castiron-Source-SHA: b22ea7f177fc54317c450e03754f3dbd7bef36ed Castiron-Public-Base-SHA: 7f19b932549bd7d4376e6ca91c7c75f9b856ae83 --- .castiron.stats.yml | 14 +- api_reference/openapi.transformed.yml | 3650 +++++++++++++++-- examples/e2e.yml | 3 + examples/live/webrtc.rb | 39 + lib/openai.rb | 65 + lib/openai/client.rb | 4 + lib/openai/models.rb | 2 + .../models/beta/beta_response_input_item.rb | 92 +- lib/openai/models/beta/beta_response_item.rb | 94 +- .../models/beta/beta_response_output_item.rb | 92 +- .../models/conversations/conversation_item.rb | 92 +- lib/openai/models/live/audio_format.rb | 109 + lib/openai/models/live/built_in_voice.rb | 38 + lib/openai/models/live/client_config.rb | 22 + lib/openai/models/live/client_delegation.rb | 22 + lib/openai/models/live/client_event.rb | 54 + .../models/live/commentary_append_event.rb | 59 + .../models/live/commentary_appended_event.rb | 65 + lib/openai/models/live/custom_voice.rb | 17 + lib/openai/models/live/data_channel_config.rb | 81 + .../models/live/delegation_created_event.rb | 140 + lib/openai/models/live/error.rb | 60 + lib/openai/models/live/error_event.rb | 52 + lib/openai/models/live/fork_client_event.rb | 53 + lib/openai/models/live/fork_server_event.rb | 295 ++ lib/openai/models/live/fork_session_config.rb | 107 + .../models/live/fork_session_start_event.rb | 48 + lib/openai/models/live/function_tool.rb | 60 + lib/openai/models/live/info_event.rb | 60 + lib/openai/models/live/initial_item.rb | 419 ++ .../models/live/input_audio_append_event.rb | 50 + .../models/live/input_audio_mute_event.rb | 33 + .../models/live/input_audio_muted_event.rb | 42 + .../models/live/input_audio_unmute_event.rb | 33 + .../models/live/input_audio_unmuted_event.rb | 42 + .../live/input_transcript_delta_event.rb | 76 + .../models/live/instructions_append_event.rb | 57 + .../live/instructions_appended_event.rb | 65 + lib/openai/models/live/live_create_params.rb | 57 + .../models/live/live_create_response.rb | 77 + .../models/live/media_session_config.rb | 227 + .../models/live/media_session_fork_config.rb | 75 + .../models/live/output_audio_delta_event.rb | 58 + .../live/output_transcript_delta_event.rb | 76 + .../models/live/response_create_event.rb | 33 + lib/openai/models/live/response_event.rb | 67 + .../models/live/response_item_create_event.rb | 44 + .../live/responses_delegation_config.rb | 332 ++ .../responses_delegation_update_config.rb | 332 ++ lib/openai/models/live/server_event.rb | 295 ++ .../models/live/server_event_selector.rb | 32 + .../models/live/session_accept_params.rb | 257 ++ lib/openai/models/live/session_close_event.rb | 33 + .../models/live/session_closed_event.rb | 113 + lib/openai/models/live/session_config.rb | 236 ++ .../live/session_download_recording_params.rb | 27 + lib/openai/models/live/session_fork_params.rb | 66 + .../models/live/session_fork_response.rb | 77 + .../models/live/session_hangup_params.rb | 22 + .../models/live/session_refer_params.rb | 34 + .../models/live/session_reject_params.rb | 32 + lib/openai/models/live/session_resource.rb | 268 ++ lib/openai/models/live/session_start_event.rb | 46 + .../models/live/session_started_event.rb | 51 + .../models/live/session_update_config.rb | 69 + .../models/live/session_update_event.rb | 46 + .../models/live/session_updated_event.rb | 51 + lib/openai/models/live/session_usage.rb | 24 + .../live/session_usage_updated_event.rb | 81 + .../models/live/thinking_append_event.rb | 59 + .../models/live/thinking_appended_event.rb | 65 + .../models/responses/response_input_item.rb | 92 +- lib/openai/models/responses/response_item.rb | 94 +- .../models/responses/response_output_item.rb | 92 +- .../live_call_incoming_webhook_event.rb | 19 +- .../live_transport_incoming_webhook_event.rb | 137 + .../realtime_call_incoming_webhook_event.rb | 8 +- .../models/webhooks/unwrap_webhook_event.rb | 11 +- lib/openai/resources/live.rb | 54 + lib/openai/resources/live/forks.rb | 16 + lib/openai/resources/live/sessions.rb | 180 + lib/openai/resources/live/sideband.rb | 16 + lib/openai/resources/webhooks.rb | 2 +- rbi/openai/client.rbi | 3 + rbi/openai/models.rbi | 2 + .../models/beta/beta_response_input_item.rbi | 109 + rbi/openai/models/beta/beta_response_item.rbi | 105 + .../models/beta/beta_response_output_item.rbi | 119 + .../conversations/conversation_item.rbi | 133 + rbi/openai/models/live/audio_format.rbi | 185 + rbi/openai/models/live/built_in_voice.rbi | 46 + rbi/openai/models/live/client_config.rbi | 54 + rbi/openai/models/live/client_delegation.rbi | 51 + rbi/openai/models/live/client_event.rbi | 41 + .../models/live/commentary_append_event.rbi | 88 + .../models/live/commentary_appended_event.rbi | 97 + rbi/openai/models/live/custom_voice.rbi | 46 + .../models/live/data_channel_config.rbi | 119 + .../models/live/delegation_created_event.rbi | 207 + rbi/openai/models/live/error.rbi | 95 + rbi/openai/models/live/error_event.rbi | 87 + rbi/openai/models/live/fork_client_event.rbi | 40 + rbi/openai/models/live/fork_server_event.rbi | 436 ++ .../models/live/fork_session_config.rbi | 234 ++ .../models/live/fork_session_start_event.rbi | 80 + rbi/openai/models/live/function_tool.rbi | 95 + rbi/openai/models/live/info_event.rbi | 92 + rbi/openai/models/live/initial_item.rbi | 661 +++ .../models/live/input_audio_append_event.rbi | 79 + .../models/live/input_audio_mute_event.rbi | 62 + .../models/live/input_audio_muted_event.rbi | 74 + .../models/live/input_audio_unmute_event.rbi | 62 + .../models/live/input_audio_unmuted_event.rbi | 74 + .../live/input_transcript_delta_event.rbi | 115 + .../models/live/instructions_append_event.rbi | 86 + .../live/instructions_appended_event.rbi | 97 + rbi/openai/models/live/live_create_params.rbi | 121 + .../models/live/live_create_response.rbi | 160 + .../models/live/media_session_config.rbi | 390 ++ .../models/live/media_session_fork_config.rbi | 143 + .../models/live/output_audio_delta_event.rbi | 93 + .../live/output_transcript_delta_event.rbi | 115 + .../models/live/response_create_event.rbi | 62 + rbi/openai/models/live/response_event.rbi | 105 + .../live/response_item_create_event.rbi | 183 + .../live/responses_delegation_config.rbi | 562 +++ .../responses_delegation_update_config.rbi | 585 +++ rbi/openai/models/live/server_event.rbi | 436 ++ .../models/live/server_event_selector.rbi | 64 + .../models/live/session_accept_params.rbi | 451 ++ .../models/live/session_close_event.rbi | 62 + .../models/live/session_closed_event.rbi | 148 + rbi/openai/models/live/session_config.rbi | 427 ++ .../session_download_recording_params.rbi | 57 + .../models/live/session_fork_params.rbi | 131 + .../models/live/session_fork_response.rbi | 160 + .../models/live/session_hangup_params.rbi | 53 + .../models/live/session_refer_params.rbi | 64 + .../models/live/session_reject_params.rbi | 62 + rbi/openai/models/live/session_resource.rbi | 461 +++ .../models/live/session_start_event.rbi | 78 + .../models/live/session_started_event.rbi | 86 + .../models/live/session_update_config.rbi | 134 + .../models/live/session_update_event.rbi | 78 + .../models/live/session_updated_event.rbi | 86 + rbi/openai/models/live/session_usage.rbi | 53 + .../live/session_usage_updated_event.rbi | 148 + .../models/live/thinking_append_event.rbi | 88 + .../models/live/thinking_appended_event.rbi | 97 + .../models/responses/response_input_item.rbi | 113 + rbi/openai/models/responses/response_item.rbi | 105 + .../models/responses/response_output_item.rbi | 125 + .../live_call_incoming_webhook_event.rbi | 18 +- .../live_transport_incoming_webhook_event.rbi | 226 + .../realtime_call_incoming_webhook_event.rbi | 8 +- .../models/webhooks/unwrap_webhook_event.rbi | 1 + rbi/openai/resources/live.rbi | 43 + rbi/openai/resources/live/forks.rbi | 19 + rbi/openai/resources/live/sessions.rbi | 110 + rbi/openai/resources/live/sideband.rbi | 19 + rbi/openai/resources/responses.rbi | 113 +- rbi/openai/resources/webhooks.rbi | 1 + sig/openai/client.rbs | 2 + sig/openai/models.rbs | 2 + .../models/beta/beta_response_input_item.rbs | 56 + sig/openai/models/beta/beta_response_item.rbs | 56 + .../models/beta/beta_response_output_item.rbs | 56 + .../conversations/conversation_item.rbs | 56 + sig/openai/models/live/audio_format.rbs | 73 + sig/openai/models/live/built_in_voice.rbs | 58 + sig/openai/models/live/client_config.rbs | 15 + sig/openai/models/live/client_delegation.rbs | 15 + sig/openai/models/live/client_event.rbs | 24 + .../models/live/commentary_append_event.rbs | 37 + .../models/live/commentary_appended_event.rbs | 44 + sig/openai/models/live/custom_voice.rbs | 15 + .../models/live/data_channel_config.rbs | 56 + .../models/live/delegation_created_event.rbs | 89 + sig/openai/models/live/error.rbs | 46 + sig/openai/models/live/error_event.rbs | 39 + sig/openai/models/live/fork_client_event.rbs | 24 + sig/openai/models/live/fork_server_event.rbs | 212 + .../models/live/fork_session_config.rbs | 89 + .../models/live/fork_session_start_event.rbs | 32 + sig/openai/models/live/function_tool.rbs | 42 + sig/openai/models/live/info_event.rbs | 44 + sig/openai/models/live/initial_item.rbs | 332 ++ .../models/live/input_audio_append_event.rbs | 32 + .../models/live/input_audio_mute_event.rbs | 24 + .../models/live/input_audio_muted_event.rbs | 34 + .../models/live/input_audio_unmute_event.rbs | 24 + .../models/live/input_audio_unmuted_event.rbs | 34 + .../live/input_transcript_delta_event.rbs | 49 + .../models/live/instructions_append_event.rbs | 37 + .../live/instructions_appended_event.rbs | 44 + sig/openai/models/live/live_create_params.rbs | 45 + .../models/live/live_create_response.rbs | 49 + .../models/live/media_session_config.rbs | 157 + .../models/live/media_session_fork_config.rbs | 66 + .../models/live/output_audio_delta_event.rbs | 41 + .../live/output_transcript_delta_event.rbs | 49 + .../models/live/response_create_event.rbs | 18 + sig/openai/models/live/response_event.rbs | 44 + .../live/response_item_create_event.rbs | 32 + .../live/responses_delegation_config.rbs | 244 ++ .../responses_delegation_update_config.rbs | 246 ++ sig/openai/models/live/server_event.rbs | 212 + .../models/live/server_event_selector.rbs | 19 + .../models/live/session_accept_params.rbs | 185 + .../models/live/session_close_event.rbs | 17 + .../models/live/session_closed_event.rbs | 68 + sig/openai/models/live/session_config.rbs | 168 + .../session_download_recording_params.rbs | 25 + .../models/live/session_fork_params.rbs | 54 + .../models/live/session_fork_response.rbs | 49 + .../models/live/session_hangup_params.rbs | 25 + .../models/live/session_refer_params.rbs | 33 + .../models/live/session_reject_params.rbs | 33 + sig/openai/models/live/session_resource.rbs | 183 + .../models/live/session_start_event.rbs | 32 + .../models/live/session_started_event.rbs | 39 + .../models/live/session_update_config.rbs | 56 + .../models/live/session_update_event.rbs | 32 + .../models/live/session_updated_event.rbs | 39 + sig/openai/models/live/session_usage.rbs | 15 + .../live/session_usage_updated_event.rbs | 58 + .../models/live/thinking_append_event.rbs | 37 + .../models/live/thinking_appended_event.rbs | 44 + .../models/responses/response_input_item.rbs | 56 + sig/openai/models/responses/response_item.rbs | 56 + .../models/responses/response_output_item.rbs | 56 + .../live_transport_incoming_webhook_event.rbs | 95 + .../models/webhooks/unwrap_webhook_event.rbs | 1 + sig/openai/resources/live.rbs | 19 + sig/openai/resources/live/forks.rbs | 9 + sig/openai/resources/live/sessions.rbs | 44 + sig/openai/resources/live/sideband.rbs | 9 + sig/openai/resources/webhooks.rbs | 1 + test/openai/live/webrtc_example_test.rb | 72 + test/openai/resource_namespaces.rb | 3 + .../beta/responses/input_items_test.rb | 4 + .../resources/conversations/items_test.rb | 8 + test/openai/resources/live/forks_test.rb | 6 + test/openai/resources/live/sessions_test.rb | 60 + test/openai/resources/live/sideband_test.rb | 6 + test/openai/resources/live_test.rb | 20 + .../resources/responses/input_items_test.rb | 4 + 247 files changed, 25486 insertions(+), 356 deletions(-) create mode 100755 examples/live/webrtc.rb create mode 100644 lib/openai/models/live/audio_format.rb create mode 100644 lib/openai/models/live/built_in_voice.rb create mode 100644 lib/openai/models/live/client_config.rb create mode 100644 lib/openai/models/live/client_delegation.rb create mode 100644 lib/openai/models/live/client_event.rb create mode 100644 lib/openai/models/live/commentary_append_event.rb create mode 100644 lib/openai/models/live/commentary_appended_event.rb create mode 100644 lib/openai/models/live/custom_voice.rb create mode 100644 lib/openai/models/live/data_channel_config.rb create mode 100644 lib/openai/models/live/delegation_created_event.rb create mode 100644 lib/openai/models/live/error.rb create mode 100644 lib/openai/models/live/error_event.rb create mode 100644 lib/openai/models/live/fork_client_event.rb create mode 100644 lib/openai/models/live/fork_server_event.rb create mode 100644 lib/openai/models/live/fork_session_config.rb create mode 100644 lib/openai/models/live/fork_session_start_event.rb create mode 100644 lib/openai/models/live/function_tool.rb create mode 100644 lib/openai/models/live/info_event.rb create mode 100644 lib/openai/models/live/initial_item.rb create mode 100644 lib/openai/models/live/input_audio_append_event.rb create mode 100644 lib/openai/models/live/input_audio_mute_event.rb create mode 100644 lib/openai/models/live/input_audio_muted_event.rb create mode 100644 lib/openai/models/live/input_audio_unmute_event.rb create mode 100644 lib/openai/models/live/input_audio_unmuted_event.rb create mode 100644 lib/openai/models/live/input_transcript_delta_event.rb create mode 100644 lib/openai/models/live/instructions_append_event.rb create mode 100644 lib/openai/models/live/instructions_appended_event.rb create mode 100644 lib/openai/models/live/live_create_params.rb create mode 100644 lib/openai/models/live/live_create_response.rb create mode 100644 lib/openai/models/live/media_session_config.rb create mode 100644 lib/openai/models/live/media_session_fork_config.rb create mode 100644 lib/openai/models/live/output_audio_delta_event.rb create mode 100644 lib/openai/models/live/output_transcript_delta_event.rb create mode 100644 lib/openai/models/live/response_create_event.rb create mode 100644 lib/openai/models/live/response_event.rb create mode 100644 lib/openai/models/live/response_item_create_event.rb create mode 100644 lib/openai/models/live/responses_delegation_config.rb create mode 100644 lib/openai/models/live/responses_delegation_update_config.rb create mode 100644 lib/openai/models/live/server_event.rb create mode 100644 lib/openai/models/live/server_event_selector.rb create mode 100644 lib/openai/models/live/session_accept_params.rb create mode 100644 lib/openai/models/live/session_close_event.rb create mode 100644 lib/openai/models/live/session_closed_event.rb create mode 100644 lib/openai/models/live/session_config.rb create mode 100644 lib/openai/models/live/session_download_recording_params.rb create mode 100644 lib/openai/models/live/session_fork_params.rb create mode 100644 lib/openai/models/live/session_fork_response.rb create mode 100644 lib/openai/models/live/session_hangup_params.rb create mode 100644 lib/openai/models/live/session_refer_params.rb create mode 100644 lib/openai/models/live/session_reject_params.rb create mode 100644 lib/openai/models/live/session_resource.rb create mode 100644 lib/openai/models/live/session_start_event.rb create mode 100644 lib/openai/models/live/session_started_event.rb create mode 100644 lib/openai/models/live/session_update_config.rb create mode 100644 lib/openai/models/live/session_update_event.rb create mode 100644 lib/openai/models/live/session_updated_event.rb create mode 100644 lib/openai/models/live/session_usage.rb create mode 100644 lib/openai/models/live/session_usage_updated_event.rb create mode 100644 lib/openai/models/live/thinking_append_event.rb create mode 100644 lib/openai/models/live/thinking_appended_event.rb create mode 100644 lib/openai/models/webhooks/live_transport_incoming_webhook_event.rb create mode 100644 lib/openai/resources/live.rb create mode 100644 lib/openai/resources/live/forks.rb create mode 100644 lib/openai/resources/live/sessions.rb create mode 100644 lib/openai/resources/live/sideband.rb create mode 100644 rbi/openai/models/live/audio_format.rbi create mode 100644 rbi/openai/models/live/built_in_voice.rbi create mode 100644 rbi/openai/models/live/client_config.rbi create mode 100644 rbi/openai/models/live/client_delegation.rbi create mode 100644 rbi/openai/models/live/client_event.rbi create mode 100644 rbi/openai/models/live/commentary_append_event.rbi create mode 100644 rbi/openai/models/live/commentary_appended_event.rbi create mode 100644 rbi/openai/models/live/custom_voice.rbi create mode 100644 rbi/openai/models/live/data_channel_config.rbi create mode 100644 rbi/openai/models/live/delegation_created_event.rbi create mode 100644 rbi/openai/models/live/error.rbi create mode 100644 rbi/openai/models/live/error_event.rbi create mode 100644 rbi/openai/models/live/fork_client_event.rbi create mode 100644 rbi/openai/models/live/fork_server_event.rbi create mode 100644 rbi/openai/models/live/fork_session_config.rbi create mode 100644 rbi/openai/models/live/fork_session_start_event.rbi create mode 100644 rbi/openai/models/live/function_tool.rbi create mode 100644 rbi/openai/models/live/info_event.rbi create mode 100644 rbi/openai/models/live/initial_item.rbi create mode 100644 rbi/openai/models/live/input_audio_append_event.rbi create mode 100644 rbi/openai/models/live/input_audio_mute_event.rbi create mode 100644 rbi/openai/models/live/input_audio_muted_event.rbi create mode 100644 rbi/openai/models/live/input_audio_unmute_event.rbi create mode 100644 rbi/openai/models/live/input_audio_unmuted_event.rbi create mode 100644 rbi/openai/models/live/input_transcript_delta_event.rbi create mode 100644 rbi/openai/models/live/instructions_append_event.rbi create mode 100644 rbi/openai/models/live/instructions_appended_event.rbi create mode 100644 rbi/openai/models/live/live_create_params.rbi create mode 100644 rbi/openai/models/live/live_create_response.rbi create mode 100644 rbi/openai/models/live/media_session_config.rbi create mode 100644 rbi/openai/models/live/media_session_fork_config.rbi create mode 100644 rbi/openai/models/live/output_audio_delta_event.rbi create mode 100644 rbi/openai/models/live/output_transcript_delta_event.rbi create mode 100644 rbi/openai/models/live/response_create_event.rbi create mode 100644 rbi/openai/models/live/response_event.rbi create mode 100644 rbi/openai/models/live/response_item_create_event.rbi create mode 100644 rbi/openai/models/live/responses_delegation_config.rbi create mode 100644 rbi/openai/models/live/responses_delegation_update_config.rbi create mode 100644 rbi/openai/models/live/server_event.rbi create mode 100644 rbi/openai/models/live/server_event_selector.rbi create mode 100644 rbi/openai/models/live/session_accept_params.rbi create mode 100644 rbi/openai/models/live/session_close_event.rbi create mode 100644 rbi/openai/models/live/session_closed_event.rbi create mode 100644 rbi/openai/models/live/session_config.rbi create mode 100644 rbi/openai/models/live/session_download_recording_params.rbi create mode 100644 rbi/openai/models/live/session_fork_params.rbi create mode 100644 rbi/openai/models/live/session_fork_response.rbi create mode 100644 rbi/openai/models/live/session_hangup_params.rbi create mode 100644 rbi/openai/models/live/session_refer_params.rbi create mode 100644 rbi/openai/models/live/session_reject_params.rbi create mode 100644 rbi/openai/models/live/session_resource.rbi create mode 100644 rbi/openai/models/live/session_start_event.rbi create mode 100644 rbi/openai/models/live/session_started_event.rbi create mode 100644 rbi/openai/models/live/session_update_config.rbi create mode 100644 rbi/openai/models/live/session_update_event.rbi create mode 100644 rbi/openai/models/live/session_updated_event.rbi create mode 100644 rbi/openai/models/live/session_usage.rbi create mode 100644 rbi/openai/models/live/session_usage_updated_event.rbi create mode 100644 rbi/openai/models/live/thinking_append_event.rbi create mode 100644 rbi/openai/models/live/thinking_appended_event.rbi create mode 100644 rbi/openai/models/webhooks/live_transport_incoming_webhook_event.rbi create mode 100644 rbi/openai/resources/live.rbi create mode 100644 rbi/openai/resources/live/forks.rbi create mode 100644 rbi/openai/resources/live/sessions.rbi create mode 100644 rbi/openai/resources/live/sideband.rbi create mode 100644 sig/openai/models/live/audio_format.rbs create mode 100644 sig/openai/models/live/built_in_voice.rbs create mode 100644 sig/openai/models/live/client_config.rbs create mode 100644 sig/openai/models/live/client_delegation.rbs create mode 100644 sig/openai/models/live/client_event.rbs create mode 100644 sig/openai/models/live/commentary_append_event.rbs create mode 100644 sig/openai/models/live/commentary_appended_event.rbs create mode 100644 sig/openai/models/live/custom_voice.rbs create mode 100644 sig/openai/models/live/data_channel_config.rbs create mode 100644 sig/openai/models/live/delegation_created_event.rbs create mode 100644 sig/openai/models/live/error.rbs create mode 100644 sig/openai/models/live/error_event.rbs create mode 100644 sig/openai/models/live/fork_client_event.rbs create mode 100644 sig/openai/models/live/fork_server_event.rbs create mode 100644 sig/openai/models/live/fork_session_config.rbs create mode 100644 sig/openai/models/live/fork_session_start_event.rbs create mode 100644 sig/openai/models/live/function_tool.rbs create mode 100644 sig/openai/models/live/info_event.rbs create mode 100644 sig/openai/models/live/initial_item.rbs create mode 100644 sig/openai/models/live/input_audio_append_event.rbs create mode 100644 sig/openai/models/live/input_audio_mute_event.rbs create mode 100644 sig/openai/models/live/input_audio_muted_event.rbs create mode 100644 sig/openai/models/live/input_audio_unmute_event.rbs create mode 100644 sig/openai/models/live/input_audio_unmuted_event.rbs create mode 100644 sig/openai/models/live/input_transcript_delta_event.rbs create mode 100644 sig/openai/models/live/instructions_append_event.rbs create mode 100644 sig/openai/models/live/instructions_appended_event.rbs create mode 100644 sig/openai/models/live/live_create_params.rbs create mode 100644 sig/openai/models/live/live_create_response.rbs create mode 100644 sig/openai/models/live/media_session_config.rbs create mode 100644 sig/openai/models/live/media_session_fork_config.rbs create mode 100644 sig/openai/models/live/output_audio_delta_event.rbs create mode 100644 sig/openai/models/live/output_transcript_delta_event.rbs create mode 100644 sig/openai/models/live/response_create_event.rbs create mode 100644 sig/openai/models/live/response_event.rbs create mode 100644 sig/openai/models/live/response_item_create_event.rbs create mode 100644 sig/openai/models/live/responses_delegation_config.rbs create mode 100644 sig/openai/models/live/responses_delegation_update_config.rbs create mode 100644 sig/openai/models/live/server_event.rbs create mode 100644 sig/openai/models/live/server_event_selector.rbs create mode 100644 sig/openai/models/live/session_accept_params.rbs create mode 100644 sig/openai/models/live/session_close_event.rbs create mode 100644 sig/openai/models/live/session_closed_event.rbs create mode 100644 sig/openai/models/live/session_config.rbs create mode 100644 sig/openai/models/live/session_download_recording_params.rbs create mode 100644 sig/openai/models/live/session_fork_params.rbs create mode 100644 sig/openai/models/live/session_fork_response.rbs create mode 100644 sig/openai/models/live/session_hangup_params.rbs create mode 100644 sig/openai/models/live/session_refer_params.rbs create mode 100644 sig/openai/models/live/session_reject_params.rbs create mode 100644 sig/openai/models/live/session_resource.rbs create mode 100644 sig/openai/models/live/session_start_event.rbs create mode 100644 sig/openai/models/live/session_started_event.rbs create mode 100644 sig/openai/models/live/session_update_config.rbs create mode 100644 sig/openai/models/live/session_update_event.rbs create mode 100644 sig/openai/models/live/session_updated_event.rbs create mode 100644 sig/openai/models/live/session_usage.rbs create mode 100644 sig/openai/models/live/session_usage_updated_event.rbs create mode 100644 sig/openai/models/live/thinking_append_event.rbs create mode 100644 sig/openai/models/live/thinking_appended_event.rbs create mode 100644 sig/openai/models/webhooks/live_transport_incoming_webhook_event.rbs create mode 100644 sig/openai/resources/live.rbs create mode 100644 sig/openai/resources/live/forks.rbs create mode 100644 sig/openai/resources/live/sessions.rbs create mode 100644 sig/openai/resources/live/sideband.rbs create mode 100644 test/openai/live/webrtc_example_test.rb create mode 100644 test/openai/resources/live/forks_test.rb create mode 100644 test/openai/resources/live/sessions_test.rb create mode 100644 test/openai/resources/live/sideband_test.rb create mode 100644 test/openai/resources/live_test.rb diff --git a/.castiron.stats.yml b/.castiron.stats.yml index 4a35347ae..62caa09c7 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,8 +1,8 @@ schema_version: 1 -generation_id: 343c25e0-559d-4268-b40d-eb35fc7f8a2a -openapi_spec_hash: cc8bc0e9cda20d98cbcab338ff08b50c -openapi_transformed_spec_hash: 2f1cea3510c46bd2b681baf83d8724c5 -config_hash: d7b82262337a543ff59106e4a32ead4e -codegen_sha: 6799e2136ecd93934219fe9881be618dbfdd9dd4 -codegen_hash: 3504e760c08cb4da862788b5cfacf2640f6b54ee67df10fc084873006e706594 -public_codegen_sha: 6a0bbe3b03ee4bc30789c39fe36a80fcac312007 +generation_id: 90145766-81b2-4f9e-aa08-34d49473f3e4 +openapi_spec_hash: 782181534a53a11117f14e80cb3883a9 +openapi_transformed_spec_hash: 22088ed8f250e13a06d229d57bcccdb3 +config_hash: e906a9378d154c280041967c79592d12 +codegen_sha: ffa87c574ee0d859a8655be8fca24b8b5b110966 +codegen_hash: 631855af70c7bc01e1bc477b4bce6668b5bab407a68303b35a5785782bbbe543 +public_codegen_sha: a578ab645df95d6a7025b5bae9a76d2b905ade71 diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index 072676533..f7e108486 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -8185,6 +8185,183 @@ paths: ] } description: Creates a variation of a given image. This endpoint only supports `dall-e-2`. + /live/sessions: + post: + operationId: create-live + summary: Create session + description: Create a Live WebRTC session. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting). + tags: + - Live + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LiveCreateRequest' + responses: + '201': + description: Live session created with a WebRTC answer. + content: + application/json: + schema: + $ref: '#/components/schemas/LiveCreateResponse' + example: + session: + id: live_123 + transport: + type: webrtc + sdp: + x-oaiMeta: + name: Create session + group: live + returns: Returns 201 Created with the session identifier in session.id and SDP answer in transport.sdp. + examples: + request: + curl: |- + curl https://api.openai.com/v1/live/sessions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"session":{"model":"gpt-live-1","instructions":"Be concise. Ask for clarification when needed."},"transport":{"type":"webrtc","sdp":""}}' + /live/sessions/{session_id}/accept: + post: + operationId: accept-live-session + summary: Accept call + description: Accept an incoming SIP call with Live startup configuration. + tags: + - Live + parameters: + - in: path + name: session_id + required: true + description: Opaque Live session identifier from the creation response or incoming-call webhook. Preserve the returned value unchanged, including its prefix. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LiveCallAcceptRequest' + responses: + '200': + description: Session accept request accepted. + x-oaiMeta: + name: Accept call + group: live-sessions + returns: Returns 200 OK when the control request succeeds. + /live/sessions/{session_id}/fork: + post: + operationId: fork-live-session + summary: Fork session + description: Fork a stored Live session onto a new WebRTC connection. + tags: + - Live + parameters: + - in: path + name: session_id + required: true + schema: + type: string + description: The ID of the stored Live session to fork. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LiveForkRequest' + responses: + '201': + description: Forked Live session created with a WebRTC answer. + content: + application/json: + schema: + $ref: '#/components/schemas/LiveCreateResponse' + x-oaiMeta: + name: Fork session + group: live + returns: The new session identifier in session.id and SDP answer in transport.sdp. + examples: + request: + curl: |- + curl https://api.openai.com/v1/live/sessions/live_123/fork \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"session":{},"transport":{"type":"webrtc","sdp":""}}' + /live/sessions/{session_id}/hangup: + post: + operationId: hangup-live-session + summary: Hang up session + description: Hang up a Live session. + tags: + - Live + parameters: + - in: path + name: session_id + required: true + description: Opaque Live session identifier from the creation response or incoming-call webhook. Preserve the returned value unchanged, including its prefix. + schema: + type: string + responses: + '200': + description: Session hangup request accepted. + x-oaiMeta: + name: Hang up session + group: live-sessions + returns: Returns 200 OK when the control request succeeds. + /live/sessions/{session_id}/refer: + post: + operationId: refer-live-session + summary: Transfer call + description: Transfer a Live SIP call to another destination. + tags: + - Live + parameters: + - in: path + name: session_id + required: true + description: Opaque Live session identifier from the creation response or incoming-call webhook. Preserve the returned value unchanged, including its prefix. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LiveCallReferRequest' + responses: + '200': + description: Session refer request accepted. + x-oaiMeta: + name: Transfer call + group: live-sessions + returns: Returns 200 OK when the control request succeeds. + /live/sessions/{session_id}/reject: + post: + operationId: reject-live-session + summary: Reject call + description: Reject an incoming SIP call. + tags: + - Live + parameters: + - in: path + name: session_id + required: true + description: Opaque Live session identifier from the creation response or incoming-call webhook. Preserve the returned value unchanged, including its prefix. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LiveCallRejectRequest' + responses: + '200': + description: Session reject request accepted. + x-oaiMeta: + name: Reject call + group: live-sessions + returns: Returns 200 OK when the control request succeeds. /models: get: operationId: listModels @@ -22581,6 +22758,35 @@ paths: "reason": "Potentially unintended data access." } description: Get a safety alert belonging to the authenticated API project. + /live/sessions/{session_id}/content: + get: + tags: + - Live + summary: Download recording + description: Get Live session content + operationId: download-live-recording + parameters: + - name: session_id + in: path + description: The ID of the stored Live session to download. Use the session ID returned when the session started with storage enabled. + required: true + schema: + description: The ID of the stored Live session to download. Use the session ID returned when the session started with storage enabled. + type: string + pattern: ^live_[A-Za-z0-9_-]{1,128}$ + responses: + '200': + description: Stored session recording. Input audio is in the left channel and output audio is in the right channel. + content: + audio/wav: + schema: + description: The Live session recording as a stereo WAV file, with input audio in the left channel and output audio in the right channel. + type: string + format: binary + x-oaiMeta: + name: Download recording + group: live + returns: The stored session recording as binary stereo WAV audio. /organization/spend_limit: get: summary: Retrieve organization spend limit @@ -27093,6 +27299,7 @@ webhooks: $ref: '#/components/schemas/WebhookFineTuningJobSucceeded' live_call_incoming: post: + deprecated: true responses: '200': description: | @@ -27104,6 +27311,19 @@ webhooks: application/json: schema: $ref: '#/components/schemas/WebhookLiveCallIncoming' + live_transport_incoming: + post: + responses: + '200': + description: | + Return a 200 status code to acknowledge receipt of the event. Non-200 + status codes will be retried. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookLiveTransportIncoming' realtime_call_incoming: post: responses: @@ -39471,65 +39691,6 @@ components: $ref: '#/components/schemas/ImageGenActionEnum' required: - type - ImageGenToolCall: - type: object - title: Image generation call - description: | - An image generation request made by the model. - properties: - type: - type: string - enum: - - image_generation_call - description: | - The type of the image generation call. Always `image_generation_call`. - x-stainless-const: true - id: - type: string - description: | - The unique ID of the image generation call. - status: - type: string - enum: - - in_progress - - completed - - generating - - failed - description: | - The status of the image generation call. - result: - anyOf: - - type: string - description: | - The generated image encoded in base64. - - type: 'null' - size: - anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - type: 'null' - description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. - quality: - anyOf: - - type: string - enum: - - low - - medium - - high - - xhigh - - max - - auto - - type: 'null' - description: The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. - required: - - type - - id - - status - - result ImageRefParam: type: object description: | @@ -40501,6 +40662,281 @@ components: - first_id - last_id - has_more + LiveCallAcceptRequest: + type: object + description: Accept an incoming SIP call with Live startup configuration. + properties: + session: + $ref: '#/components/schemas/LiveCallAcceptSession' + description: Model and startup configuration for the Live session that answers the incoming SIP call. + required: + - session + additionalProperties: false + LiveCallAcceptSession: + type: object + description: Startup configuration for accepting an incoming Live SIP call. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend and backend instructions. + properties: + model: + $ref: '#/components/schemas/ModelIdsLive' + description: The Live model to use for the accepted call. + minLength: 1 + instructions: + $ref: '#/components/schemas/instructions' + audio: + $ref: '#/components/schemas/LiveMediaSessionAudioParam' + description: Startup audio output configuration. SIP negotiates the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup. + delegation: + $ref: '#/components/schemas/delegation' + store: + $ref: '#/components/schemas/store' + input: + $ref: '#/components/schemas/input' + type: + type: string + enum: + - live + default: live + x-stainless-const: true + description: The session type. Always `live`. + required: + - model + - type + additionalProperties: false + LiveCallReferRequest: + type: object + description: Parameters used to transfer a Live SIP call to another destination. + properties: + target_uri: + $ref: '#/components/schemas/target_uri' + minLength: 1 + pattern: \S + description: Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or sip:agent@example.com. + required: + - target_uri + additionalProperties: false + LiveCallRejectRequest: + type: object + description: Parameters used to reject an incoming Live SIP call. + properties: + status_code: + type: integer + minimum: 300 + maximum: 699 + description: SIP rejection status sent to the caller. This field is required. + example: 486 + required: + - status_code + additionalProperties: false + LiveClientEvent: + description: Client events for Live. Initialize a primary WebSocket with session.start and wait for session.started. WebRTC creation already starts the session. Audio append is primary WebSocket-only. See the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before writing frontend instructions and delegation policies. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveSessionStartEvent' + - $ref: '#/components/schemas/LiveSessionUpdateParam' + - $ref: '#/components/schemas/LiveInputAudioAppendEvent' + - $ref: '#/components/schemas/LiveInputAudioMuteParam' + - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' + - $ref: '#/components/schemas/LiveInstructionsAppendParam' + - $ref: '#/components/schemas/LiveThinkingAppendParam' + - $ref: '#/components/schemas/LiveCommentaryAppendParam' + - $ref: '#/components/schemas/LiveResponseItemCreateParam' + - $ref: '#/components/schemas/LiveResponseCreateParam' + - $ref: '#/components/schemas/LiveSessionCloseParam' + LiveConnectParams: + type: object + x-stainless-empty-object: true + description: Primary Live WebSocket connections accept no query parameters. Supply the model and startup configuration in the first session.start event. + properties: {} + additionalProperties: false + LiveCreateRequest: + type: object + description: Create a Live WebRTC session with JSON session configuration and an SDP offer. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before choosing frontend and backend instructions. The request starts the session; do not send session.start on the data channel. + properties: + session: + $ref: '#/components/schemas/LiveMediaSessionCreateParams' + description: Startup configuration for the Live session. + transport: + $ref: '#/components/schemas/LiveWebRTCTransport' + description: WebRTC transport with the browser's SDP offer. + required: + - session + - transport + additionalProperties: false + LiveCreateResponse: + type: object + description: The created Live session identifier and WebRTC answer. Apply transport.sdp as the peer's remote answer and wait for session.started on the data channel before sending commands. + properties: + session: + type: object + description: The newly created Live session. Use its ID for session controls and sideband connections. + properties: + id: + type: string + description: Opaque session identifier. Preserve the returned value unchanged, including its prefix. + required: + - id + transport: + $ref: '#/components/schemas/LiveWebRTCTransport' + description: WebRTC transport with the SDP answer. + required: + - session + - transport + LiveForkClientEvent: + description: Client events for a Live fork WebSocket. First send session.start with an overrides object (which may be empty), then wait for session.started before sending other commands. The model and conversation are inherited from the stored session. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveForkSessionStartEvent' + - $ref: '#/components/schemas/LiveSessionUpdateParam' + - $ref: '#/components/schemas/LiveInputAudioAppendEvent' + - $ref: '#/components/schemas/LiveInputAudioMuteParam' + - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' + - $ref: '#/components/schemas/LiveInstructionsAppendParam' + - $ref: '#/components/schemas/LiveThinkingAppendParam' + - $ref: '#/components/schemas/LiveCommentaryAppendParam' + - $ref: '#/components/schemas/LiveResponseItemCreateParam' + - $ref: '#/components/schemas/LiveResponseCreateParam' + - $ref: '#/components/schemas/LiveSessionCloseParam' + LiveForkPathParams: + type: object + description: Identifies the stored Live session whose conversation and configuration are used to create a fork. + required: + - session_id + properties: + session_id: + type: string + description: The ID of the stored Live session to fork. + LiveForkRequest: + type: object + description: Fork a stored Live session onto a new WebRTC connection. Omit session or send an empty object to inherit its configuration. + properties: + session: + $ref: '#/components/schemas/LiveMediaSessionForkParams' + description: Optional configuration overrides for the new Live session. Omit this object or send an empty object to inherit the stored session's settings. + transport: + $ref: '#/components/schemas/LiveWebRTCTransport' + description: WebRTC transport with an SDP offer for the new connection to the forked session. + required: + - transport + additionalProperties: false + LiveForkServerEvent: + $ref: '#/components/schemas/LiveServerEvent' + LiveMediaSessionAudioParam: + type: object + description: Startup audio output configuration. WebRTC and SIP negotiate the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup. + properties: + output: + $ref: '#/components/schemas/LiveInitialSessionAudioOutputParam' + additionalProperties: false + LiveMediaSessionCreateParams: + type: object + description: Startup configuration for a Live media session. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend instructions and the backend prompt under delegation.responses.instructions. + properties: + model: + $ref: '#/components/schemas/ModelIdsLive' + instructions: + $ref: '#/components/schemas/instructions' + audio: + $ref: '#/components/schemas/LiveMediaSessionAudioParam' + description: Startup audio configuration. WebRTC and SIP negotiate their audio format on the media transport. + delegation: + $ref: '#/components/schemas/delegation' + store: + $ref: '#/components/schemas/store' + input: + $ref: '#/components/schemas/input' + client: + $ref: '#/components/schemas/LiveClientConfigParam' + required: + - model + additionalProperties: false + LiveMediaSessionForkParams: + type: object + description: Optional overrides for a stored Live session. Omitted settings are inherited. The model, voice, frontend instructions, and prior conversation come from the stored session. WebRTC negotiates its audio format; audio.format is only supported on WebSocket forks. + properties: + store: + $ref: '#/components/schemas/properties-store' + delegation: + $ref: '#/components/schemas/LiveResponsesDelegationUpdateParam' + client: + $ref: '#/components/schemas/LiveClientConfigParam' + additionalProperties: false + LiveServerEvent: + description: Server events for Live. Response lifecycle events are wrapped inside response.event; dispatch the nested event by its full type and tolerate new response event types. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when designing the conversation and delegation policy. + discriminator: + propertyName: type + allOf: + - $ref: '#/components/schemas/LiveServerEvent-2' + LiveSidebandClientEvent: + description: Client events accepted by an attached Live sideband WebSocket. The session is already started; send audio over the primary connection. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveSessionUpdateParam' + - $ref: '#/components/schemas/LiveInputAudioMuteParam' + - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' + - $ref: '#/components/schemas/LiveInstructionsAppendParam' + - $ref: '#/components/schemas/LiveThinkingAppendParam' + - $ref: '#/components/schemas/LiveCommentaryAppendParam' + - $ref: '#/components/schemas/LiveResponseItemCreateParam' + - $ref: '#/components/schemas/LiveResponseCreateParam' + - $ref: '#/components/schemas/LiveSessionCloseParam' + LiveSidebandConnectParams: + type: object + description: Connection options for a sideband WebSocket attached to an existing Live session. + properties: + graceful_close: + type: boolean + description: Opt in to the graceful WebSocket closing handshake when the session ends. The server may also enable this behavior by default. + additionalProperties: false + LiveSidebandPathParams: + type: object + description: Identifies the Live session to observe and control through a sideband WebSocket. + required: + - session_id + properties: + session_id: + type: string + description: The ID of the existing Live session to attach to. + LiveSidebandServerEvent: + description: Server events received by an attached Live sideband WebSocket. Audio deltas are delivered over the primary connection. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveSessionStarted' + - $ref: '#/components/schemas/LiveSessionUpdated' + - $ref: '#/components/schemas/LiveInputAudioMuted' + - $ref: '#/components/schemas/LiveInputAudioUnmuted' + - $ref: '#/components/schemas/LiveInstructionsAppended' + - $ref: '#/components/schemas/LiveThinkingAppended' + - $ref: '#/components/schemas/LiveCommentaryAppended' + - $ref: '#/components/schemas/LiveInputTranscriptDelta' + - $ref: '#/components/schemas/LiveOutputTranscriptDelta' + - $ref: '#/components/schemas/LiveDelegationCreated' + - $ref: '#/components/schemas/LiveResponseEvent' + - $ref: '#/components/schemas/LiveSessionUsageUpdated' + - $ref: '#/components/schemas/LiveSessionClosed' + - $ref: '#/components/schemas/LiveErrorEvent' + - $ref: '#/components/schemas/LiveInfoEvent' + LiveWebRTCTransport: + type: object + description: WebRTC transport carrying the offer SDP in a creation request or answer SDP in its response. + properties: + type: + type: string + description: The transport used for the Live session. Always `webrtc`. + enum: + - webrtc + x-stainless-const: true + sdp: + type: string + minLength: 1 + description: Session Description Protocol message for the WebRTC connection. + required: + - type + - sdp + additionalProperties: false LocalShellToolCall: type: object title: Local shell call @@ -41692,6 +42128,15 @@ components: - type: string - type: 'null' description: Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models. + ModelIdsLive: + description: The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter. + example: gpt-live-1 + anyOf: + - type: string + minLength: 1 + - type: string + enum: + - gpt-live-1 ModelIdsResponses: example: gpt-6-astra anyOf: @@ -61817,7 +62262,10 @@ components: WebhookLiveCallIncoming: type: object title: live.call.incoming + deprecated: true description: | + Deprecated: use `live.transport.incoming`. Retained for existing subscriptions + during migration; new subscriptions to this event are not allowed. Sent when an incoming API SIP session is available for Live acceptance. The same pending session can also emit `realtime.call.incoming`; the first successful Realtime or Live accept endpoint selects the runtime surface. @@ -61847,8 +62295,9 @@ components: session_id: type: string description: | - The `live_...` ID of the pending SIP session. Forward this value - unchanged when accepting or rejecting the call through the Live API. + The `live_...` ID of the pending SIP session. Pass this value unchanged + to Live call controls and sideband connections. The corresponding + `realtime.call.incoming` event uses a separate `rtc_...` call ID. sip_headers: type: array description: | @@ -61902,12 +62351,108 @@ components: ] } } + WebhookLiveTransportIncoming: + type: object + title: live.transport.incoming + description: | + Sent when an incoming API SIP session is available for Live acceptance. The + same pending session can also emit `realtime.call.incoming`; the first + successful Realtime or Live accept endpoint selects the runtime surface. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the event was created. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - type + - session_id + - sip_headers + properties: + type: + type: string + description: The incoming transport type. Always `sip`. + enum: + - sip + x-stainless-const: true + session_id: + type: string + description: | + The `live_...` ID of the pending SIP session. Forward this value + unchanged when accepting or rejecting the call through the Live API. + sip_headers: + type: array + description: | + Headers from the SIP INVITE, excluding SIP authorization headers. + Retained names, values, repeated entries, and order are preserved. + Treat these values as untrusted call metadata. + items: + type: object + description: | + A header from the SIP Invite. + required: + - name + - value + properties: + name: + type: string + description: | + Name of the SIP Header. + value: + type: string + description: | + Value of the SIP Header. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `live.transport.incoming`. + enum: + - live.transport.incoming + x-stainless-const: true + x-oaiMeta: + name: live.transport.incoming + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "live.transport.incoming", + "created_at": 1719168000, + "data": { + "type": "sip", + "session_id": "live_u0_479a275623b54bdb9b6fbae2f7cbd408", + "sip_headers": [ + {"name": "From", "value": ";tag=abc123"}, + {"name": "To", "value": ""}, + {"name": "Call-ID", "value": "call-123@example.com"} + ] + } + } WebhookRealtimeCallIncoming: type: object title: realtime.call.incoming description: | Sent when an incoming API SIP session is available for Realtime acceptance. - The same pending session can also emit `live.call.incoming`; the first + The same pending session can also emit `live.transport.incoming`; the first successful Realtime or Live accept endpoint selects the runtime surface. required: - created_at @@ -61936,7 +62481,7 @@ components: type: string description: | The Transceiver `rtc_...` ID of the pending SIP session. The paired - `live.call.incoming` event derives its `session_id` by replacing the + `live.transport.incoming` event derives its `session_id` by replacing the `rtc_` prefix with `live_`. Use the ID returned by the event with the corresponding Realtime or Live API. sip_headers: @@ -63143,6 +63688,102 @@ components: - completed - failed - incomplete + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + ImageBackground: + type: string + enum: + - transparent + - opaque + - auto + ImageOutputFormat: + type: string + enum: + - png + - webp + - jpeg + ImageGenToolCall: + properties: + type: + type: string + enum: + - image_generation_call + description: The type of the image generation call. Always `image_generation_call`. + x-stainless-const: true + id: + type: string + description: The unique ID of the image generation call. + status: + type: string + enum: + - in_progress + - completed + - generating + - failed + description: The status of the image generation call. + result: + anyOf: + - type: string + description: The generated image encoded in base64. + - type: 'null' + size: + anyOf: + - anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. + - type: 'null' + quality: + anyOf: + - type: string + enum: + - low + - medium + - high + - xhigh + - max + - auto + description: The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. + - type: 'null' + action: + anyOf: + - $ref: '#/components/schemas/ImageGenActionEnum' + description: The action used for image generation. + - type: 'null' + x-openai-go-optional-enum: true + background: + anyOf: + - $ref: '#/components/schemas/ImageBackground' + description: The background setting used for generation. + - type: 'null' + x-openai-go-optional-enum: true + output_format: + anyOf: + - $ref: '#/components/schemas/ImageOutputFormat' + description: The output format used for generation. + - type: 'null' + x-openai-go-optional-enum: true + revised_prompt: + anyOf: + - type: string + description: The prompt that was used after any model prompt rewriting. + - type: 'null' + type: object + required: + - type + - id + - status + - result + title: Image generation call + description: An image generation request made by the model. ClickButtonType: type: string enum: @@ -63672,12 +64313,6 @@ components: - high - low description: Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`. - ImageGenActionEnum: - type: string - enum: - - generate - - edit - - auto LocalShellToolParam: properties: type: @@ -65789,255 +66424,856 @@ components: - input_tokens_details title: Image generation usage description: For `gpt-image-1` only, the token usage information for the image generation. - PublicProjectResidency: - type: string - enum: - - GLOBAL - - US_STORAGE_PROCESSING - - EU_STORAGE_PROCESSING - - JP_STORAGE - - KR_STORAGE - - CA_STORAGE - - SG_STORAGE - - IN_STORAGE - - AU_STORAGE - - GB_STORAGE - - AE_STORAGE - - AE_STORAGE_PROCESSING - SpecificProgrammaticToolCallingParam: + instructions: + anyOf: + - description: Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup. + type: string + - type: 'null' + LiveCustomVoiceParam: + type: object properties: - type: + id: type: string - enum: - - programmatic_tool_calling - description: The tool to call. Always `programmatic_tool_calling`. - default: programmatic_tool_calling - x-stainless-const: true - type: object + minLength: 1 + maxLength: 128 required: - - type - SpecificApplyPatchParam: + - id + LiveInitialSessionAudioOutputParam: + description: Settings for speech generated by the Live model. Choose the voice before starting the session. + type: object properties: - type: - type: string - enum: - - apply_patch - description: The tool to call. Always `apply_patch`. - default: apply_patch - x-stainless-const: true + voice: + description: The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup. + anyOf: + - anyOf: + - type: string + - $ref: '#/components/schemas/LiveBuiltInVoice' + - $ref: '#/components/schemas/LiveCustomVoiceParam' + required: [] + LiveClientDelegationParam: + description: Delegate tasks to your application. The Live session emits delegation events that your backend handles. type: object - required: - - type - title: Specific apply patch tool choice - description: Forces the model to call the apply_patch tool when executing a tool call. - SpecificFunctionShellParam: properties: type: + description: The delegation owner. Always `client` for tasks handled by your application. + default: client + x-stainless-const: true type: string enum: - - shell - description: The tool to call. Always `shell`. - default: shell - x-stainless-const: true - type: object + - client required: - type - title: Specific shell tool choice - description: Forces the model to call the shell tool when a tool call is required. - ResponsePromptCacheOptionsParam: + LiveResponsesServiceTier: + type: string + enum: + - auto + - default + - fast_tier_temp_pilot + - flex + - priority + - ultrafast + LiveReasoningEffort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + LiveReasoningSummary: + type: string + enum: + - concise + - detailed + - auto + LiveDelegationReasoningInputParam: + description: Reasoning options for Responses requests made on behalf of the Live session. + type: object properties: - ttl: - $ref: '#/components/schemas/PromptCacheTTLEnum' - description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. - mode: - $ref: '#/components/schemas/PromptCacheModeEnum' - description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. - comparison_response_id: + effort: anyOf: - - type: string - description: The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled. - example: resp_123 + - description: How much reasoning effort the delegated Responses model should use. Supported values depend on the backend model. + $ref: '#/components/schemas/LiveReasoningEffort' + - type: 'null' + summary: + anyOf: + - description: The reasoning summary to request from the delegated Responses model, when supported. + $ref: '#/components/schemas/LiveReasoningSummary' - type: 'null' - type: object required: [] - title: Prompt cache options - description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. - ReasoningModeEnum: - anyOf: - - type: string - - type: string - enum: - - standard - - pro - ConversationParam-2: + LiveTextVerbosity: + type: string + enum: + - low + - medium + - high + LiveDelegationTextInputParam: + description: Text generation options for the Live session’s Responses backend. + type: object properties: - id: - type: string - description: The unique ID of the conversation. - example: conv_123 + verbosity: + anyOf: + - description: The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery. + $ref: '#/components/schemas/LiveTextVerbosity' + - type: 'null' + required: [] + LiveFunctionToolInputParam: + description: A function tool available to the Responses backend when the Live model delegates a task. type: object - required: - - id - title: Conversation object - description: The conversation that this response belongs to. - ContextManagementParam: properties: type: + description: The tool type. Always `function`. + default: function + x-stainless-const: true type: string - description: The context management entry type. Currently only 'compaction' is supported. - compact_threshold: + enum: + - function + name: + description: The name the delegated Responses model uses when calling this function. + type: string + description: anyOf: - - type: integer - minimum: 1000 - description: Token threshold at which compaction should be triggered for this entry. + - description: What the function does and when the delegated Responses model should call it. + type: string - type: 'null' - type: object - required: - - type - PromptCacheOptions: - properties: - ttl: - $ref: '#/components/schemas/PromptCacheTTLEnum' - description: The minimum lifetime applied to each cache breakpoint. - mode: - $ref: '#/components/schemas/PromptCacheModeEnum' - description: Whether implicit prompt-cache breakpoints were enabled. - comparison_response_id: + parameters: anyOf: - - type: string - description: The response ID supplied as the prompt cache diagnostics comparison. + - description: A JSON Schema object describing the arguments accepted by the function. + type: object + additionalProperties: {} + - type: 'null' + strict: + anyOf: + - description: Whether the delegated Responses model must follow the function’s parameter schema exactly. + type: boolean - type: 'null' - type: object required: - - ttl - - mode - title: Prompt cache options - description: The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models. - CacheMissReasonTypeEnum: - type: string - enum: - - model_changed - - prompt_cache_key_changed - - tools_changed - - text_format_changed - - reasoning_effort_changed - - verbosity_changed - - context_compacted - - input_changed - - service_tier_changed - PromptCacheMissDiagnosticsBody: + - type + - name + LiveWebSearchToolInputParam: + description: A web search tool available to the Live session’s Responses backend. + type: object properties: type: + description: The tool type. Always `web_search`. + default: web_search + x-stainless-const: true type: string enum: - - cache_miss - default: cache_miss - x-stainless-const: true - reason: - $ref: '#/components/schemas/CacheMissReasonTypeEnum' - description: The reason prompt cache reuse did not occur. - cache_missed_tokens: - type: integer - description: The estimated number of input tokens affected after the first detected divergence. - comparison_reusable_tokens: - type: integer - description: The raw token count of the reusable prefix in the compared response. - type: object + - web_search required: - type - - reason - - cache_missed_tokens - PromptCacheHitDiagnosticsBody: + LiveToolChoiceEnum: + type: string + enum: + - auto + - none + - required + LiveFunctionToolChoiceParam: + type: object properties: type: + default: function + x-stainless-const: true type: string enum: - - cache_hit - default: cache_hit - x-stainless-const: true - type: object + - function + name: + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ required: - type - PromptCacheComparisonResponseNotFoundDiagnosticsBody: + - name + LiveMCPToolChoiceParam: + type: object properties: type: + default: mcp + x-stainless-const: true type: string enum: - - comparison_response_not_found - default: comparison_response_not_found - x-stainless-const: true - type: object + - mcp + server_label: + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + name: + type: string + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ required: - type - PromptCacheUnavailableDiagnosticsBody: + - server_label + - name + LiveResponsesDelegationSettingsInputParam: + description: Model, prompt, and tool settings for tasks delegated by the Live session to a Responses backend. + type: object + properties: + model: + description: The model used for server-owned Responses delegations. + type: string + instructions: + anyOf: + - description: Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + type: string + - type: 'null' + max_output_tokens: + anyOf: + - description: Maximum number of output tokens for each delegated response. + type: integer + minimum: 16 + - type: 'null' + service_tier: + anyOf: + - description: Service tier for delegated Responses requests. + $ref: '#/components/schemas/LiveResponsesServiceTier' + - type: 'null' + reasoning: + anyOf: + - description: Reasoning settings passed to each delegated Responses request. + $ref: '#/components/schemas/LiveDelegationReasoningInputParam' + - type: 'null' + text: + anyOf: + - description: Text generation settings passed to each delegated Responses request. + $ref: '#/components/schemas/LiveDelegationTextInputParam' + - type: 'null' + tools: + description: Tools available to the Responses backend while it handles tasks delegated by the Live model. + type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveFunctionToolInputParam' + - $ref: '#/components/schemas/LiveWebSearchToolInputParam' + tool_choice: + description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. + anyOf: + - $ref: '#/components/schemas/LiveToolChoiceEnum' + - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' + - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + parallel_tool_calls: + anyOf: + - description: Whether the delegated Responses model may request multiple tool calls in a single response. + type: boolean + - type: 'null' + required: + - model + LiveResponsesDelegationParam: + description: Delegate tasks to a Responses model managed by the Live session. + type: object properties: type: + description: The delegation owner. Always `responses` for tasks handled by the Responses API. + default: responses + x-stainless-const: true type: string enum: - - unavailable - default: unavailable - x-stainless-const: true - type: object + - responses + responses: + description: Backend model, prompt, and tools used when the Live session delegates a task to Responses. + $ref: '#/components/schemas/LiveResponsesDelegationSettingsInputParam' required: - type - PromptCacheDiagnostics: - discriminator: - propertyName: type - description: Prompt cache diagnostics requested for this response. + - responses + delegation: anyOf: - - $ref: '#/components/schemas/PromptCacheMissDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheHitDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheComparisonResponseNotFoundDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheUnavailableDiagnosticsBody' - ModerationErrorBody: + - description: Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` to let the API manage a Responses backend. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveClientDelegationParam' + - $ref: '#/components/schemas/LiveResponsesDelegationParam' + - type: 'null' + store: + description: Whether to store the session for later forking and recording download. Defaults to false for new sessions. + type: boolean + LiveInitialMessageStatus: + type: string + enum: + - incomplete + - completed + LiveInitialInputTextContentPartParam: + description: Text supplied in a developer or user message when starting a Live session. + type: object properties: type: - type: string - enum: - - error - description: The object type, which was always `error` for moderation failures. - default: error + description: The text content type. Always `input_text`. + default: input_text x-stainless-const: true - code: type: string - description: The error code. - message: + enum: + - input_text + text: + description: The message text to include in the Live session’s initial conversation history. type: string - description: The error message. - type: object required: - - type - - code - - message - title: Moderation error - description: An error produced while attempting moderation for the response input or output. - Moderation: - properties: - input: - discriminator: - propertyName: type - description: Moderation for the response input. - anyOf: - - $ref: '#/components/schemas/ModerationResultBody' - - $ref: '#/components/schemas/ModerationErrorBody' - output: - discriminator: - propertyName: type - description: Moderation for the response output. - anyOf: - - $ref: '#/components/schemas/ModerationResultBody' - - $ref: '#/components/schemas/ModerationErrorBody' + - text + LiveInitialDeveloperMessageItemParam: + description: A developer message included in the initial text history of a Live session. type: object - required: - - input - - output - title: Moderation - description: Moderation results or errors for the response input and output. - ResponseConversation: properties: id: + anyOf: + - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. + type: string + - type: 'null' + type: + description: The history item type. Always `message`. + default: message + x-stainless-const: true type: string - description: The unique ID of the conversation that this response was associated with. + enum: + - message + status: + anyOf: + - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. + $ref: '#/components/schemas/LiveInitialMessageStatus' + - type: 'null' + role: + description: The author of this history message. Always `developer`. + default: developer + x-stainless-const: true + type: string + enum: + - developer + content: + description: The message content. Supply exactly one text part for the initial Live conversation history. + type: array + items: + $ref: '#/components/schemas/LiveInitialInputTextContentPartParam' + minItems: 1 + maxItems: 1 + required: + - role + - content + LiveInitialUserMessageItemParam: + description: A user message included in the initial text history of a Live session. + type: object + properties: + id: + anyOf: + - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. + type: string + - type: 'null' + type: + description: The history item type. Always `message`. + default: message + x-stainless-const: true + type: string + enum: + - message + status: + anyOf: + - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. + $ref: '#/components/schemas/LiveInitialMessageStatus' + - type: 'null' + role: + description: The author of this history message. Always `user`. + default: user + x-stainless-const: true + type: string + enum: + - user + content: + description: The message content. Supply exactly one text part for the initial Live conversation history. + type: array + items: + $ref: '#/components/schemas/LiveInitialInputTextContentPartParam' + minItems: 1 + maxItems: 1 + required: + - role + - content + LiveInitialTextContentPartParam: + description: Assistant text supplied as conversation history when starting a Live session. + type: object + properties: + type: + description: The text content type. Always `text`. + default: text + x-stainless-const: true + type: string + enum: + - text + text: + description: The message text to include in the Live session’s initial conversation history. + type: string + required: + - text + LiveInitialOutputTextContentPartParam: + description: Assistant output text supplied as conversation history when starting a Live session. + type: object + properties: + type: + description: The text content type. Always `output_text`. + default: output_text + x-stainless-const: true + type: string + enum: + - output_text + text: + description: The message text to include in the Live session’s initial conversation history. + type: string + required: + - type + - text + LiveInitialAssistantMessageItemParam: + description: An assistant message included in the initial text history of a Live session. + type: object + properties: + id: + anyOf: + - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. + type: string + - type: 'null' + type: + description: The history item type. Always `message`. + default: message + x-stainless-const: true + type: string + enum: + - message + status: + anyOf: + - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. + $ref: '#/components/schemas/LiveInitialMessageStatus' + - type: 'null' + role: + description: The author of this history message. Always `assistant`. + default: assistant + x-stainless-const: true + type: string + enum: + - assistant + content: + description: The message content. Supply exactly one text part for the initial Live conversation history. + type: array + items: + discriminator: + propertyName: type + x-oai-default-discriminator-value: text + anyOf: + - $ref: '#/components/schemas/LiveInitialTextContentPartParam' + - $ref: '#/components/schemas/LiveInitialOutputTextContentPartParam' + minItems: 1 + maxItems: 1 + required: + - role + - content + LiveInitialItem: + description: A developer, user, or assistant message supplied as text history before the Live session starts. + discriminator: + propertyName: role + anyOf: + - $ref: '#/components/schemas/LiveInitialDeveloperMessageItemParam' + - $ref: '#/components/schemas/LiveInitialUserMessageItemParam' + - $ref: '#/components/schemas/LiveInitialAssistantMessageItemParam' + input: + description: Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total. + type: array + items: + $ref: '#/components/schemas/LiveInitialItem' + maxItems: 128 + LiveAllowedServerEventParam: + description: A Live server event selector for the WebRTC frontend data channel. + example: + type: session.started + type: object + properties: + type: + description: The outer Live server event type. Use 'response.event' for Responses events. + type: string + minLength: 1 + maxLength: 256 + response_event: + description: The nested Responses event type. Required when type is 'response.event'; forbidden for other event types. + type: string + minLength: 1 + maxLength: 256 + required: + - type + additionalProperties: false + x-oaiMeta: + example: + type: session.started + LiveDataChannelConfigParam: + description: Control which Live events an untrusted WebRTC frontend can send and receive over its data channel. These restrictions do not apply to trusted sideband connections. + type: object + properties: + allowed_client_events: + description: Client event types that the frontend data channel may send. Use 'all' to allow every client event; an empty array allows none. Omission preserves the existing allow-all behavior. + anyOf: + - default: all + x-stainless-const: true + type: string + enum: + - all + - type: array + items: + description: A Live client event type allowed on the frontend data channel, such as `session.input_audio.mute`. + type: string + minLength: 1 + maxLength: 256 + pattern: ^(?:error|info|[a-z][a-z0-9_-]*(?:\.[a-z0-9_-]+)+)$ + maxItems: 256 + allowed_server_events: + description: Server events that may be sent to the frontend data channel. Use 'all' to allow every server event; an empty array allows none. Omission preserves the existing allow-all behavior. Responses events use an object with type 'response.event' and a response_event selector. + anyOf: + - default: all + x-stainless-const: true + type: string + enum: + - all + - type: array + items: + $ref: '#/components/schemas/LiveAllowedServerEventParam' + maxItems: 256 + x-stainless-variantName: event_selectors + required: [] + LiveClientConfigParam: + description: Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected. + type: object + properties: + data_channel: + description: Client and server event permissions for the WebRTC frontend data channel. + $ref: '#/components/schemas/LiveDataChannelConfigParam' + required: + - data_channel + properties-store: + description: Whether to store the forked session. Omission inherits the stored session's setting. + type: boolean + LiveResponsesDelegationSettingsUpdateInputParam: + description: Updates to the Responses backend of an existing Live session. Omitted settings retain their current values. + type: object + properties: + model: + description: The Responses backend model to use for subsequent delegated requests. Omit to keep the current backend model. + type: string + instructions: + anyOf: + - description: Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + type: string + - type: 'null' + max_output_tokens: + anyOf: + - description: Maximum number of output tokens for each delegated response. + type: integer + minimum: 16 + - type: 'null' + service_tier: + anyOf: + - description: Service tier for delegated Responses requests. + $ref: '#/components/schemas/LiveResponsesServiceTier' + - type: 'null' + reasoning: + anyOf: + - description: Reasoning settings passed to each delegated Responses request. + $ref: '#/components/schemas/LiveDelegationReasoningInputParam' + - type: 'null' + text: + anyOf: + - description: Text generation settings passed to each delegated Responses request. + $ref: '#/components/schemas/LiveDelegationTextInputParam' + - type: 'null' + tools: + description: Tools available to the Responses backend while it handles tasks delegated by the Live model. + type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveFunctionToolInputParam' + - $ref: '#/components/schemas/LiveWebSearchToolInputParam' + tool_choice: + description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. + anyOf: + - $ref: '#/components/schemas/LiveToolChoiceEnum' + - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' + - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + parallel_tool_calls: + anyOf: + - description: Whether the delegated Responses model may request multiple tool calls in a single response. + type: boolean + - type: 'null' + required: [] + LiveResponsesDelegationUpdateParam: + description: Update the Responses backend for an existing Live session without changing delegation ownership. + type: object + properties: + type: + description: The delegation owner. Always `responses` for tasks handled by the Responses API. + default: responses + x-stainless-const: true + type: string + enum: + - responses + responses: + description: Responses backend settings to update. Omitted settings keep their existing values. + $ref: '#/components/schemas/LiveResponsesDelegationSettingsUpdateInputParam' + required: + - type + target_uri: + type: string + description: |- + URI that should appear in the SIP Refer-To header. Supports values like + `tel:+14155550123` or `sip:agent@example.com`. + example: tel:+14155550123 + PublicProjectResidency: + type: string + enum: + - GLOBAL + - US_STORAGE_PROCESSING + - EU_STORAGE_PROCESSING + - JP_STORAGE + - KR_STORAGE + - CA_STORAGE + - SG_STORAGE + - IN_STORAGE + - AU_STORAGE + - GB_STORAGE + - AE_STORAGE + - AE_STORAGE_PROCESSING + SpecificProgrammaticToolCallingParam: + properties: + type: + type: string + enum: + - programmatic_tool_calling + description: The tool to call. Always `programmatic_tool_calling`. + default: programmatic_tool_calling + x-stainless-const: true + type: object + required: + - type + SpecificApplyPatchParam: + properties: + type: + type: string + enum: + - apply_patch + description: The tool to call. Always `apply_patch`. + default: apply_patch + x-stainless-const: true + type: object + required: + - type + title: Specific apply patch tool choice + description: Forces the model to call the apply_patch tool when executing a tool call. + SpecificFunctionShellParam: + properties: + type: + type: string + enum: + - shell + description: The tool to call. Always `shell`. + default: shell + x-stainless-const: true + type: object + required: + - type + title: Specific shell tool choice + description: Forces the model to call the shell tool when a tool call is required. + ResponsePromptCacheOptionsParam: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. + comparison_response_id: + anyOf: + - type: string + description: The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled. + example: resp_123 + - type: 'null' + type: object + required: [] + title: Prompt cache options + description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. + ReasoningModeEnum: + anyOf: + - type: string + - type: string + enum: + - standard + - pro + ConversationParam-2: + properties: + id: + type: string + description: The unique ID of the conversation. + example: conv_123 + type: object + required: + - id + title: Conversation object + description: The conversation that this response belongs to. + ContextManagementParam: + properties: + type: + type: string + description: The context management entry type. Currently only 'compaction' is supported. + compact_threshold: + anyOf: + - type: integer + minimum: 1000 + description: Token threshold at which compaction should be triggered for this entry. + - type: 'null' + type: object + required: + - type + PromptCacheOptions: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: The minimum lifetime applied to each cache breakpoint. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: Whether implicit prompt-cache breakpoints were enabled. + comparison_response_id: + anyOf: + - type: string + description: The response ID supplied as the prompt cache diagnostics comparison. + - type: 'null' + type: object + required: + - ttl + - mode + title: Prompt cache options + description: The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models. + CacheMissReasonTypeEnum: + type: string + enum: + - model_changed + - prompt_cache_key_changed + - tools_changed + - text_format_changed + - reasoning_effort_changed + - verbosity_changed + - context_compacted + - input_changed + - service_tier_changed + PromptCacheMissDiagnosticsBody: + properties: + type: + type: string + enum: + - cache_miss + default: cache_miss + x-stainless-const: true + reason: + $ref: '#/components/schemas/CacheMissReasonTypeEnum' + description: The reason prompt cache reuse did not occur. + cache_missed_tokens: + type: integer + description: The estimated number of input tokens affected after the first detected divergence. + comparison_reusable_tokens: + type: integer + description: The raw token count of the reusable prefix in the compared response. + type: object + required: + - type + - reason + - cache_missed_tokens + PromptCacheHitDiagnosticsBody: + properties: + type: + type: string + enum: + - cache_hit + default: cache_hit + x-stainless-const: true + type: object + required: + - type + PromptCacheComparisonResponseNotFoundDiagnosticsBody: + properties: + type: + type: string + enum: + - comparison_response_not_found + default: comparison_response_not_found + x-stainless-const: true + type: object + required: + - type + PromptCacheUnavailableDiagnosticsBody: + properties: + type: + type: string + enum: + - unavailable + default: unavailable + x-stainless-const: true + type: object + required: + - type + PromptCacheDiagnostics: + discriminator: + propertyName: type + description: Prompt cache diagnostics requested for this response. + anyOf: + - $ref: '#/components/schemas/PromptCacheMissDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheHitDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheComparisonResponseNotFoundDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheUnavailableDiagnosticsBody' + ModerationErrorBody: + properties: + type: + type: string + enum: + - error + description: The object type, which was always `error` for moderation failures. + default: error + x-stainless-const: true + code: + type: string + description: The error code. + message: + type: string + description: The error message. + type: object + required: + - type + - code + - message + title: Moderation error + description: An error produced while attempting moderation for the response input or output. + Moderation: + properties: + input: + discriminator: + propertyName: type + description: Moderation for the response input. + anyOf: + - $ref: '#/components/schemas/ModerationResultBody' + - $ref: '#/components/schemas/ModerationErrorBody' + output: + discriminator: + propertyName: type + description: Moderation for the response output. + anyOf: + - $ref: '#/components/schemas/ModerationResultBody' + - $ref: '#/components/schemas/ModerationErrorBody' + type: object + required: + - input + - output + title: Moderation + description: Moderation results or errors for the response input and output. + ResponseConversation: + properties: + id: + type: string + description: The unique ID of the conversation that this response was associated with. type: object required: - id @@ -68560,6 +69796,1706 @@ components: - y title: Coordinate description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.' + LiveSessionAudioFormatPCMParam: + description: Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection. + type: object + properties: + type: + description: The audio encoding. Always `audio/pcm`. + default: audio/pcm + x-stainless-const: true + type: string + enum: + - audio/pcm + rate: + description: Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz. + type: integer + minimum: 16000 + maximum: 24000 + enum: + - 16000 + - 24000 + required: + - type + - rate + LiveSessionAudioFormatPCMUParam: + description: Raw, mono G.711 μ-law audio for a Live WebSocket connection. + type: object + properties: + type: + description: The audio encoding. Always `audio/pcmu`. + default: audio/pcmu + x-stainless-const: true + type: string + enum: + - audio/pcmu + rate: + description: Audio sample rate in hertz. G.711 audio uses 8000 Hz. + type: integer + minimum: 8000 + maximum: 8000 + required: + - type + - rate + LiveSessionAudioFormatPCMAParam: + description: Raw, mono G.711 A-law audio for a Live WebSocket connection. + type: object + properties: + type: + description: The audio encoding. Always `audio/pcma`. + default: audio/pcma + x-stainless-const: true + type: string + enum: + - audio/pcma + rate: + description: Audio sample rate in hertz. G.711 audio uses 8000 Hz. + type: integer + minimum: 8000 + maximum: 8000 + required: + - type + - rate + LiveAudioFormat: + description: Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveSessionAudioFormatPCMParam' + - $ref: '#/components/schemas/LiveSessionAudioFormatPCMUParam' + - $ref: '#/components/schemas/LiveSessionAudioFormatPCMAParam' + LiveInitialSessionAudioParam: + description: Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup. + type: object + properties: + format: + description: Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately. + $ref: '#/components/schemas/LiveAudioFormat' + output: + description: The voice used for speech generated by the Live model. + $ref: '#/components/schemas/LiveInitialSessionAudioOutputParam' + required: [] + LiveSessionCreateParams: + description: Initial configuration for a Live session, including its model, conversation instructions, audio, and delegated task handling. + type: object + properties: + model: + $ref: '#/components/schemas/ModelIdsLive' + instructions: + anyOf: + - description: Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup. + type: string + - type: 'null' + input: + description: Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total. + type: array + items: + $ref: '#/components/schemas/LiveInitialItem' + maxItems: 128 + audio: + description: Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup. + $ref: '#/components/schemas/LiveInitialSessionAudioParam' + delegation: + anyOf: + - description: Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` to let the API manage a Responses backend. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveClientDelegationParam' + - $ref: '#/components/schemas/LiveResponsesDelegationParam' + - type: 'null' + store: + description: Whether to store the session for later forking and recording download. Defaults to false for new sessions. + type: boolean + client: + description: Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected. + $ref: '#/components/schemas/LiveClientConfigParam' + required: + - model + LiveSessionStartEvent: + description: Start a Live session on a primary WebSocket. Send this event before other commands and wait for `session.started`. + example: + type: session.start + event_id: evt_start_001 + session: + model: gpt-live-1 + instructions: Help the caller plan a restaurant reservation. Confirm details before booking. + audio: + format: + type: audio/pcm + rate: 24000 + output: + voice: marin + delegation: + type: client + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.start`. + default: session.start + x-stainless-const: true + type: string + enum: + - session.start + session: + description: Initial configuration for a primary WebSocket. Send session.start first and wait for session.started before application commands. WebRTC creation already starts the session; do not send this event again on its data channel. + $ref: '#/components/schemas/LiveSessionCreateParams' + required: + - type + - session + x-oaiMeta: + example: + type: session.start + event_id: evt_start_001 + session: + model: gpt-live-1 + instructions: Help the caller plan a restaurant reservation. Confirm details before booking. + audio: + format: + type: audio/pcm + rate: 24000 + output: + voice: marin + delegation: + type: client + LiveSessionUpdateParams: + description: Changes to an active Live session. Only delegation backend settings can be updated after startup. + type: object + properties: + delegation: + anyOf: + - description: Delegation settings to update. The delegation type must match the current session; omitted settings retain their values. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveClientDelegationParam' + - $ref: '#/components/schemas/LiveResponsesDelegationUpdateParam' + - type: 'null' + required: [] + LiveSessionUpdateParam: + description: Update the delegation settings of an active Live session. The server acknowledges accepted changes with `session.updated`. + example: + type: session.update + event_id: evt_update_001 + session: + delegation: + type: responses + responses: + instructions: Check restaurant availability. Ask before confirming a booking. + max_output_tokens: 1024 + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.update`. + default: session.update + x-stainless-const: true + type: string + enum: + - session.update + session: + description: Sparse delegation updates. Omitted settings retain their values. The delegation type cannot change, including resetting Responses delegation to null or client. Model, frontend instructions, audio, and startup input are immutable. + $ref: '#/components/schemas/LiveSessionUpdateParams' + required: + - type + - session + x-oaiMeta: + example: + type: session.update + event_id: evt_update_001 + session: + delegation: + type: responses + responses: + instructions: Check restaurant availability. Ask before confirming a booking. + max_output_tokens: 1024 + LiveInputAudioAppendEvent: + description: Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions send audio over their media transport. + example: + type: session.input_audio.append + audio: AACAAIAAAIAAAP9/AIAAgA== + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.input_audio.append`. + default: session.input_audio.append + x-stainless-const: true + type: string + enum: + - session.input_audio.append + audio: + description: Base64-encoded raw audio in the startup-selected format, without a WAV or other container header. Primary WebSocket only; media transports use their audio track. Audio appends have no acknowledgment. Reflected sideband server events reuse this event type and audio key, with no timestamps or event_id; their audio is always mono PCM16LE at 24 kHz. + type: string + minLength: 1 + required: + - type + - audio + x-oaiMeta: + example: + type: session.input_audio.append + audio: AACAAIAAAIAAAP9/AIAAgA== + LiveInputAudioMuteParam: + description: Mute audio input to the Live model without closing the session. The server acknowledges with `session.input_audio.muted`. + example: + type: session.input_audio.mute + event_id: evt_mute_001 + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.input_audio.mute`. + default: session.input_audio.mute + x-stainless-const: true + type: string + enum: + - session.input_audio.mute + required: + - type + x-oaiMeta: + example: + type: session.input_audio.mute + event_id: evt_mute_001 + LiveInputAudioUnmuteParam: + description: Resume audio input to a Live model after muting it. The server acknowledges with `session.input_audio.unmuted`. + example: + type: session.input_audio.unmute + event_id: evt_unmute_001 + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.input_audio.unmute`. + default: session.input_audio.unmute + x-stainless-const: true + type: string + enum: + - session.input_audio.unmute + required: + - type + x-oaiMeta: + example: + type: session.input_audio.unmute + event_id: evt_unmute_001 + LiveInstructionsAppendParam: + description: Append instructions to the Live conversation while it is running, optionally associating them with an existing client delegation. + example: + type: session.instructions.append + event_id: evt_instructions_001 + delegation_id: null + content: The caller prefers outdoor seating. + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.instructions.append`. + default: session.instructions.append + x-stainless-const: true + type: string + enum: + - session.instructions.append + delegation_id: + anyOf: + - description: Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation. + type: string + minLength: 1 + - type: 'null' + content: + description: Instruction text to append, limited to 500 tokens. This is a plain string, not an array of content parts. + type: string + required: + - type + - delegation_id + - content + x-oaiMeta: + example: + type: session.instructions.append + event_id: evt_instructions_001 + delegation_id: null + content: The caller prefers outdoor seating. + LiveThinkingAppendParam: + description: Provide silent reasoning or progress context to the Live model, optionally for an existing client delegation. + example: + type: session.thinking.append + event_id: evt_thinking_001 + delegation_id: del_abc123 + content: Checking availability for two guests at 7 PM. + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.thinking.append`. + default: session.thinking.append + x-stainless-const: true + type: string + enum: + - session.thinking.append + delegation_id: + anyOf: + - description: Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation. + type: string + minLength: 1 + - type: 'null' + content: + description: Silent reasoning or progress context, limited to 500 tokens. It does not directly request speech, but can influence later speech and is not a secrecy boundary. + type: string + required: + - type + - delegation_id + - content + x-oaiMeta: + example: + type: session.thinking.append + event_id: evt_thinking_001 + delegation_id: del_abc123 + content: Checking availability for two guests at 7 PM. + LiveCommentaryAppendParam: + description: Provide context the Live model can communicate to the user, optionally for an existing client delegation. + example: + type: session.commentary.append + event_id: evt_commentary_001 + delegation_id: del_abc123 + content: There is an outdoor table for two at 7 PM. Ask whether to reserve it. + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.commentary.append`. + default: session.commentary.append + x-stainless-const: true + type: string + enum: + - session.commentary.append + delegation_id: + anyOf: + - description: Required, nullable. Set null for general session context, or use the ID from session.delegation.created for an existing client delegation. Non-null IDs are not accepted with Responses delegation. + type: string + minLength: 1 + - type: 'null' + content: + description: Speakable context for the Live model, limited to 500 tokens. Use this for a result the model should communicate; use session.thinking.append for silent context. + type: string + required: + - type + - delegation_id + - content + x-oaiMeta: + example: + type: session.commentary.append + event_id: evt_commentary_001 + delegation_id: del_abc123 + content: There is an outdoor table for two at 7 PM. Ask whether to reserve it. + LiveResponseItemCreateParam: + description: Add an input item to the Live session’s Responses backend. Requires Responses delegation; use `response.create` to request a response. + example: + type: response.item.create + event_id: evt_item_001 + item: + type: message + role: user + content: + - type: input_text + text: Please check for a table for two at 7 PM. + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `response.item.create`. + default: response.item.create + x-stainless-const: true + type: string + enum: + - response.item.create + item: + description: An input item to append to the Responses backend conversation, such as a user message or a function tool result. + $ref: '#/components/schemas/InputItem' + required: + - type + - item + x-oaiMeta: + example: + type: response.item.create + event_id: evt_item_001 + item: + type: message + role: user + content: + - type: input_text + text: Please check for a table for two at 7 PM. + LiveResponseCreateParam: + description: Request a response from the Live session’s Responses backend, or continue a delegated response waiting for tool results. Requires Responses delegation. + example: + type: response.create + event_id: evt_response_001 + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `response.create`. + default: response.create + x-stainless-const: true + type: string + enum: + - response.create + required: + - type + x-oaiMeta: + example: + type: response.create + event_id: evt_response_001 + LiveSessionCloseParam: + description: Request that the Live session close. The terminal `session.closed` event contains the close reason and final usage. + example: + type: session.close + event_id: evt_close_001 + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.close`. + default: session.close + x-stainless-const: true + type: string + enum: + - session.close + required: + - type + x-oaiMeta: + example: + type: session.close + event_id: evt_close_001 + LiveForkAudioParam: + description: Audio format for the new WebSocket connection to a forked Live session. The stored voice is preserved. + type: object + properties: + format: + description: Audio encoding and sample rate for audio sent and received over a Live WebSocket connection. WebRTC and SIP negotiate their media format separately. + $ref: '#/components/schemas/LiveAudioFormat' + required: [] + LiveForkSessionConfigParam: + description: Overrides for a stored session after connecting to the fork WebSocket. An empty object inherits the stored configuration; do not supply a new model. audio.format applies only to the new WebSocket connection. client overrides are only supported for WebRTC forks. + type: object + properties: + audio: + description: Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and must omit this field. + $ref: '#/components/schemas/LiveForkAudioParam' + delegation: + description: Overrides for the stored session’s Responses backend. Only supported when the stored session already uses Responses delegation; the delegation type cannot change. + $ref: '#/components/schemas/LiveResponsesDelegationUpdateParam' + store: + description: Whether to store the forked session. Omission inherits the stored session's setting. + type: boolean + client: + description: Frontend data-channel permissions for a WebRTC fork. Omitted permissions inherit the stored values. Not supported for WebSocket forks. + $ref: '#/components/schemas/LiveClientConfigParam' + required: [] + LiveForkSessionStartEvent: + description: Start a Live session after connecting to a stored session’s fork WebSocket. Send an empty `session` object to use the stored configuration. + example: + type: session.start + session: {} + type: object + properties: + event_id: + anyOf: + - description: Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id. + type: string + maxLength: 512 + - type: 'null' + type: + description: The Live client event type. Always `session.start`. + default: session.start + x-stainless-const: true + type: string + enum: + - session.start + session: + description: Overrides for a stored session after connecting to the fork WebSocket. An empty object inherits the stored configuration; do not supply a new model. audio.format applies only to the new WebSocket connection. client overrides are only supported for WebRTC forks. + $ref: '#/components/schemas/LiveForkSessionConfigParam' + required: + - type + - session + x-oaiMeta: + example: + type: session.start + session: {} + LiveSessionResourceParam: + description: The resolved Live session configuration and server-assigned session metadata. + type: object + properties: + model: + $ref: '#/components/schemas/ModelIdsLive' + instructions: + anyOf: + - description: Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup. + type: string + - type: 'null' + input: + description: Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total. + type: array + items: + $ref: '#/components/schemas/LiveInitialItem' + maxItems: 128 + audio: + description: Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup. + $ref: '#/components/schemas/LiveInitialSessionAudioParam' + delegation: + anyOf: + - description: Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` to let the API manage a Responses backend. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveClientDelegationParam' + - $ref: '#/components/schemas/LiveResponsesDelegationParam' + - type: 'null' + store: + description: Whether to store the session for later forking and recording download. Defaults to false for new sessions. + type: boolean + client: + description: Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected. + $ref: '#/components/schemas/LiveClientConfigParam' + id: + description: The unique ID of the Live session. Use this ID for sideband connections, forking, and recording download. + type: string + expires_at: + description: The Unix timestamp, in seconds, at which the Live session expires. + type: integer + status: + description: The status of the session snapshot. Always `active`, including the final snapshot in session.closed; use the event type to determine that the session has closed. + default: active + x-stainless-const: true + type: string + enum: + - active + required: + - model + - id + - expires_at + - status + LiveSessionStarted: + description: Returned when a Live session has started. Contains the resolved session configuration, including server defaults. + example: + type: session.started + event_id: evt_started_001 + client_event_id: evt_start_001 + session: + id: live_abc123 + model: gpt-live-1 + status: active + expires_at: 1788555600 + instructions: Help the caller plan a restaurant reservation. Confirm details before booking. + input: [] + audio: + format: + type: audio/pcm + rate: 24000 + output: + voice: marin + delegation: + type: client + type: object + properties: + type: + description: The event type, always `session.started`. + default: session.started + x-stainless-const: true + type: string + enum: + - session.started + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + session: + $ref: '#/components/schemas/LiveSessionResourceParam' + required: + - type + - event_id + - session + x-oaiMeta: + example: + type: session.started + event_id: evt_started_001 + client_event_id: evt_start_001 + session: + id: live_abc123 + model: gpt-live-1 + status: active + expires_at: 1788555600 + instructions: Help the caller plan a restaurant reservation. Confirm details before booking. + input: [] + audio: + format: + type: audio/pcm + rate: 24000 + output: + voice: marin + delegation: + type: client + LiveSessionUpdated: + description: Returned when a Live session update is accepted. Contains the resolved session configuration after the update. + example: + type: session.updated + event_id: evt_updated_001 + client_event_id: evt_update_001 + session: + id: live_def456 + model: gpt-live-1 + status: active + expires_at: 1788555600 + instructions: Help the caller plan a restaurant reservation. Confirm details before booking. + input: [] + audio: + format: + type: audio/pcm + rate: 24000 + output: + voice: marin + delegation: + type: responses + responses: + model: gpt-6-astra + instructions: Check restaurant availability. Ask before confirming a booking. + max_output_tokens: 1024 + tools: [] + type: object + properties: + type: + description: The event type, always `session.updated`. + default: session.updated + x-stainless-const: true + type: string + enum: + - session.updated + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + session: + $ref: '#/components/schemas/LiveSessionResourceParam' + required: + - type + - event_id + - session + x-oaiMeta: + example: + type: session.updated + event_id: evt_updated_001 + client_event_id: evt_update_001 + session: + id: live_def456 + model: gpt-live-1 + status: active + expires_at: 1788555600 + instructions: Help the caller plan a restaurant reservation. Confirm details before booking. + input: [] + audio: + format: + type: audio/pcm + rate: 24000 + output: + voice: marin + delegation: + type: responses + responses: + model: gpt-6-astra + instructions: Check restaurant availability. Ask before confirming a booking. + max_output_tokens: 1024 + tools: [] + LiveInputAudioMuted: + description: Returned when a session.input_audio.mute command is accepted. Input audio is no longer sent to the model; sideband audio reflection continues. + example: + type: session.input_audio.muted + event_id: evt_muted_001 + client_event_id: evt_mute_001 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + type: + description: The event type, always `session.input_audio.muted`. + default: session.input_audio.muted + x-stainless-const: true + type: string + enum: + - session.input_audio.muted + required: + - event_id + - type + x-oaiMeta: + example: + type: session.input_audio.muted + event_id: evt_muted_001 + client_event_id: evt_mute_001 + LiveInputAudioUnmuted: + description: Returned when a session.input_audio.unmute command is accepted. Input audio is sent to the model again. + example: + type: session.input_audio.unmuted + event_id: evt_unmuted_001 + client_event_id: evt_unmute_001 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + type: + description: The event type, always `session.input_audio.unmuted`. + default: session.input_audio.unmuted + x-stainless-const: true + type: string + enum: + - session.input_audio.unmuted + required: + - event_id + - type + x-oaiMeta: + example: + type: session.input_audio.unmuted + event_id: evt_unmuted_001 + client_event_id: evt_unmute_001 + LiveInstructionsAppended: + description: Returned when a session.instructions.append command is accepted into the Live session timeline. Acknowledges the appended instructions without guaranteeing that the model has acted on them. + example: + type: session.instructions.appended + event_id: evt_instructions_002 + client_event_id: evt_instructions_001 + start_ms: 1200 + end_ms: 1400 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + start_ms: + description: The start of this event on the Live session timeline, in milliseconds from the beginning of the session. + type: integer + end_ms: + description: The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms. + type: integer + type: + description: The event type, always `session.instructions.appended`. + default: session.instructions.appended + x-stainless-const: true + type: string + enum: + - session.instructions.appended + required: + - event_id + - start_ms + - end_ms + - type + x-oaiMeta: + example: + type: session.instructions.appended + event_id: evt_instructions_002 + client_event_id: evt_instructions_001 + start_ms: 1200 + end_ms: 1400 + LiveThinkingAppended: + description: Returned when a session.thinking.append command is accepted into the Live session timeline. Acknowledges the added reasoning context without guaranteeing any spoken output. + example: + type: session.thinking.appended + event_id: evt_thinking_002 + client_event_id: evt_thinking_001 + start_ms: 4600 + end_ms: 4800 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + start_ms: + description: The start of this event on the Live session timeline, in milliseconds from the beginning of the session. + type: integer + end_ms: + description: The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms. + type: integer + type: + description: The event type, always `session.thinking.appended`. + default: session.thinking.appended + x-stainless-const: true + type: string + enum: + - session.thinking.appended + required: + - event_id + - start_ms + - end_ms + - type + x-oaiMeta: + example: + type: session.thinking.appended + event_id: evt_thinking_002 + client_event_id: evt_thinking_001 + start_ms: 4600 + end_ms: 4800 + LiveCommentaryAppended: + description: Returned when a session.commentary.append command is accepted into the Live session timeline. Acknowledges the added commentary without guaranteeing exact wording or completed audio playback. + example: + type: session.commentary.appended + event_id: evt_commentary_002 + client_event_id: evt_commentary_001 + start_ms: 5200 + end_ms: 5400 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + start_ms: + description: The start of this event on the Live session timeline, in milliseconds from the beginning of the session. + type: integer + end_ms: + description: The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms. + type: integer + type: + description: The event type, always `session.commentary.appended`. + default: session.commentary.appended + x-stainless-const: true + type: string + enum: + - session.commentary.appended + required: + - event_id + - start_ms + - end_ms + - type + x-oaiMeta: + example: + type: session.commentary.appended + event_id: evt_commentary_002 + client_event_id: evt_commentary_001 + start_ms: 5200 + end_ms: 5400 + LiveInputAudioAppend: + description: Input audio received from the primary transport and reflected to a Live sideband connection before model-input muting. + example: + type: session.input_audio.append + audio: AACAAIAAAIAAAP9/AIAAgA== + type: object + properties: + type: + description: The event type, always `session.input_audio.append`. + default: session.input_audio.append + x-stainless-const: true + type: string + enum: + - session.input_audio.append + audio: + description: Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, reflected to the sideband before model-input muting. This server event uses the same audio key as the client command, but is not an acknowledgment of it. + type: string + required: + - type + - audio + x-oaiMeta: + example: + type: session.input_audio.append + audio: AACAAIAAAIAAAP9/AIAAgA== + LiveOutputAudioDelta: + description: An audio chunk generated by the Live model. Decode and play primary WebSocket chunks in delivery order using the configured session audio format. Sideband connections receive reflected output audio with timestamps. + example: + type: session.output_audio.delta + delta: AACAAIAAAIAAAP9/AIAAgA== + start_ms: 1000 + end_ms: 1200 + type: object + properties: + type: + description: The event type, always `session.output_audio.delta`. + default: session.output_audio.delta + x-stainless-const: true + type: string + enum: + - session.output_audio.delta + delta: + description: Base64-encoded raw audio. Primary WebSocket events use the session's configured format; reflected sideband events use mono PCM16LE at 24 kHz. + type: string + start_ms: + description: Inclusive session-relative start in milliseconds. Required on reflected sideband events; omitted on the primary WebSocket. + type: integer + end_ms: + description: Exclusive session-relative end in milliseconds. Required on reflected sideband events; omitted on the primary WebSocket. Dropped output frames leave gaps between reflected ranges. + type: integer + required: + - type + - delta + x-oaiMeta: + example: + type: session.output_audio.delta + delta: AACAAIAAAIAAAP9/AIAAgA== + start_ms: 1000 + end_ms: 1200 + LiveInputTranscriptDelta: + description: A transcript fragment for user input audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event. + example: + type: session.input_transcript.delta + event_id: evt_input_transcript_001 + delta: A table for two at seven, please. + start_ms: 1600 + end_ms: 3400 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + start_ms: + description: The start of this event on the Live session timeline, in milliseconds from the beginning of the session. + type: integer + end_ms: + description: The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms. + type: integer + delta: + description: The transcript text fragment for the audio in this time range. Append fragments in delivery order to build the transcript. + type: string + type: + description: The event type, always `session.input_transcript.delta`. + default: session.input_transcript.delta + x-stainless-const: true + type: string + enum: + - session.input_transcript.delta + required: + - event_id + - start_ms + - end_ms + - delta + - type + x-oaiMeta: + example: + type: session.input_transcript.delta + event_id: evt_input_transcript_001 + delta: A table for two at seven, please. + start_ms: 1600 + end_ms: 3400 + LiveOutputTranscriptDelta: + description: A transcript fragment for assistant output audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event. + example: + type: session.output_transcript.delta + event_id: evt_output_transcript_001 + delta: Would you like me to reserve that table? + start_ms: 5400 + end_ms: 7200 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + start_ms: + description: The start of this event on the Live session timeline, in milliseconds from the beginning of the session. + type: integer + end_ms: + description: The end of this event on the Live session timeline, in milliseconds from the beginning of the session. For appended context, this can equal start_ms. + type: integer + delta: + description: The transcript text fragment for the audio in this time range. Append fragments in delivery order to build the transcript. + type: string + type: + description: The event type, always `session.output_transcript.delta`. + default: session.output_transcript.delta + x-stainless-const: true + type: string + enum: + - session.output_transcript.delta + required: + - event_id + - start_ms + - end_ms + - delta + - type + x-oaiMeta: + example: + type: session.output_transcript.delta + event_id: evt_output_transcript_001 + delta: Would you like me to reserve that table? + start_ms: 5400 + end_ms: 7200 + LiveDelegationItem: + description: Metadata for work delegated by the Live model. Client delegations are handled by your application; Responses delegations run on the configured backend. + type: object + properties: + id: + description: The unique ID of the delegation. Use this as delegation_id when replying to client-owned work or correlating Responses events. + type: string + type: + description: The object type, always `delegation`. + default: delegation + x-stainless-const: true + type: string + enum: + - delegation + target: + description: 'Where the Live model delegated the work: `client` for your application, or `responses` for the configured Responses backend.' + anyOf: + - default: client + x-stainless-const: true + type: string + enum: + - client + - default: responses + x-stainless-const: true + type: string + enum: + - responses + response_id: + description: The ID of the Responses API response associated with a Responses delegation. Omitted for client delegations. + type: string + required: + - id + - type + - target + LiveDelegationCreated: + description: Returned when the Live model delegates work to your application or a Responses backend. Contains delegation metadata and the position on the session timeline where the work was delegated. + example: + type: session.delegation.created + event_id: evt_delegation_001 + offset_ms: 3600 + delegation: + id: del_abc123 + type: delegation + target: client + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + type: + description: The event type, always `session.delegation.created`. + default: session.delegation.created + x-stainless-const: true + type: string + enum: + - session.delegation.created + offset_ms: + description: The position on the Live session timeline where the delegation was created, in milliseconds from the beginning of the session. + type: integer + delegation: + description: The delegated work identifier and destination. This object contains metadata, not the task text. + $ref: '#/components/schemas/LiveDelegationItem' + required: + - event_id + - type + - offset_ms + - delegation + x-oaiMeta: + example: + type: session.delegation.created + event_id: evt_delegation_001 + offset_ms: 3600 + delegation: + id: del_abc123 + type: delegation + target: client + LiveResponseEvent: + description: A streaming Responses API event from a backend delegated to by the Live session. Use the outer delegation_id to associate the nested stream with its Live delegation. + example: + type: response.event + event_id: evt_response_002 + delegation_id: del_responses123 + event: + type: response.output_text.delta + item_id: msg_abc123 + output_index: 0 + content_index: 0 + delta: An outdoor table is available at 7 PM. + sequence_number: 3 + logprobs: [] + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + type: + description: The event type, always `response.event`. + default: response.event + x-stainless-const: true + type: string + enum: + - response.event + delegation_id: + anyOf: + - description: The Live delegation associated with the nested Responses event. May be null or omitted when the event cannot be correlated with a delegation. + type: string + - type: 'null' + event: + description: The nested Responses streaming event. Dispatch on its type field. Response lifecycle snapshots omit input and clear instructions, tools, and output to keep messages small; consume granular output events for the generated content. + type: object + additionalProperties: {} + required: + - event_id + - type + - event + x-oaiMeta: + example: + type: response.event + event_id: evt_response_002 + delegation_id: del_responses123 + event: + type: response.output_text.delta + item_id: msg_abc123 + output_index: 0 + content_index: 0 + delta: An outdoor table is available at 7 PM. + sequence_number: 3 + logprobs: [] + LiveSessionUsage: + description: Cumulative audio duration for a Live session. Values are totals for the session, not increments to sum across usage events. + type: object + properties: + seconds: + description: The cumulative Live audio duration in seconds. Do not sum this value across usage events. + type: number + required: + - seconds + LiveContextWindowUsage: + description: The latest measured context-window usage of the Live model. This is separate from billing usage and delegated Responses token usage. + type: object + properties: + usage_ratio: + description: The latest active context token count divided by the Live model context limit. Can decrease after compaction and may lag between measured audio frames. + type: number + required: + - usage_ratio + LiveSessionUsageUpdated: + description: Reports cumulative Live audio usage and, when available, the most recent context-window usage. Delegated Responses token usage is reported separately in response.event events. + example: + type: session.usage.updated + event_id: evt_usage_001 + usage: + seconds: 32.5 + context_window: + usage_ratio: 0.12 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + type: + description: The event type, always `session.usage.updated`. + default: session.usage.updated + x-stainless-const: true + type: string + enum: + - session.usage.updated + usage: + description: The cumulative Live audio usage so far. + $ref: '#/components/schemas/LiveSessionUsage' + context_window: + description: The latest measured Live context-window usage. Omitted when the context limit is unknown. + $ref: '#/components/schemas/LiveContextWindowUsage' + required: + - event_id + - type + - usage + x-oaiMeta: + example: + type: session.usage.updated + event_id: evt_usage_001 + usage: + seconds: 32.5 + context_window: + usage_ratio: 0.12 + LiveSessionClosed: + description: Returned after the Live session finishes finalizing, with the close reason, final session snapshot, and cumulative audio usage. A connection closing without this event does not confirm successful finalization. + example: + type: session.closed + event_id: evt_closed_001 + client_event_id: evt_close_001 + reason: close_requested + session: + id: live_abc123 + model: gpt-live-1 + status: active + expires_at: 1788555600 + instructions: Help the caller plan a restaurant reservation. Confirm details before booking. + input: [] + audio: + format: + type: audio/pcm + rate: 24000 + output: + voice: marin + delegation: + type: client + usage: + seconds: 45.8 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + type: + description: The event type, always `session.closed`. + default: session.closed + x-stainless-const: true + type: string + enum: + - session.closed + reason: + description: 'Why the Live session ended: `close_requested` for an application close or hangup request, `expired` for the session duration limit, `content` for a safety filter, `remote_hangup` for a graceful remote disconnect, or `connection_lost` for an unexpected primary or upstream disconnection.' + anyOf: + - default: close_requested + x-stainless-const: true + type: string + enum: + - close_requested + - default: expired + x-stainless-const: true + type: string + enum: + - expired + - default: content + x-stainless-const: true + type: string + enum: + - content + - default: remote_hangup + x-stainless-const: true + type: string + enum: + - remote_hangup + - default: connection_lost + x-stainless-const: true + type: string + enum: + - connection_lost + session: + $ref: '#/components/schemas/LiveSessionResourceParam' + usage: + description: The final cumulative Live audio usage after session finalization. + $ref: '#/components/schemas/LiveSessionUsage' + required: + - event_id + - type + - reason + - session + - usage + x-oaiMeta: + example: + type: session.closed + event_id: evt_closed_001 + client_event_id: evt_close_001 + reason: close_requested + session: + id: live_abc123 + model: gpt-live-1 + status: active + expires_at: 1788555600 + instructions: Help the caller plan a restaurant reservation. Confirm details before booking. + input: [] + audio: + format: + type: audio/pcm + rate: 24000 + output: + voice: marin + delegation: + type: client + usage: + seconds: 45.8 + LiveLiveError: + description: Details of an error encountered by the Live session, including the affected parameter or client command when available. + type: object + properties: + type: + description: The category of error, such as `invalid_request_error` for an invalid Live client command. + type: string + code: + description: A machine-readable code identifying the Live error, such as `unknown_parameter`. + type: string + message: + description: A human-readable explanation of the Live error. + type: string + param: + description: The parameter that caused the error, when applicable, such as `session.voice`. + type: string + client_event_id: + description: The event_id of the client command that caused the error, when supplied. + type: string + required: + - type + - code + - message + LiveErrorEvent: + description: Reports an error in the Live session, such as an invalid client command. Use error.client_event_id, when present, to identify the command that caused the error. + example: + type: error + event_id: evt_error_001 + error: + type: invalid_request_error + code: unknown_parameter + message: 'Unknown parameter: ''session.voice''.' + param: session.voice + client_event_id: evt_invalid_001 + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + type: + description: The event type, always `error`. + default: error + x-stainless-const: true + type: string + enum: + - error + error: + description: Details of the Live error and the client command that caused it, when known. + $ref: '#/components/schemas/LiveLiveError' + required: + - event_id + - type + - error + x-oaiMeta: + example: + type: error + event_id: evt_error_001 + error: + type: invalid_request_error + code: unknown_parameter + message: 'Unknown parameter: ''session.voice''.' + param: session.voice + client_event_id: evt_invalid_001 + LiveInfoEvent: + description: An informational notice about the Live session, such as the event permissions applied to a frontend data channel. + example: + type: info + event_id: evt_info_001 + code: data_channel_permissions + message: The frontend data channel is configured with restricted event permissions. + type: object + properties: + event_id: + description: The unique ID of the Live server event. + type: string + client_event_id: + description: The event_id of the client command associated with this server event, when supplied. + type: string + type: + description: The event type, always `info`. + default: info + x-stainless-const: true + type: string + enum: + - info + code: + description: A machine-readable code for the notice, such as `data_channel_permissions`. + type: string + message: + description: A human-readable explanation of the Live session notice. + type: string + required: + - event_id + - type + - code + - message + x-oaiMeta: + example: + type: info + event_id: evt_info_001 + code: data_channel_permissions + message: The frontend data channel is configured with restricted event permissions. + LiveTransportDTMFReceived: + description: A SIP DTMF keypress received from the caller. Delivered only to sideband observers. + example: + type: transport.dtmf.received + event_id: event_dtmf_1 + event: '5' + type: object + properties: + type: + default: transport.dtmf.received + x-stainless-const: true + type: string + enum: + - transport.dtmf.received + event_id: + type: string + event: + type: string + minLength: 1 + maxLength: 1 + pattern: ^[0-9A-D*#]$ + required: + - type + - event_id + - event + x-oaiMeta: + example: + type: transport.dtmf.received + event_id: event_dtmf_1 + event: '5' + LiveTransportDTMFSend: + description: A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to sideband observers; this is not a client command. + example: + type: transport.dtmf.send + event_id: event_dtmf_2 + event: '#' + type: object + properties: + type: + default: transport.dtmf.send + x-stainless-const: true + type: string + enum: + - transport.dtmf.send + event_id: + type: string + event: + type: string + minLength: 1 + maxLength: 1 + pattern: ^[0-9A-D*#]$ + required: + - type + - event_id + - event + x-oaiMeta: + example: + type: transport.dtmf.send + event_id: event_dtmf_2 + event: '#' + LiveTransportRinging: + description: The outbound SIP provider leg is ringing or providing early media. Delivered only to sideband observers. + example: + type: transport.ringing + event_id: event_call_1 + session_id: live_u0_123 + type: object + properties: + event_id: + type: string + session_id: + description: The canonical Live session ID. + type: string + type: + default: transport.ringing + x-stainless-const: true + type: string + enum: + - transport.ringing + required: + - event_id + - session_id + - type + x-oaiMeta: + example: + type: transport.ringing + event_id: event_call_1 + session_id: live_u0_123 + LiveTransportAnswered: + description: The outbound SIP provider leg answered and media is established. Delivered only to sideband observers. + example: + type: transport.answered + event_id: event_call_2 + session_id: live_u0_123 + type: object + properties: + event_id: + type: string + session_id: + description: The canonical Live session ID. + type: string + type: + default: transport.answered + x-stainless-const: true + type: string + enum: + - transport.answered + required: + - event_id + - session_id + - type + x-oaiMeta: + example: + type: transport.answered + event_id: event_call_2 + session_id: live_u0_123 + LiveTransportCallError: + type: object + properties: + type: + default: call_error + x-stainless-const: true + type: string + enum: + - call_error + code: + description: The call setup failure code. + type: string + message: + type: string + param: + description: The parameter related to the error, if any. Empty when no parameter applies. + type: string + required: + - type + - code + - message + LiveTransportFailed: + description: An asynchronous outbound SIP setup failure. Delivered only to sideband observers. + example: + type: transport.failed + event_id: event_call_4 + session_id: live_u0_123 + error: + type: call_error + code: provider_invite_failed + message: provider rejected the call + param: '' + type: object + properties: + event_id: + type: string + session_id: + description: The canonical Live session ID. + type: string + type: + default: transport.failed + x-stainless-const: true + type: string + enum: + - transport.failed + error: + $ref: '#/components/schemas/LiveTransportCallError' + required: + - event_id + - session_id + - type + - error + x-oaiMeta: + example: + type: transport.failed + event_id: event_call_4 + session_id: live_u0_123 + error: + type: call_error + code: provider_invite_failed + message: provider rejected the call + param: '' + LiveServerEvent-2: + description: An event sent by the Live API on a primary WebSocket or sideband connection. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveSessionStarted' + - $ref: '#/components/schemas/LiveSessionUpdated' + - $ref: '#/components/schemas/LiveInputAudioMuted' + - $ref: '#/components/schemas/LiveInputAudioUnmuted' + - $ref: '#/components/schemas/LiveInstructionsAppended' + - $ref: '#/components/schemas/LiveThinkingAppended' + - $ref: '#/components/schemas/LiveCommentaryAppended' + - $ref: '#/components/schemas/LiveInputAudioAppend' + - $ref: '#/components/schemas/LiveOutputAudioDelta' + - $ref: '#/components/schemas/LiveInputTranscriptDelta' + - $ref: '#/components/schemas/LiveOutputTranscriptDelta' + - $ref: '#/components/schemas/LiveDelegationCreated' + - $ref: '#/components/schemas/LiveResponseEvent' + - $ref: '#/components/schemas/LiveSessionUsageUpdated' + - $ref: '#/components/schemas/LiveSessionClosed' + - $ref: '#/components/schemas/LiveErrorEvent' + - $ref: '#/components/schemas/LiveInfoEvent' + - $ref: '#/components/schemas/LiveTransportDTMFReceived' + - $ref: '#/components/schemas/LiveTransportDTMFSend' + - $ref: '#/components/schemas/LiveTransportRinging' + - $ref: '#/components/schemas/LiveTransportAnswered' + - $ref: '#/components/schemas/LiveTransportFailed' UserMessageItemParam: properties: id: @@ -71856,27 +74792,21 @@ components: title: Code interpreter output logs description: The logs output from the code interpreter. BetaImageGenToolCall: - type: object - title: Image generation call - description: | - An image generation request made by the model. properties: agent: anyOf: - $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. - type: 'null' - description: The agent that produced this item. type: type: string enum: - image_generation_call - description: | - The type of the image generation call. Always `image_generation_call`. + description: The type of the image generation call. Always `image_generation_call`. x-stainless-const: true id: type: string - description: | - The unique ID of the image generation call. + description: The unique ID of the image generation call. status: type: string enum: @@ -71884,24 +74814,23 @@ components: - completed - generating - failed - description: | - The status of the image generation call. + description: The status of the image generation call. result: anyOf: - type: string - description: | - The generated image encoded in base64. + description: The generated image encoded in base64. - type: 'null' size: anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 + - anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. - type: 'null' - description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. quality: anyOf: - type: string @@ -71912,13 +74841,51 @@ components: - xhigh - max - auto + description: The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. - type: 'null' - description: The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. + action: + anyOf: + - $ref: '#/components/schemas/BetaImageGenActionEnum' + description: The action used for image generation. + - type: 'null' + x-openai-go-optional-enum: true + background: + anyOf: + - $ref: '#/components/schemas/BetaImageBackground' + description: The background setting used for generation. + - type: 'null' + x-openai-go-optional-enum: true + output_format: + anyOf: + - $ref: '#/components/schemas/BetaImageOutputFormat' + description: The output format used for generation. + - type: 'null' + x-openai-go-optional-enum: true + revised_prompt: + anyOf: + - type: string + description: The prompt that was used after any model prompt rewriting. + - type: 'null' + type: object required: - type - id - status - result + title: Image generation call + description: An image generation request made by the model. + BetaImageOutputFormat: + type: string + enum: + - png + - webp + - jpeg + BetaImageBackground: + type: string + enum: + - transparent + - opaque + - auto BetaCompactionSummaryItemParam: properties: agent: @@ -81183,6 +84150,32 @@ components: - gpt-3.5-turbo-0125 - gpt-3.5-turbo-16k-0613 x-stainless-nominal: false + LiveBuiltInVoice: + type: string + enum: + - alloy + - ash + - ballad + - beacon + - bossa + - cedar + - cinder + - coral + - delta + - echo + - gleam + - marin + - meridian + - quartz + - ripple + - sage + - shimmer + - stone + - tempo + - verse + - vesper + - willow + description: A built-in voice available for Live speech. Summary: properties: type: @@ -81586,6 +84579,8 @@ x-oaiMeta: beta: true - id: containers title: Containers + - id: live + title: Live (alpha) - id: realtime title: Realtime - id: chat @@ -82007,6 +85002,9 @@ x-oaiMeta: - type: object key: WebhookLiveCallIncoming path: + - type: object + key: WebhookLiveTransportIncoming + path: - type: object key: WebhookSafetyAlertCreated path: @@ -82448,3 +85446,97 @@ x-oaiMeta: - type: object key: RealtimeBetaServerEventRateLimitsUpdated path: + - id: live-client-events + title: Client events + description: Initialize a primary WebSocket with session.start and wait for session.started before sending other events. WebRTC creation starts the session for you. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) to design frontend instructions and delegation policy; see [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt) for tools and business rules. + navigationGroup: live + sections: + - type: object + key: LiveSessionStartEvent + path: + - type: object + key: LiveForkSessionStartEvent + path: + - type: object + key: LiveSessionUpdateParam + path: + - type: object + key: LiveInputAudioAppendEvent + path: + - type: object + key: LiveInputAudioMuteParam + path: + - type: object + key: LiveInputAudioUnmuteParam + path: + - type: object + key: LiveInstructionsAppendParam + path: + - type: object + key: LiveThinkingAppendParam + path: + - type: object + key: LiveCommentaryAppendParam + path: + - type: object + key: LiveResponseItemCreateParam + path: + - type: object + key: LiveResponseCreateParam + path: + - type: object + key: LiveSessionCloseParam + path: + - id: live-server-events + title: Server events + description: Live server events. Responses delegation lifecycle events arrive inside response.event, not as top-level response events. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) to design frontend instructions and delegation policy; see [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt) for tools and business rules. + navigationGroup: live + sections: + - type: object + key: LiveSessionStarted + path: + - type: object + key: LiveSessionUpdated + path: + - type: object + key: LiveInputAudioMuted + path: + - type: object + key: LiveInputAudioUnmuted + path: + - type: object + key: LiveInstructionsAppended + path: + - type: object + key: LiveThinkingAppended + path: + - type: object + key: LiveCommentaryAppended + path: + - type: object + key: LiveOutputAudioDelta + path: + - type: object + key: LiveInputTranscriptDelta + path: + - type: object + key: LiveOutputTranscriptDelta + path: + - type: object + key: LiveDelegationCreated + path: + - type: object + key: LiveResponseEvent + path: + - type: object + key: LiveSessionUsageUpdated + path: + - type: object + key: LiveSessionClosed + path: + - type: object + key: LiveErrorEvent + path: + - type: object + key: LiveInfoEvent + path: diff --git a/examples/e2e.yml b/examples/e2e.yml index de0d284e3..06ba26851 100644 --- a/examples/e2e.yml +++ b/examples/e2e.yml @@ -49,6 +49,9 @@ examples: examples/image_stream.rb: status: covered expected_output: Final image completed! + examples/live/webrtc.rb: + status: excluded + reason: Requires a browser-generated SDP offer and Live model access; offline tests cover the backend SDP handoff. examples/mtls_custom_http_client.rb: status: excluded reason: Requires an enrolled mTLS certificate, private key, endpoint, and model. diff --git a/examples/live/webrtc.rb b/examples/live/webrtc.rb new file mode 100755 index 000000000..a99436b76 --- /dev/null +++ b/examples/live/webrtc.rb @@ -0,0 +1,39 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "json" + +require_relative "../../lib/openai" + +module OpenAI + module Examples + module Live + module WebRTC + module_function + + # Run on your backend, after authenticating the browser's request. Keep the + # API key on the backend. The browser creates the peer connection, adds its + # audio track and data channel, and sends its local SDP offer here. + def create(client:, offer_sdp:, model: "gpt-live-1") + client.live.create( + session: {model: model}, + transport: {type: :webrtc, sdp: offer_sdp} + ) + end + end + end + end +end + +if $PROGRAM_NAME == __FILE__ + # Usage: OPENAI_API_KEY=... ruby examples/live/webrtc.rb < offer.sdp > answer.json + # Return transport.sdp to the browser and apply it with setRemoteDescription. + # Wait for session.started on the data channel before sending commands. Keep + # session.id on your backend to associate a sideband connection with this user. + result = OpenAI::Examples::Live::WebRTC.create( + client: OpenAI::Client.new, + offer_sdp: $stdin.read, + model: ENV.fetch("OPENAI_LIVE_MODEL", "gpt-live-1") + ) + puts(JSON.generate({session: {id: result.session.id}, transport: {type: "webrtc", sdp: result.transport.sdp}})) +end diff --git a/lib/openai.rb b/lib/openai.rb index 6f962f775..e0e0f8359 100644 --- a/lib/openai.rb +++ b/lib/openai.rb @@ -868,6 +868,66 @@ require_relative "openai/models/image_input_reference_param" require_relative "openai/models/image_model" require_relative "openai/models/images_response" +require_relative "openai/models/live/audio_format" +require_relative "openai/models/live/built_in_voice" +require_relative "openai/models/live/client_config" +require_relative "openai/models/live/client_delegation" +require_relative "openai/models/live/client_event" +require_relative "openai/models/live/commentary_appended_event" +require_relative "openai/models/live/commentary_append_event" +require_relative "openai/models/live/custom_voice" +require_relative "openai/models/live/data_channel_config" +require_relative "openai/models/live/delegation_created_event" +require_relative "openai/models/live/error" +require_relative "openai/models/live/error_event" +require_relative "openai/models/live/fork_client_event" +require_relative "openai/models/live/fork_server_event" +require_relative "openai/models/live/fork_session_config" +require_relative "openai/models/live/fork_session_start_event" +require_relative "openai/models/live/function_tool" +require_relative "openai/models/live/info_event" +require_relative "openai/models/live/initial_item" +require_relative "openai/models/live/input_audio_append_event" +require_relative "openai/models/live/input_audio_muted_event" +require_relative "openai/models/live/input_audio_mute_event" +require_relative "openai/models/live/input_audio_unmuted_event" +require_relative "openai/models/live/input_audio_unmute_event" +require_relative "openai/models/live/input_transcript_delta_event" +require_relative "openai/models/live/instructions_appended_event" +require_relative "openai/models/live/instructions_append_event" +require_relative "openai/models/live/live_create_params" +require_relative "openai/models/live/live_create_response" +require_relative "openai/models/live/media_session_config" +require_relative "openai/models/live/media_session_fork_config" +require_relative "openai/models/live/output_audio_delta_event" +require_relative "openai/models/live/output_transcript_delta_event" +require_relative "openai/models/live/response_create_event" +require_relative "openai/models/live/response_event" +require_relative "openai/models/live/response_item_create_event" +require_relative "openai/models/live/responses_delegation_config" +require_relative "openai/models/live/responses_delegation_update_config" +require_relative "openai/models/live/server_event" +require_relative "openai/models/live/server_event_selector" +require_relative "openai/models/live/session_accept_params" +require_relative "openai/models/live/session_closed_event" +require_relative "openai/models/live/session_close_event" +require_relative "openai/models/live/session_config" +require_relative "openai/models/live/session_download_recording_params" +require_relative "openai/models/live/session_fork_params" +require_relative "openai/models/live/session_fork_response" +require_relative "openai/models/live/session_hangup_params" +require_relative "openai/models/live/session_refer_params" +require_relative "openai/models/live/session_reject_params" +require_relative "openai/models/live/session_resource" +require_relative "openai/models/live/session_started_event" +require_relative "openai/models/live/session_start_event" +require_relative "openai/models/live/session_update_config" +require_relative "openai/models/live/session_updated_event" +require_relative "openai/models/live/session_update_event" +require_relative "openai/models/live/session_usage" +require_relative "openai/models/live/session_usage_updated_event" +require_relative "openai/models/live/thinking_appended_event" +require_relative "openai/models/live/thinking_append_event" require_relative "openai/models/metadata" require_relative "openai/models/model" require_relative "openai/models/model_deleted" @@ -1205,6 +1265,7 @@ require_relative "openai/models/webhooks/fine_tuning_job_failed_webhook_event" require_relative "openai/models/webhooks/fine_tuning_job_succeeded_webhook_event" require_relative "openai/models/webhooks/live_call_incoming_webhook_event" +require_relative "openai/models/webhooks/live_transport_incoming_webhook_event" require_relative "openai/models/webhooks/realtime_call_incoming_webhook_event" require_relative "openai/models/webhooks/response_cancelled_webhook_event" require_relative "openai/models/webhooks/response_completed_webhook_event" @@ -1290,6 +1351,10 @@ require_relative "openai/resources/graders" require_relative "openai/resources/graders/grader_models" require_relative "openai/resources/images" +require_relative "openai/resources/live" +require_relative "openai/resources/live/forks" +require_relative "openai/resources/live/sessions" +require_relative "openai/resources/live/sideband" require_relative "openai/resources/models" require_relative "openai/resources/moderations" require_relative "openai/resources/realtime" diff --git a/lib/openai/client.rb b/lib/openai/client.rb index 2f3cb752a..c4f730857 100644 --- a/lib/openai/client.rb +++ b/lib/openai/client.rb @@ -109,6 +109,9 @@ class Client < OpenAI::Internal::Transport::BaseClient # @return [OpenAI::Resources::Responses] attr_reader :responses + # @return [OpenAI::Resources::Live] + attr_reader :live + # @return [OpenAI::Resources::Realtime] attr_reader :realtime @@ -818,6 +821,7 @@ def initialize( @uploads = OpenAI::Resources::Uploads.new(client: self) @admin = OpenAI::Resources::Admin.new(client: self) @responses = OpenAI::Resources::Responses.new(client: self) + @live = OpenAI::Resources::Live.new(client: self) @realtime = OpenAI::Resources::Realtime.new(client: self) @conversations = OpenAI::Resources::Conversations.new(client: self) @evals = OpenAI::Resources::Evals.new(client: self) diff --git a/lib/openai/models.rb b/lib/openai/models.rb index 27d550c0f..107132c99 100644 --- a/lib/openai/models.rb +++ b/lib/openai/models.rb @@ -196,6 +196,8 @@ module OpenAI ImagesResponse = OpenAI::Models::ImagesResponse + Live = OpenAI::Models::Live + # @type [OpenAI::Internal::Type::Converter] Metadata = OpenAI::Models::Metadata diff --git a/lib/openai/models/beta/beta_response_input_item.rb b/lib/openai/models/beta/beta_response_input_item.rb index a6724c064..311175c30 100644 --- a/lib/openai/models/beta/beta_response_input_item.rb +++ b/lib/openai/models/beta/beta_response_input_item.rb @@ -1296,12 +1296,42 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @return [Symbol, :image_generation_call] required :type, const: :image_generation_call + # @!attribute action + # The action used for image generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Action, nil] + optional( + :action, + enum: -> { OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action }, + nil?: true + ) + # @!attribute agent # The agent that produced this item. # # @return [OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Agent, nil] optional :agent, -> { OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Agent }, nil?: true + # @!attribute background + # The background setting used for generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Background, nil] + optional( + :background, + enum: -> { OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background }, + nil?: true + ) + + # @!attribute output_format + # The output format used for generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat, nil] + optional( + :output_format, + enum: -> { OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat }, + nil?: true + ) + # @!attribute quality # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. @@ -1313,6 +1343,12 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) + # @!attribute revised_prompt + # The prompt that was used after any model prompt rewriting. + # + # @return [String, nil] + optional :revised_prompt, String, nil?: true + # @!attribute size # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -1325,7 +1361,7 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) - # @!method initialize(id:, result:, status:, agent: nil, quality: nil, size: nil, type: :image_generation_call) + # @!method initialize(id:, result:, status:, action: nil, agent: nil, background: nil, output_format: nil, quality: nil, revised_prompt: nil, size: nil, type: :image_generation_call) # An image generation request made by the model. # # @param id [String] @@ -1337,13 +1373,25 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @param status [Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Status] # The status of the image generation call. # + # @param action [Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Action, nil] + # The action used for image generation. + # # @param agent [OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Agent, nil] # The agent that produced this item. # + # @param background [Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Background, nil] + # The background setting used for generation. + # + # @param output_format [Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat, nil] + # The output format used for generation. + # # @param quality [Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Quality, nil] # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # + # @param revised_prompt [String, nil] + # The prompt that was used after any model prompt rewriting. + # # @param size [String, Symbol, OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::Size, nil] # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -1365,6 +1413,20 @@ module Status # @return [Array] end + # The action used for image generation. + # + # @see OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall#action + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE = :generate + EDIT = :edit + AUTO = :auto + + # @!method self.values + # @return [Array] + end + # @see OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall#agent class Agent < OpenAI::Internal::Type::BaseModel # @!attribute agent_name @@ -1380,6 +1442,34 @@ class Agent < OpenAI::Internal::Type::BaseModel # The canonical name of the agent that produced this item. end + # The background setting used for generation. + # + # @see OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall#background + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT = :transparent + OPAQUE = :opaque + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The output format used for generation. + # + # @see OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall#output_format + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG = :png + WEBP = :webp + JPEG = :jpeg + + # @!method self.values + # @return [Array] + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # diff --git a/lib/openai/models/beta/beta_response_item.rb b/lib/openai/models/beta/beta_response_item.rb index 1c1b9808a..f0a6ce006 100644 --- a/lib/openai/models/beta/beta_response_item.rb +++ b/lib/openai/models/beta/beta_response_item.rb @@ -850,12 +850,44 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @return [Symbol, :image_generation_call] required :type, const: :image_generation_call + # @!attribute action + # The action used for image generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Action, nil] + optional( + :action, + enum: -> { + OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action + }, + nil?: true + ) + # @!attribute agent # The agent that produced this item. # # @return [OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Agent, nil] optional :agent, -> { OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent }, nil?: true + # @!attribute background + # The background setting used for generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Background, nil] + optional( + :background, + enum: -> { OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background }, + nil?: true + ) + + # @!attribute output_format + # The output format used for generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat, nil] + optional( + :output_format, + enum: -> { OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat }, + nil?: true + ) + # @!attribute quality # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. @@ -869,13 +901,19 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) + # @!attribute revised_prompt + # The prompt that was used after any model prompt rewriting. + # + # @return [String, nil] + optional :revised_prompt, String, nil?: true + # @!attribute size # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # # @return [String, Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Size, nil] optional :size, union: -> { OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Size }, nil?: true - # @!method initialize(id:, result:, status:, agent: nil, quality: nil, size: nil, type: :image_generation_call) + # @!method initialize(id:, result:, status:, action: nil, agent: nil, background: nil, output_format: nil, quality: nil, revised_prompt: nil, size: nil, type: :image_generation_call) # An image generation request made by the model. # # @param id [String] @@ -887,13 +925,25 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @param status [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Status] # The status of the image generation call. # + # @param action [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Action, nil] + # The action used for image generation. + # # @param agent [OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Agent, nil] # The agent that produced this item. # + # @param background [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Background, nil] + # The background setting used for generation. + # + # @param output_format [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat, nil] + # The output format used for generation. + # # @param quality [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Quality, nil] # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # + # @param revised_prompt [String, nil] + # The prompt that was used after any model prompt rewriting. + # # @param size [String, Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Size, nil] # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -915,6 +965,20 @@ module Status # @return [Array] end + # The action used for image generation. + # + # @see OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall#action + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE = :generate + EDIT = :edit + AUTO = :auto + + # @!method self.values + # @return [Array] + end + # @see OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall#agent class Agent < OpenAI::Internal::Type::BaseModel # @!attribute agent_name @@ -930,6 +994,34 @@ class Agent < OpenAI::Internal::Type::BaseModel # The canonical name of the agent that produced this item. end + # The background setting used for generation. + # + # @see OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall#background + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT = :transparent + OPAQUE = :opaque + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The output format used for generation. + # + # @see OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall#output_format + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG = :png + WEBP = :webp + JPEG = :jpeg + + # @!method self.values + # @return [Array] + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # diff --git a/lib/openai/models/beta/beta_response_output_item.rb b/lib/openai/models/beta/beta_response_output_item.rb index 29a5ae0db..1a1f21d27 100644 --- a/lib/openai/models/beta/beta_response_output_item.rb +++ b/lib/openai/models/beta/beta_response_output_item.rb @@ -849,12 +849,42 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @return [Symbol, :image_generation_call] required :type, const: :image_generation_call + # @!attribute action + # The action used for image generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Action, nil] + optional( + :action, + enum: -> { OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action }, + nil?: true + ) + # @!attribute agent # The agent that produced this item. # # @return [OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent, nil] optional :agent, -> { OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent }, nil?: true + # @!attribute background + # The background setting used for generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Background, nil] + optional( + :background, + enum: -> { OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background }, + nil?: true + ) + + # @!attribute output_format + # The output format used for generation. + # + # @return [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat, nil] + optional( + :output_format, + enum: -> { OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat }, + nil?: true + ) + # @!attribute quality # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. @@ -866,6 +896,12 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) + # @!attribute revised_prompt + # The prompt that was used after any model prompt rewriting. + # + # @return [String, nil] + optional :revised_prompt, String, nil?: true + # @!attribute size # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -878,7 +914,7 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) - # @!method initialize(id:, result:, status:, agent: nil, quality: nil, size: nil, type: :image_generation_call) + # @!method initialize(id:, result:, status:, action: nil, agent: nil, background: nil, output_format: nil, quality: nil, revised_prompt: nil, size: nil, type: :image_generation_call) # An image generation request made by the model. # # @param id [String] @@ -890,13 +926,25 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @param status [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Status] # The status of the image generation call. # + # @param action [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Action, nil] + # The action used for image generation. + # # @param agent [OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent, nil] # The agent that produced this item. # + # @param background [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Background, nil] + # The background setting used for generation. + # + # @param output_format [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat, nil] + # The output format used for generation. + # # @param quality [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Quality, nil] # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # + # @param revised_prompt [String, nil] + # The prompt that was used after any model prompt rewriting. + # # @param size [String, Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Size, nil] # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -918,6 +966,20 @@ module Status # @return [Array] end + # The action used for image generation. + # + # @see OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall#action + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE = :generate + EDIT = :edit + AUTO = :auto + + # @!method self.values + # @return [Array] + end + # @see OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall#agent class Agent < OpenAI::Internal::Type::BaseModel # @!attribute agent_name @@ -933,6 +995,34 @@ class Agent < OpenAI::Internal::Type::BaseModel # The canonical name of the agent that produced this item. end + # The background setting used for generation. + # + # @see OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall#background + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT = :transparent + OPAQUE = :opaque + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The output format used for generation. + # + # @see OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall#output_format + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG = :png + WEBP = :webp + JPEG = :jpeg + + # @!method self.values + # @return [Array] + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # diff --git a/lib/openai/models/conversations/conversation_item.rb b/lib/openai/models/conversations/conversation_item.rb index 9d4d4298b..1c512e50e 100644 --- a/lib/openai/models/conversations/conversation_item.rb +++ b/lib/openai/models/conversations/conversation_item.rb @@ -126,6 +126,36 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @return [Symbol, :image_generation_call] required :type, const: :image_generation_call + # @!attribute action + # The action used for image generation. + # + # @return [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Action, nil] + optional( + :action, + enum: -> { OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action }, + nil?: true + ) + + # @!attribute background + # The background setting used for generation. + # + # @return [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Background, nil] + optional( + :background, + enum: -> { OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background }, + nil?: true + ) + + # @!attribute output_format + # The output format used for generation. + # + # @return [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::OutputFormat, nil] + optional( + :output_format, + enum: -> { OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat }, + nil?: true + ) + # @!attribute quality # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. @@ -137,6 +167,12 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) + # @!attribute revised_prompt + # The prompt that was used after any model prompt rewriting. + # + # @return [String, nil] + optional :revised_prompt, String, nil?: true + # @!attribute size # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -147,7 +183,7 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) - # @!method initialize(id:, result:, status:, quality: nil, size: nil, type: :image_generation_call) + # @!method initialize(id:, result:, status:, action: nil, background: nil, output_format: nil, quality: nil, revised_prompt: nil, size: nil, type: :image_generation_call) # An image generation request made by the model. # # @param id [String] @@ -159,10 +195,22 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @param status [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Status] # The status of the image generation call. # + # @param action [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Action, nil] + # The action used for image generation. + # + # @param background [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Background, nil] + # The background setting used for generation. + # + # @param output_format [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::OutputFormat, nil] + # The output format used for generation. + # # @param quality [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Quality, nil] # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # + # @param revised_prompt [String, nil] + # The prompt that was used after any model prompt rewriting. + # # @param size [String, Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Size, nil] # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -184,6 +232,48 @@ module Status # @return [Array] end + # The action used for image generation. + # + # @see OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall#action + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE = :generate + EDIT = :edit + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The background setting used for generation. + # + # @see OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall#background + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT = :transparent + OPAQUE = :opaque + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The output format used for generation. + # + # @see OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall#output_format + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG = :png + WEBP = :webp + JPEG = :jpeg + + # @!method self.values + # @return [Array] + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # diff --git a/lib/openai/models/live/audio_format.rb b/lib/openai/models/live/audio_format.rb new file mode 100644 index 000000000..c37e477ed --- /dev/null +++ b/lib/openai/models/live/audio_format.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + module AudioFormat + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection. + variant :"audio/pcm", -> { OpenAI::Live::AudioFormat::AudioPCM } + + # Raw, mono G.711 μ-law audio for a Live WebSocket connection. + variant :"audio/pcmu", -> { OpenAI::Live::AudioFormat::AudioPCMU } + + # Raw, mono G.711 A-law audio for a Live WebSocket connection. + variant :"audio/pcma", -> { OpenAI::Live::AudioFormat::AudioPCMA } + + class AudioPCM < OpenAI::Internal::Type::BaseModel + # @!attribute rate + # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz. + # + # @return [Integer, OpenAI::Models::Live::AudioFormat::AudioPCM::Rate] + required :rate, enum: -> { OpenAI::Live::AudioFormat::AudioPCM::Rate } + + # @!attribute type + # The audio encoding. Always `audio/pcm`. + # + # @return [Symbol, :"audio/pcm"] + required :type, const: :"audio/pcm" + + # @!method initialize(rate:, type: :"audio/pcm") + # Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection. + # + # @param rate [Integer, OpenAI::Models::Live::AudioFormat::AudioPCM::Rate] + # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz. + # + # @param type [Symbol, :"audio/pcm"] + # The audio encoding. Always `audio/pcm`. + + # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz. + # + # @see OpenAI::Models::Live::AudioFormat::AudioPCM#rate + module Rate + extend OpenAI::Internal::Type::Enum + + RATE_16000 = 16_000 + RATE_24000 = 24_000 + + # @!method self.values + # @return [Array] + end + end + + class AudioPCMU < OpenAI::Internal::Type::BaseModel + # @!attribute rate + # Audio sample rate in hertz. G.711 audio uses 8000 Hz. + # + # @return [Integer] + required :rate, Integer + + # @!attribute type + # The audio encoding. Always `audio/pcmu`. + # + # @return [Symbol, :"audio/pcmu"] + required :type, const: :"audio/pcmu" + + # @!method initialize(rate:, type: :"audio/pcmu") + # Raw, mono G.711 μ-law audio for a Live WebSocket connection. + # + # @param rate [Integer] + # Audio sample rate in hertz. G.711 audio uses 8000 Hz. + # + # @param type [Symbol, :"audio/pcmu"] + # The audio encoding. Always `audio/pcmu`. + end + + class AudioPCMA < OpenAI::Internal::Type::BaseModel + # @!attribute rate + # Audio sample rate in hertz. G.711 audio uses 8000 Hz. + # + # @return [Integer] + required :rate, Integer + + # @!attribute type + # The audio encoding. Always `audio/pcma`. + # + # @return [Symbol, :"audio/pcma"] + required :type, const: :"audio/pcma" + + # @!method initialize(rate:, type: :"audio/pcma") + # Raw, mono G.711 A-law audio for a Live WebSocket connection. + # + # @param rate [Integer] + # Audio sample rate in hertz. G.711 audio uses 8000 Hz. + # + # @param type [Symbol, :"audio/pcma"] + # The audio encoding. Always `audio/pcma`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::AudioFormat::AudioPCM, OpenAI::Models::Live::AudioFormat::AudioPCMU, OpenAI::Models::Live::AudioFormat::AudioPCMA)] + end + end + end +end diff --git a/lib/openai/models/live/built_in_voice.rb b/lib/openai/models/live/built_in_voice.rb new file mode 100644 index 000000000..52f9347d8 --- /dev/null +++ b/lib/openai/models/live/built_in_voice.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # A built-in voice available for Live speech. + module BuiltInVoice + extend OpenAI::Internal::Type::Enum + + ALLOY = :alloy + ASH = :ash + BALLAD = :ballad + BEACON = :beacon + BOSSA = :bossa + CEDAR = :cedar + CINDER = :cinder + CORAL = :coral + DELTA = :delta + ECHO = :echo + GLEAM = :gleam + MARIN = :marin + MERIDIAN = :meridian + QUARTZ = :quartz + RIPPLE = :ripple + SAGE = :sage + SHIMMER = :shimmer + STONE = :stone + TEMPO = :tempo + VERSE = :verse + VESPER = :vesper + WILLOW = :willow + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/openai/models/live/client_config.rb b/lib/openai/models/live/client_config.rb new file mode 100644 index 000000000..849f12823 --- /dev/null +++ b/lib/openai/models/live/client_config.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ClientConfig < OpenAI::Internal::Type::BaseModel + # @!attribute data_channel + # Client and server event permissions for the WebRTC frontend data channel. + # + # @return [OpenAI::Models::Live::DataChannelConfig] + required :data_channel, -> { OpenAI::Live::DataChannelConfig } + + # @!method initialize(data_channel:) + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @param data_channel [OpenAI::Models::Live::DataChannelConfig] + # Client and server event permissions for the WebRTC frontend data channel. + end + end + end +end diff --git a/lib/openai/models/live/client_delegation.rb b/lib/openai/models/live/client_delegation.rb new file mode 100644 index 000000000..3e1b147e1 --- /dev/null +++ b/lib/openai/models/live/client_delegation.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ClientDelegation < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The delegation owner. Always `client` for tasks handled by your application. + # + # @return [Symbol, :client] + required :type, const: :client + + # @!method initialize(type: :client) + # Delegate tasks to your application. The Live session emits delegation events + # that your backend handles. + # + # @param type [Symbol, :client] + # The delegation owner. Always `client` for tasks handled by your application. + end + end + end +end diff --git a/lib/openai/models/live/client_event.rb b/lib/openai/models/live/client_event.rb new file mode 100644 index 000000000..7a25b6dd6 --- /dev/null +++ b/lib/openai/models/live/client_event.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # Client events for Live. Initialize a primary WebSocket with session.start and + # wait for session.started. WebRTC creation already starts the session. Audio + # append is primary WebSocket-only. See the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # before writing frontend instructions and delegation policies. + module ClientEvent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Start a Live session on a primary WebSocket. Send this event before other commands and wait for `session.started`. + variant :"session.start", -> { OpenAI::Live::SessionStartEvent } + + # Update the delegation settings of an active Live session. The server acknowledges accepted changes with `session.updated`. + variant :"session.update", -> { OpenAI::Live::SessionUpdateEvent } + + # Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions send audio over their media transport. + variant :"session.input_audio.append", -> { OpenAI::Live::InputAudioAppendEvent } + + # Mute audio input to the Live model without closing the session. The server acknowledges with `session.input_audio.muted`. + variant :"session.input_audio.mute", -> { OpenAI::Live::InputAudioMuteEvent } + + # Resume audio input to a Live model after muting it. The server acknowledges with `session.input_audio.unmuted`. + variant :"session.input_audio.unmute", -> { OpenAI::Live::InputAudioUnmuteEvent } + + # Append instructions to the Live conversation while it is running, optionally associating them with an existing client delegation. + variant :"session.instructions.append", -> { OpenAI::Live::InstructionsAppendEvent } + + # Provide silent reasoning or progress context to the Live model, optionally for an existing client delegation. + variant :"session.thinking.append", -> { OpenAI::Live::ThinkingAppendEvent } + + # Provide context the Live model can communicate to the user, optionally for an existing client delegation. + variant :"session.commentary.append", -> { OpenAI::Live::CommentaryAppendEvent } + + # Add an input item to the Live session’s Responses backend. Requires Responses delegation; use `response.create` to request a response. + variant :"response.item.create", -> { OpenAI::Live::ResponseItemCreateEvent } + + # Request a response from the Live session’s Responses backend, or continue a delegated response waiting for tool results. Requires Responses delegation. + variant :"response.create", -> { OpenAI::Live::ResponseCreateEvent } + + # Request that the Live session close. The terminal `session.closed` event contains the close reason and final usage. + variant :"session.close", -> { OpenAI::Live::SessionCloseEvent } + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::SessionStartEvent, OpenAI::Models::Live::SessionUpdateEvent, OpenAI::Models::Live::InputAudioAppendEvent, OpenAI::Models::Live::InputAudioMuteEvent, OpenAI::Models::Live::InputAudioUnmuteEvent, OpenAI::Models::Live::InstructionsAppendEvent, OpenAI::Models::Live::ThinkingAppendEvent, OpenAI::Models::Live::CommentaryAppendEvent, OpenAI::Models::Live::ResponseItemCreateEvent, OpenAI::Models::Live::ResponseCreateEvent, OpenAI::Models::Live::SessionCloseEvent)] + end + end + end +end diff --git a/lib/openai/models/live/commentary_append_event.rb b/lib/openai/models/live/commentary_append_event.rb new file mode 100644 index 000000000..442a8ef18 --- /dev/null +++ b/lib/openai/models/live/commentary_append_event.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class CommentaryAppendEvent < OpenAI::Internal::Type::BaseModel + # @!attribute content + # Speakable context for the Live model, limited to 500 tokens. Use this for a + # result the model should communicate; use session.thinking.append for silent + # context. + # + # @return [String] + required :content, String + + # @!attribute delegation_id + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + # + # @return [String, nil] + required :delegation_id, String, nil?: true + + # @!attribute type + # The Live client event type. Always `session.commentary.append`. + # + # @return [Symbol, :"session.commentary.append"] + required :type, const: :"session.commentary.append" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(content:, delegation_id:, event_id: nil, type: :"session.commentary.append") + # Provide context the Live model can communicate to the user, optionally for an + # existing client delegation. + # + # @param content [String] + # Speakable context for the Live model, limited to 500 tokens. Use this for a + # result the model should communicate; use session.thinking.append for silent + # context. + # + # @param delegation_id [String, nil] + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.commentary.append"] + # The Live client event type. Always `session.commentary.append`. + end + end + end +end diff --git a/lib/openai/models/live/commentary_appended_event.rb b/lib/openai/models/live/commentary_appended_event.rb new file mode 100644 index 000000000..858108bf6 --- /dev/null +++ b/lib/openai/models/live/commentary_appended_event.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class CommentaryAppendedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute end_ms + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @return [Integer] + required :end_ms, Integer + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute start_ms + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @return [Integer] + required :start_ms, Integer + + # @!attribute type + # The event type, always `session.commentary.appended`. + # + # @return [Symbol, :"session.commentary.appended"] + required :type, const: :"session.commentary.appended" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(end_ms:, event_id:, start_ms:, client_event_id: nil, type: :"session.commentary.appended") + # Returned when a session.commentary.append command is accepted into the Live + # session timeline. Acknowledges the added commentary without guaranteeing exact + # wording or completed audio playback. + # + # @param end_ms [Integer] + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param start_ms [Integer] + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.commentary.appended"] + # The event type, always `session.commentary.appended`. + end + end + end +end diff --git a/lib/openai/models/live/custom_voice.rb b/lib/openai/models/live/custom_voice.rb new file mode 100644 index 000000000..1dec234ef --- /dev/null +++ b/lib/openai/models/live/custom_voice.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class CustomVoice < OpenAI::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!method initialize(id:) + # @param id [String] + end + end + end +end diff --git a/lib/openai/models/live/data_channel_config.rb b/lib/openai/models/live/data_channel_config.rb new file mode 100644 index 000000000..f20a93129 --- /dev/null +++ b/lib/openai/models/live/data_channel_config.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class DataChannelConfig < OpenAI::Internal::Type::BaseModel + # @!attribute allowed_client_events + # Client event types that the frontend data channel may send. Use 'all' to allow + # every client event; an empty array allows none. Omission preserves the existing + # allow-all behavior. + # + # @return [Symbol, :all, Array, nil] + optional :allowed_client_events, union: -> { OpenAI::Live::DataChannelConfig::AllowedClientEvents } + + # @!attribute allowed_server_events + # Server events that may be sent to the frontend data channel. Use 'all' to allow + # every server event; an empty array allows none. Omission preserves the existing + # allow-all behavior. Responses events use an object with type 'response.event' + # and a response_event selector. + # + # @return [Symbol, :all, Array, nil] + optional :allowed_server_events, union: -> { OpenAI::Live::DataChannelConfig::AllowedServerEvents } + + # @!method initialize(allowed_client_events: nil, allowed_server_events: nil) + # Control which Live events an untrusted WebRTC frontend can send and receive over + # its data channel. These restrictions do not apply to trusted sideband + # connections. + # + # @param allowed_client_events [Symbol, :all, Array] + # Client event types that the frontend data channel may send. Use 'all' to allow + # every client event; an empty array allows none. Omission preserves the existing + # allow-all behavior. + # + # @param allowed_server_events [Symbol, :all, Array] + # Server events that may be sent to the frontend data channel. Use 'all' to allow + # every server event; an empty array allows none. Omission preserves the existing + # allow-all behavior. Responses events use an object with type 'response.event' + # and a response_event selector. + + # Client event types that the frontend data channel may send. Use 'all' to allow + # every client event; an empty array allows none. Omission preserves the existing + # allow-all behavior. + # + # @see OpenAI::Models::Live::DataChannelConfig#allowed_client_events + module AllowedClientEvents + extend OpenAI::Internal::Type::Union + + variant const: :all + + variant -> { OpenAI::Models::Live::DataChannelConfig::AllowedClientEvents::StringArray } + + # @!method self.variants + # @return [Array(Symbol, :all, Array)] + + # @type [OpenAI::Internal::Type::Converter] + StringArray = OpenAI::Internal::Type::ArrayOf[String] + end + + # Server events that may be sent to the frontend data channel. Use 'all' to allow + # every server event; an empty array allows none. Omission preserves the existing + # allow-all behavior. Responses events use an object with type 'response.event' + # and a response_event selector. + # + # @see OpenAI::Models::Live::DataChannelConfig#allowed_server_events + module AllowedServerEvents + extend OpenAI::Internal::Type::Union + + variant const: :all + + variant -> { OpenAI::Models::Live::DataChannelConfig::AllowedServerEvents::ServerEventSelectorArray } + + # @!method self.variants + # @return [Array(Symbol, :all, Array)] + + # @type [OpenAI::Internal::Type::Converter] + ServerEventSelectorArray = OpenAI::Internal::Type::ArrayOf[-> { OpenAI::Live::ServerEventSelector }] + end + end + end + end +end diff --git a/lib/openai/models/live/delegation_created_event.rb b/lib/openai/models/live/delegation_created_event.rb new file mode 100644 index 000000000..63983c3c5 --- /dev/null +++ b/lib/openai/models/live/delegation_created_event.rb @@ -0,0 +1,140 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class DelegationCreatedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delegation + # The delegated work identifier and destination. This object contains metadata, + # not the task text. + # + # @return [OpenAI::Models::Live::DelegationCreatedEvent::Delegation] + required :delegation, -> { OpenAI::Live::DelegationCreatedEvent::Delegation } + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute offset_ms + # The position on the Live session timeline where the delegation was created, in + # milliseconds from the beginning of the session. + # + # @return [Integer] + required :offset_ms, Integer + + # @!attribute type + # The event type, always `session.delegation.created`. + # + # @return [Symbol, :"session.delegation.created"] + required :type, const: :"session.delegation.created" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(delegation:, event_id:, offset_ms:, client_event_id: nil, type: :"session.delegation.created") + # Returned when the Live model delegates work to your application or a Responses + # backend. Contains delegation metadata and the position on the session timeline + # where the work was delegated. + # + # @param delegation [OpenAI::Models::Live::DelegationCreatedEvent::Delegation] + # The delegated work identifier and destination. This object contains metadata, + # not the task text. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param offset_ms [Integer] + # The position on the Live session timeline where the delegation was created, in + # milliseconds from the beginning of the session. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.delegation.created"] + # The event type, always `session.delegation.created`. + + # @see OpenAI::Models::Live::DelegationCreatedEvent#delegation + class Delegation < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The unique ID of the delegation. Use this as delegation_id when replying to + # client-owned work or correlating Responses events. + # + # @return [String] + required :id, String + + # @!attribute target + # Where the Live model delegated the work: `client` for your application, or + # `responses` for the configured Responses backend. + # + # @return [Symbol, OpenAI::Models::Live::DelegationCreatedEvent::Delegation::Target] + required :target, union: -> { OpenAI::Live::DelegationCreatedEvent::Delegation::Target } + + # @!attribute type + # The object type, always `delegation`. + # + # @return [Symbol, :delegation] + required :type, const: :delegation + + # @!attribute response_id + # The ID of the Responses API response associated with a Responses delegation. + # Omitted for client delegations. + # + # @return [String, nil] + optional :response_id, String + + # @!method initialize(id:, target:, response_id: nil, type: :delegation) + # The delegated work identifier and destination. This object contains metadata, + # not the task text. + # + # @param id [String] + # The unique ID of the delegation. Use this as delegation_id when replying to + # client-owned work or correlating Responses events. + # + # @param target [Symbol, OpenAI::Models::Live::DelegationCreatedEvent::Delegation::Target] + # Where the Live model delegated the work: `client` for your application, or + # `responses` for the configured Responses backend. + # + # @param response_id [String] + # The ID of the Responses API response associated with a Responses delegation. + # Omitted for client delegations. + # + # @param type [Symbol, :delegation] + # The object type, always `delegation`. + + # Where the Live model delegated the work: `client` for your application, or + # `responses` for the configured Responses backend. + # + # @see OpenAI::Models::Live::DelegationCreatedEvent::Delegation#target + module Target + extend OpenAI::Internal::Type::Union + + variant const: -> { OpenAI::Models::Live::DelegationCreatedEvent::Delegation::Target::CLIENT } + + variant const: -> { OpenAI::Models::Live::DelegationCreatedEvent::Delegation::Target::RESPONSES } + + # @!method self.variants + # @return [Array(Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { OpenAI::Live::DelegationCreatedEvent::Delegation::Target::TaggedSymbol } + end + + # @!group + + CLIENT = :client + RESPONSES = :responses + + # @!endgroup + end + end + end + end + end +end diff --git a/lib/openai/models/live/error.rb b/lib/openai/models/live/error.rb new file mode 100644 index 000000000..8da551644 --- /dev/null +++ b/lib/openai/models/live/error.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class Error < OpenAI::Internal::Type::BaseModel + # @!attribute code + # A machine-readable code identifying the Live error, such as `unknown_parameter`. + # + # @return [String] + required :code, String + + # @!attribute message + # A human-readable explanation of the Live error. + # + # @return [String] + required :message, String + + # @!attribute type + # The category of error, such as `invalid_request_error` for an invalid Live + # client command. + # + # @return [String] + required :type, String + + # @!attribute client_event_id + # The event_id of the client command that caused the error, when supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!attribute param + # The parameter that caused the error, when applicable, such as `session.voice`. + # + # @return [String, nil] + optional :param, String + + # @!method initialize(code:, message:, type:, client_event_id: nil, param: nil) + # Details of an error encountered by the Live session, including the affected + # parameter or client command when available. + # + # @param code [String] + # A machine-readable code identifying the Live error, such as `unknown_parameter`. + # + # @param message [String] + # A human-readable explanation of the Live error. + # + # @param type [String] + # The category of error, such as `invalid_request_error` for an invalid Live + # client command. + # + # @param client_event_id [String] + # The event_id of the client command that caused the error, when supplied. + # + # @param param [String] + # The parameter that caused the error, when applicable, such as `session.voice`. + end + end + end +end diff --git a/lib/openai/models/live/error_event.rb b/lib/openai/models/live/error_event.rb new file mode 100644 index 000000000..255e9fafa --- /dev/null +++ b/lib/openai/models/live/error_event.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ErrorEvent < OpenAI::Internal::Type::BaseModel + # @!attribute error + # Details of the Live error and the client command that caused it, when known. + # + # @return [OpenAI::Models::Live::Error] + required :error, -> { OpenAI::Live::Error } + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, always `error`. + # + # @return [Symbol, :error] + required :type, const: :error + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(error:, event_id:, client_event_id: nil, type: :error) + # Reports an error in the Live session, such as an invalid client command. Use + # error.client_event_id, when present, to identify the command that caused the + # error. + # + # @param error [OpenAI::Models::Live::Error] + # Details of the Live error and the client command that caused it, when known. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :error] + # The event type, always `error`. + end + end + end +end diff --git a/lib/openai/models/live/fork_client_event.rb b/lib/openai/models/live/fork_client_event.rb new file mode 100644 index 000000000..953f00f99 --- /dev/null +++ b/lib/openai/models/live/fork_client_event.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # Client events for a Live fork WebSocket. First send session.start with an + # overrides object (which may be empty), then wait for session.started before + # sending other commands. The model and conversation are inherited from the stored + # session. + module ForkClientEvent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Start a Live session after connecting to a stored session’s fork WebSocket. Send an empty `session` object to use the stored configuration. + variant :"session.start", -> { OpenAI::Live::ForkSessionStartEvent } + + # Update the delegation settings of an active Live session. The server acknowledges accepted changes with `session.updated`. + variant :"session.update", -> { OpenAI::Live::SessionUpdateEvent } + + # Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions send audio over their media transport. + variant :"session.input_audio.append", -> { OpenAI::Live::InputAudioAppendEvent } + + # Mute audio input to the Live model without closing the session. The server acknowledges with `session.input_audio.muted`. + variant :"session.input_audio.mute", -> { OpenAI::Live::InputAudioMuteEvent } + + # Resume audio input to a Live model after muting it. The server acknowledges with `session.input_audio.unmuted`. + variant :"session.input_audio.unmute", -> { OpenAI::Live::InputAudioUnmuteEvent } + + # Append instructions to the Live conversation while it is running, optionally associating them with an existing client delegation. + variant :"session.instructions.append", -> { OpenAI::Live::InstructionsAppendEvent } + + # Provide silent reasoning or progress context to the Live model, optionally for an existing client delegation. + variant :"session.thinking.append", -> { OpenAI::Live::ThinkingAppendEvent } + + # Provide context the Live model can communicate to the user, optionally for an existing client delegation. + variant :"session.commentary.append", -> { OpenAI::Live::CommentaryAppendEvent } + + # Add an input item to the Live session’s Responses backend. Requires Responses delegation; use `response.create` to request a response. + variant :"response.item.create", -> { OpenAI::Live::ResponseItemCreateEvent } + + # Request a response from the Live session’s Responses backend, or continue a delegated response waiting for tool results. Requires Responses delegation. + variant :"response.create", -> { OpenAI::Live::ResponseCreateEvent } + + # Request that the Live session close. The terminal `session.closed` event contains the close reason and final usage. + variant :"session.close", -> { OpenAI::Live::SessionCloseEvent } + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::ForkSessionStartEvent, OpenAI::Models::Live::SessionUpdateEvent, OpenAI::Models::Live::InputAudioAppendEvent, OpenAI::Models::Live::InputAudioMuteEvent, OpenAI::Models::Live::InputAudioUnmuteEvent, OpenAI::Models::Live::InstructionsAppendEvent, OpenAI::Models::Live::ThinkingAppendEvent, OpenAI::Models::Live::CommentaryAppendEvent, OpenAI::Models::Live::ResponseItemCreateEvent, OpenAI::Models::Live::ResponseCreateEvent, OpenAI::Models::Live::SessionCloseEvent)] + end + end + end +end diff --git a/lib/openai/models/live/fork_server_event.rb b/lib/openai/models/live/fork_server_event.rb new file mode 100644 index 000000000..8ed5a88d9 --- /dev/null +++ b/lib/openai/models/live/fork_server_event.rb @@ -0,0 +1,295 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # Server events for Live. Response lifecycle events are wrapped inside + # response.event; dispatch the nested event by its full type and tolerate new + # response event types. Follow the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # when designing the conversation and delegation policy. + module ForkServerEvent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Returned when a Live session has started. Contains the resolved session configuration, including server defaults. + variant :"session.started", -> { OpenAI::Live::SessionStartedEvent } + + # Returned when a Live session update is accepted. Contains the resolved session configuration after the update. + variant :"session.updated", -> { OpenAI::Live::SessionUpdatedEvent } + + # Returned when a session.input_audio.mute command is accepted. Input audio is no longer sent to the model; sideband audio reflection continues. + variant :"session.input_audio.muted", -> { OpenAI::Live::InputAudioMutedEvent } + + # Returned when a session.input_audio.unmute command is accepted. Input audio is sent to the model again. + variant :"session.input_audio.unmuted", -> { OpenAI::Live::InputAudioUnmutedEvent } + + # Returned when a session.instructions.append command is accepted into the Live session timeline. Acknowledges the appended instructions without guaranteeing that the model has acted on them. + variant :"session.instructions.appended", -> { OpenAI::Live::InstructionsAppendedEvent } + + # Returned when a session.thinking.append command is accepted into the Live session timeline. Acknowledges the added reasoning context without guaranteeing any spoken output. + variant :"session.thinking.appended", -> { OpenAI::Live::ThinkingAppendedEvent } + + # Returned when a session.commentary.append command is accepted into the Live session timeline. Acknowledges the added commentary without guaranteeing exact wording or completed audio playback. + variant :"session.commentary.appended", -> { OpenAI::Live::CommentaryAppendedEvent } + + # Input audio received from the primary transport and reflected to a Live sideband connection before model-input muting. + variant :"session.input_audio.append", -> { OpenAI::Live::ForkServerEvent::SessionInputAudioAppend } + + # An audio chunk generated by the Live model. Decode and play primary WebSocket chunks in delivery order using the configured session audio format. Sideband connections receive reflected output audio with timestamps. + variant :"session.output_audio.delta", -> { OpenAI::Live::OutputAudioDeltaEvent } + + # A transcript fragment for user input audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event. + variant :"session.input_transcript.delta", -> { OpenAI::Live::InputTranscriptDeltaEvent } + + # A transcript fragment for assistant output audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event. + variant :"session.output_transcript.delta", -> { OpenAI::Live::OutputTranscriptDeltaEvent } + + # Returned when the Live model delegates work to your application or a Responses backend. Contains delegation metadata and the position on the session timeline where the work was delegated. + variant :"session.delegation.created", -> { OpenAI::Live::DelegationCreatedEvent } + + # A streaming Responses API event from a backend delegated to by the Live session. Use the outer delegation_id to associate the nested stream with its Live delegation. + variant :"response.event", -> { OpenAI::Live::ResponseEvent } + + # Reports cumulative Live audio usage and, when available, the most recent context-window usage. Delegated Responses token usage is reported separately in response.event events. + variant :"session.usage.updated", -> { OpenAI::Live::SessionUsageUpdatedEvent } + + # Returned after the Live session finishes finalizing, with the close reason, final session snapshot, and cumulative audio usage. A connection closing without this event does not confirm successful finalization. + variant :"session.closed", -> { OpenAI::Live::SessionClosedEvent } + + # Reports an error in the Live session, such as an invalid client command. Use error.client_event_id, when present, to identify the command that caused the error. + variant :error, -> { OpenAI::Live::ErrorEvent } + + # An informational notice about the Live session, such as the event permissions applied to a frontend data channel. + variant :info, -> { OpenAI::Live::InfoEvent } + + # A SIP DTMF keypress received from the caller. Delivered only to sideband observers. + variant :"transport.dtmf.received", -> { OpenAI::Live::ForkServerEvent::TransportDtmfReceived } + + # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to sideband observers; this is not a client command. + variant :"transport.dtmf.send", -> { OpenAI::Live::ForkServerEvent::TransportDtmfSend } + + # The outbound SIP provider leg is ringing or providing early media. Delivered only to sideband observers. + variant :"transport.ringing", -> { OpenAI::Live::ForkServerEvent::TransportRinging } + + # The outbound SIP provider leg answered and media is established. Delivered only to sideband observers. + variant :"transport.answered", -> { OpenAI::Live::ForkServerEvent::TransportAnswered } + + # An asynchronous outbound SIP setup failure. Delivered only to sideband observers. + variant :"transport.failed", -> { OpenAI::Live::ForkServerEvent::TransportFailed } + + class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel + # @!attribute audio + # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, + # reflected to the sideband before model-input muting. This server event uses the + # same audio key as the client command, but is not an acknowledgment of it. + # + # @return [String] + required :audio, String + + # @!attribute type + # The event type, always `session.input_audio.append`. + # + # @return [Symbol, :"session.input_audio.append"] + required :type, const: :"session.input_audio.append" + + # @!method initialize(audio:, type: :"session.input_audio.append") + # Input audio received from the primary transport and reflected to a Live sideband + # connection before model-input muting. + # + # @param audio [String] + # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, + # reflected to the sideband before model-input muting. This server event uses the + # same audio key as the client command, but is not an acknowledgment of it. + # + # @param type [Symbol, :"session.input_audio.append"] + # The event type, always `session.input_audio.append`. + end + + class TransportDtmfReceived < OpenAI::Internal::Type::BaseModel + # @!attribute event + # + # @return [String] + required :event, String + + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.dtmf.received"] + required :type, const: :"transport.dtmf.received" + + # @!method initialize(event:, event_id:, type: :"transport.dtmf.received") + # A SIP DTMF keypress received from the caller. Delivered only to sideband + # observers. + # + # @param event [String] + # @param event_id [String] + # @param type [Symbol, :"transport.dtmf.received"] + end + + class TransportDtmfSend < OpenAI::Internal::Type::BaseModel + # @!attribute event + # + # @return [String] + required :event, String + + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.dtmf.send"] + required :type, const: :"transport.dtmf.send" + + # @!method initialize(event:, event_id:, type: :"transport.dtmf.send") + # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to + # sideband observers; this is not a client command. + # + # @param event [String] + # @param event_id [String] + # @param type [Symbol, :"transport.dtmf.send"] + end + + class TransportRinging < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The canonical Live session ID. + # + # @return [String] + required :session_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.ringing"] + required :type, const: :"transport.ringing" + + # @!method initialize(event_id:, session_id:, type: :"transport.ringing") + # The outbound SIP provider leg is ringing or providing early media. Delivered + # only to sideband observers. + # + # @param event_id [String] + # + # @param session_id [String] + # The canonical Live session ID. + # + # @param type [Symbol, :"transport.ringing"] + end + + class TransportAnswered < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The canonical Live session ID. + # + # @return [String] + required :session_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.answered"] + required :type, const: :"transport.answered" + + # @!method initialize(event_id:, session_id:, type: :"transport.answered") + # The outbound SIP provider leg answered and media is established. Delivered only + # to sideband observers. + # + # @param event_id [String] + # + # @param session_id [String] + # The canonical Live session ID. + # + # @param type [Symbol, :"transport.answered"] + end + + class TransportFailed < OpenAI::Internal::Type::BaseModel + # @!attribute error + # + # @return [OpenAI::Models::Live::ForkServerEvent::TransportFailed::Error] + required :error, -> { OpenAI::Live::ForkServerEvent::TransportFailed::Error } + + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The canonical Live session ID. + # + # @return [String] + required :session_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.failed"] + required :type, const: :"transport.failed" + + # @!method initialize(error:, event_id:, session_id:, type: :"transport.failed") + # An asynchronous outbound SIP setup failure. Delivered only to sideband + # observers. + # + # @param error [OpenAI::Models::Live::ForkServerEvent::TransportFailed::Error] + # + # @param event_id [String] + # + # @param session_id [String] + # The canonical Live session ID. + # + # @param type [Symbol, :"transport.failed"] + + # @see OpenAI::Models::Live::ForkServerEvent::TransportFailed#error + class Error < OpenAI::Internal::Type::BaseModel + # @!attribute code + # The call setup failure code. + # + # @return [String] + required :code, String + + # @!attribute message + # + # @return [String] + required :message, String + + # @!attribute type + # + # @return [Symbol, :call_error] + required :type, const: :call_error + + # @!attribute param + # The parameter related to the error, if any. Empty when no parameter applies. + # + # @return [String, nil] + optional :param, String + + # @!method initialize(code:, message:, param: nil, type: :call_error) + # @param code [String] + # The call setup failure code. + # + # @param message [String] + # + # @param param [String] + # The parameter related to the error, if any. Empty when no parameter applies. + # + # @param type [Symbol, :call_error] + end + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::SessionStartedEvent, OpenAI::Models::Live::SessionUpdatedEvent, OpenAI::Models::Live::InputAudioMutedEvent, OpenAI::Models::Live::InputAudioUnmutedEvent, OpenAI::Models::Live::InstructionsAppendedEvent, OpenAI::Models::Live::ThinkingAppendedEvent, OpenAI::Models::Live::CommentaryAppendedEvent, OpenAI::Models::Live::ForkServerEvent::SessionInputAudioAppend, OpenAI::Models::Live::OutputAudioDeltaEvent, OpenAI::Models::Live::InputTranscriptDeltaEvent, OpenAI::Models::Live::OutputTranscriptDeltaEvent, OpenAI::Models::Live::DelegationCreatedEvent, OpenAI::Models::Live::ResponseEvent, OpenAI::Models::Live::SessionUsageUpdatedEvent, OpenAI::Models::Live::SessionClosedEvent, OpenAI::Models::Live::ErrorEvent, OpenAI::Models::Live::InfoEvent, OpenAI::Models::Live::ForkServerEvent::TransportDtmfReceived, OpenAI::Models::Live::ForkServerEvent::TransportDtmfSend, OpenAI::Models::Live::ForkServerEvent::TransportRinging, OpenAI::Models::Live::ForkServerEvent::TransportAnswered, OpenAI::Models::Live::ForkServerEvent::TransportFailed)] + end + end + end +end diff --git a/lib/openai/models/live/fork_session_config.rb b/lib/openai/models/live/fork_session_config.rb new file mode 100644 index 000000000..bd2074a57 --- /dev/null +++ b/lib/openai/models/live/fork_session_config.rb @@ -0,0 +1,107 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ForkSessionConfig < OpenAI::Internal::Type::BaseModel + # @!attribute audio + # Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and + # must omit this field. + # + # @return [OpenAI::Models::Live::ForkSessionConfig::Audio, nil] + optional :audio, -> { OpenAI::Live::ForkSessionConfig::Audio } + + # @!attribute client + # Frontend data-channel permissions for a WebRTC fork. Omitted permissions inherit + # the stored values. Not supported for WebSocket forks. + # + # @return [OpenAI::Models::Live::ClientConfig, nil] + optional :client, -> { OpenAI::Live::ClientConfig } + + # @!attribute delegation + # Overrides for the stored session’s Responses backend. Only supported when the + # stored session already uses Responses delegation; the delegation type cannot + # change. + # + # @return [OpenAI::Models::Live::ForkSessionConfig::Delegation, nil] + optional :delegation, -> { OpenAI::Live::ForkSessionConfig::Delegation } + + # @!attribute store + # Whether to store the forked session. Omission inherits the stored session's + # setting. + # + # @return [Boolean, nil] + optional :store, OpenAI::Internal::Type::Boolean + + # @!method initialize(audio: nil, client: nil, delegation: nil, store: nil) + # Overrides for a stored session after connecting to the fork WebSocket. An empty + # object inherits the stored configuration; do not supply a new model. + # audio.format applies only to the new WebSocket connection. client overrides are + # only supported for WebRTC forks. + # + # @param audio [OpenAI::Models::Live::ForkSessionConfig::Audio] + # Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and + # must omit this field. + # + # @param client [OpenAI::Models::Live::ClientConfig] + # Frontend data-channel permissions for a WebRTC fork. Omitted permissions inherit + # the stored values. Not supported for WebSocket forks. + # + # @param delegation [OpenAI::Models::Live::ForkSessionConfig::Delegation] + # Overrides for the stored session’s Responses backend. Only supported when the + # stored session already uses Responses delegation; the delegation type cannot + # change. + # + # @param store [Boolean] + # Whether to store the forked session. Omission inherits the stored session's + # setting. + + # @see OpenAI::Models::Live::ForkSessionConfig#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute format_ + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + # + # @return [OpenAI::Models::Live::AudioFormat::AudioPCM, OpenAI::Models::Live::AudioFormat::AudioPCMU, OpenAI::Models::Live::AudioFormat::AudioPCMA, nil] + optional :format_, union: -> { OpenAI::Live::AudioFormat }, api_name: :format + + # @!method initialize(format_: nil) + # Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and + # must omit this field. + # + # @param format_ [OpenAI::Models::Live::AudioFormat::AudioPCM, OpenAI::Models::Live::AudioFormat::AudioPCMU, OpenAI::Models::Live::AudioFormat::AudioPCMA] + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + end + + # @see OpenAI::Models::Live::ForkSessionConfig#delegation + class Delegation < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The delegation owner. Always `responses` for tasks handled by the Responses API. + # + # @return [Symbol, :responses] + required :type, const: :responses + + # @!attribute responses + # Responses backend settings to update. Omitted settings keep their existing + # values. + # + # @return [OpenAI::Models::Live::ResponsesDelegationUpdateConfig, nil] + optional :responses, -> { OpenAI::Live::ResponsesDelegationUpdateConfig } + + # @!method initialize(responses: nil, type: :responses) + # Overrides for the stored session’s Responses backend. Only supported when the + # stored session already uses Responses delegation; the delegation type cannot + # change. + # + # @param responses [OpenAI::Models::Live::ResponsesDelegationUpdateConfig] + # Responses backend settings to update. Omitted settings keep their existing + # values. + # + # @param type [Symbol, :responses] + # The delegation owner. Always `responses` for tasks handled by the Responses API. + end + end + end + end +end diff --git a/lib/openai/models/live/fork_session_start_event.rb b/lib/openai/models/live/fork_session_start_event.rb new file mode 100644 index 000000000..c7db41e86 --- /dev/null +++ b/lib/openai/models/live/fork_session_start_event.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ForkSessionStartEvent < OpenAI::Internal::Type::BaseModel + # @!attribute session + # Overrides for a stored session after connecting to the fork WebSocket. An empty + # object inherits the stored configuration; do not supply a new model. + # audio.format applies only to the new WebSocket connection. client overrides are + # only supported for WebRTC forks. + # + # @return [OpenAI::Models::Live::ForkSessionConfig] + required :session, -> { OpenAI::Live::ForkSessionConfig } + + # @!attribute type + # The Live client event type. Always `session.start`. + # + # @return [Symbol, :"session.start"] + required :type, const: :"session.start" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(session:, event_id: nil, type: :"session.start") + # Start a Live session after connecting to a stored session’s fork WebSocket. Send + # an empty `session` object to use the stored configuration. + # + # @param session [OpenAI::Models::Live::ForkSessionConfig] + # Overrides for a stored session after connecting to the fork WebSocket. An empty + # object inherits the stored configuration; do not supply a new model. + # audio.format applies only to the new WebSocket connection. client overrides are + # only supported for WebRTC forks. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.start"] + # The Live client event type. Always `session.start`. + end + end + end +end diff --git a/lib/openai/models/live/function_tool.rb b/lib/openai/models/live/function_tool.rb new file mode 100644 index 000000000..be048ed47 --- /dev/null +++ b/lib/openai/models/live/function_tool.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class FunctionTool < OpenAI::Internal::Type::BaseModel + # @!attribute name + # The name the delegated Responses model uses when calling this function. + # + # @return [String] + required :name, String + + # @!attribute type + # The tool type. Always `function`. + # + # @return [Symbol, :function] + required :type, const: :function + + # @!attribute description + # What the function does and when the delegated Responses model should call it. + # + # @return [String, nil] + optional :description, String, nil?: true + + # @!attribute parameters + # A JSON Schema object describing the arguments accepted by the function. + # + # @return [Hash{Symbol=>Object}, nil] + optional :parameters, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown], nil?: true + + # @!attribute strict + # Whether the delegated Responses model must follow the function’s parameter + # schema exactly. + # + # @return [Boolean, nil] + optional :strict, OpenAI::Internal::Type::Boolean, nil?: true + + # @!method initialize(name:, description: nil, parameters: nil, strict: nil, type: :function) + # A function tool available to the Responses backend when the Live model delegates + # a task. + # + # @param name [String] + # The name the delegated Responses model uses when calling this function. + # + # @param description [String, nil] + # What the function does and when the delegated Responses model should call it. + # + # @param parameters [Hash{Symbol=>Object}, nil] + # A JSON Schema object describing the arguments accepted by the function. + # + # @param strict [Boolean, nil] + # Whether the delegated Responses model must follow the function’s parameter + # schema exactly. + # + # @param type [Symbol, :function] + # The tool type. Always `function`. + end + end + end +end diff --git a/lib/openai/models/live/info_event.rb b/lib/openai/models/live/info_event.rb new file mode 100644 index 000000000..db12fe3e6 --- /dev/null +++ b/lib/openai/models/live/info_event.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InfoEvent < OpenAI::Internal::Type::BaseModel + # @!attribute code + # A machine-readable code for the notice, such as `data_channel_permissions`. + # + # @return [String] + required :code, String + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute message + # A human-readable explanation of the Live session notice. + # + # @return [String] + required :message, String + + # @!attribute type + # The event type, always `info`. + # + # @return [Symbol, :info] + required :type, const: :info + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(code:, event_id:, message:, client_event_id: nil, type: :info) + # An informational notice about the Live session, such as the event permissions + # applied to a frontend data channel. + # + # @param code [String] + # A machine-readable code for the notice, such as `data_channel_permissions`. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param message [String] + # A human-readable explanation of the Live session notice. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :info] + # The event type, always `info`. + end + end + end +end diff --git a/lib/openai/models/live/initial_item.rb b/lib/openai/models/live/initial_item.rb new file mode 100644 index 000000000..46cd70d09 --- /dev/null +++ b/lib/openai/models/live/initial_item.rb @@ -0,0 +1,419 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # A developer, user, or assistant message supplied as text history before the Live + # session starts. + module InitialItem + extend OpenAI::Internal::Type::Union + + discriminator :role + + # A developer message included in the initial text history of a Live session. + variant :developer, -> { OpenAI::Live::InitialItem::Developer } + + # A user message included in the initial text history of a Live session. + variant :user, -> { OpenAI::Live::InitialItem::User } + + # An assistant message included in the initial text history of a Live session. + variant :assistant, -> { OpenAI::Live::InitialItem::Assistant } + + class Developer < OpenAI::Internal::Type::BaseModel + # @!attribute content + # The message content. Supply exactly one text part for the initial Live + # conversation history. + # + # @return [Array] + required :content, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Live::InitialItem::Developer::Content] } + + # @!attribute role + # The author of this history message. Always `developer`. + # + # @return [Symbol, :developer] + required :role, const: :developer + + # @!attribute id + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + # + # @return [String, nil] + optional :id, String, nil?: true + + # @!attribute status + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::Developer::Status, nil] + optional :status, enum: -> { OpenAI::Live::InitialItem::Developer::Status }, nil?: true + + # @!attribute type + # The history item type. Always `message`. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::Developer::Type, nil] + optional :type, enum: -> { OpenAI::Live::InitialItem::Developer::Type } + + # @!method initialize(content:, id: nil, status: nil, type: nil, role: :developer) + # A developer message included in the initial text history of a Live session. + # + # @param content [Array] + # The message content. Supply exactly one text part for the initial Live + # conversation history. + # + # @param id [String, nil] + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + # + # @param status [Symbol, OpenAI::Models::Live::InitialItem::Developer::Status, nil] + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @param type [Symbol, OpenAI::Models::Live::InitialItem::Developer::Type] + # The history item type. Always `message`. + # + # @param role [Symbol, :developer] + # The author of this history message. Always `developer`. + class Content < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The message text to include in the Live session’s initial conversation history. + # + # @return [String] + required :text, String + + # @!attribute type + # The text content type. Always `input_text`. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::Developer::Content::Type, nil] + optional :type, enum: -> { OpenAI::Live::InitialItem::Developer::Content::Type } + + # @!method initialize(text:, type: nil) + # Text supplied in a developer or user message when starting a Live session. + # + # @param text [String] + # The message text to include in the Live session’s initial conversation history. + # + # @param type [Symbol, OpenAI::Models::Live::InitialItem::Developer::Content::Type] + # The text content type. Always `input_text`. + + # The text content type. Always `input_text`. + # + # @see OpenAI::Models::Live::InitialItem::Developer::Content#type + module Type + extend OpenAI::Internal::Type::Enum + + INPUT_TEXT = :input_text + + # @!method self.values + # @return [Array] + end + end + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @see OpenAI::Models::Live::InitialItem::Developer#status + module Status + extend OpenAI::Internal::Type::Enum + + INCOMPLETE = :incomplete + COMPLETED = :completed + + # @!method self.values + # @return [Array] + end + + # The history item type. Always `message`. + # + # @see OpenAI::Models::Live::InitialItem::Developer#type + module Type + extend OpenAI::Internal::Type::Enum + + MESSAGE = :message + + # @!method self.values + # @return [Array] + end + end + + class User < OpenAI::Internal::Type::BaseModel + # @!attribute content + # The message content. Supply exactly one text part for the initial Live + # conversation history. + # + # @return [Array] + required :content, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Live::InitialItem::User::Content] } + + # @!attribute role + # The author of this history message. Always `user`. + # + # @return [Symbol, :user] + required :role, const: :user + + # @!attribute id + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + # + # @return [String, nil] + optional :id, String, nil?: true + + # @!attribute status + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::User::Status, nil] + optional :status, enum: -> { OpenAI::Live::InitialItem::User::Status }, nil?: true + + # @!attribute type + # The history item type. Always `message`. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::User::Type, nil] + optional :type, enum: -> { OpenAI::Live::InitialItem::User::Type } + + # @!method initialize(content:, id: nil, status: nil, type: nil, role: :user) + # A user message included in the initial text history of a Live session. + # + # @param content [Array] + # The message content. Supply exactly one text part for the initial Live + # conversation history. + # + # @param id [String, nil] + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + # + # @param status [Symbol, OpenAI::Models::Live::InitialItem::User::Status, nil] + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @param type [Symbol, OpenAI::Models::Live::InitialItem::User::Type] + # The history item type. Always `message`. + # + # @param role [Symbol, :user] + # The author of this history message. Always `user`. + class Content < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The message text to include in the Live session’s initial conversation history. + # + # @return [String] + required :text, String + + # @!attribute type + # The text content type. Always `input_text`. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::User::Content::Type, nil] + optional :type, enum: -> { OpenAI::Live::InitialItem::User::Content::Type } + + # @!method initialize(text:, type: nil) + # Text supplied in a developer or user message when starting a Live session. + # + # @param text [String] + # The message text to include in the Live session’s initial conversation history. + # + # @param type [Symbol, OpenAI::Models::Live::InitialItem::User::Content::Type] + # The text content type. Always `input_text`. + + # The text content type. Always `input_text`. + # + # @see OpenAI::Models::Live::InitialItem::User::Content#type + module Type + extend OpenAI::Internal::Type::Enum + + INPUT_TEXT = :input_text + + # @!method self.values + # @return [Array] + end + end + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @see OpenAI::Models::Live::InitialItem::User#status + module Status + extend OpenAI::Internal::Type::Enum + + INCOMPLETE = :incomplete + COMPLETED = :completed + + # @!method self.values + # @return [Array] + end + + # The history item type. Always `message`. + # + # @see OpenAI::Models::Live::InitialItem::User#type + module Type + extend OpenAI::Internal::Type::Enum + + MESSAGE = :message + + # @!method self.values + # @return [Array] + end + end + + class Assistant < OpenAI::Internal::Type::BaseModel + # @!attribute content + # The message content. Supply exactly one text part for the initial Live + # conversation history. + # + # @return [Array] + required( + :content, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::InitialItem::Assistant::Content] } + ) + + # @!attribute role + # The author of this history message. Always `assistant`. + # + # @return [Symbol, :assistant] + required :role, const: :assistant + + # @!attribute id + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + # + # @return [String, nil] + optional :id, String, nil?: true + + # @!attribute status + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::Assistant::Status, nil] + optional :status, enum: -> { OpenAI::Live::InitialItem::Assistant::Status }, nil?: true + + # @!attribute type + # The history item type. Always `message`. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::Assistant::Type, nil] + optional :type, enum: -> { OpenAI::Live::InitialItem::Assistant::Type } + + # @!method initialize(content:, id: nil, status: nil, type: nil, role: :assistant) + # An assistant message included in the initial text history of a Live session. + # + # @param content [Array] + # The message content. Supply exactly one text part for the initial Live + # conversation history. + # + # @param id [String, nil] + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + # + # @param status [Symbol, OpenAI::Models::Live::InitialItem::Assistant::Status, nil] + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @param type [Symbol, OpenAI::Models::Live::InitialItem::Assistant::Type] + # The history item type. Always `message`. + # + # @param role [Symbol, :assistant] + # The author of this history message. Always `assistant`. + + # Assistant text supplied as conversation history when starting a Live session. + module Content + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Assistant text supplied as conversation history when starting a Live session. + variant :text, -> { OpenAI::Live::InitialItem::Assistant::Content::Text } + + # Assistant output text supplied as conversation history when starting a Live session. + variant :output_text, -> { OpenAI::Live::InitialItem::Assistant::Content::OutputText } + + class Text < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The message text to include in the Live session’s initial conversation history. + # + # @return [String] + required :text, String + + # @!attribute type + # The text content type. Always `text`. + # + # @return [Symbol, OpenAI::Models::Live::InitialItem::Assistant::Content::Text::Type, nil] + optional :type, enum: -> { OpenAI::Live::InitialItem::Assistant::Content::Text::Type } + + # @!method initialize(text:, type: nil) + # Assistant text supplied as conversation history when starting a Live session. + # + # @param text [String] + # The message text to include in the Live session’s initial conversation history. + # + # @param type [Symbol, OpenAI::Models::Live::InitialItem::Assistant::Content::Text::Type] + # The text content type. Always `text`. + + # The text content type. Always `text`. + # + # @see OpenAI::Models::Live::InitialItem::Assistant::Content::Text#type + module Type + extend OpenAI::Internal::Type::Enum + + TEXT = :text + + # @!method self.values + # @return [Array] + end + end + + class OutputText < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The message text to include in the Live session’s initial conversation history. + # + # @return [String] + required :text, String + + # @!attribute type + # The text content type. Always `output_text`. + # + # @return [Symbol, :output_text] + required :type, const: :output_text + + # @!method initialize(text:, type: :output_text) + # Assistant output text supplied as conversation history when starting a Live + # session. + # + # @param text [String] + # The message text to include in the Live session’s initial conversation history. + # + # @param type [Symbol, :output_text] + # The text content type. Always `output_text`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::InitialItem::Assistant::Content::Text, OpenAI::Models::Live::InitialItem::Assistant::Content::OutputText)] + end + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + # + # @see OpenAI::Models::Live::InitialItem::Assistant#status + module Status + extend OpenAI::Internal::Type::Enum + + INCOMPLETE = :incomplete + COMPLETED = :completed + + # @!method self.values + # @return [Array] + end + + # The history item type. Always `message`. + # + # @see OpenAI::Models::Live::InitialItem::Assistant#type + module Type + extend OpenAI::Internal::Type::Enum + + MESSAGE = :message + + # @!method self.values + # @return [Array] + end + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::InitialItem::Developer, OpenAI::Models::Live::InitialItem::User, OpenAI::Models::Live::InitialItem::Assistant)] + end + end + end +end diff --git a/lib/openai/models/live/input_audio_append_event.rb b/lib/openai/models/live/input_audio_append_event.rb new file mode 100644 index 000000000..b51b30b9e --- /dev/null +++ b/lib/openai/models/live/input_audio_append_event.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InputAudioAppendEvent < OpenAI::Internal::Type::BaseModel + # @!attribute audio + # Base64-encoded raw audio in the startup-selected format, without a WAV or other + # container header. Primary WebSocket only; media transports use their audio + # track. Audio appends have no acknowledgment. Reflected sideband server events + # reuse this event type and audio key, with no timestamps or event_id; their audio + # is always mono PCM16LE at 24 kHz. + # + # @return [String] + required :audio, String + + # @!attribute type + # The Live client event type. Always `session.input_audio.append`. + # + # @return [Symbol, :"session.input_audio.append"] + required :type, const: :"session.input_audio.append" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(audio:, event_id: nil, type: :"session.input_audio.append") + # Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions + # send audio over their media transport. + # + # @param audio [String] + # Base64-encoded raw audio in the startup-selected format, without a WAV or other + # container header. Primary WebSocket only; media transports use their audio + # track. Audio appends have no acknowledgment. Reflected sideband server events + # reuse this event type and audio key, with no timestamps or event_id; their audio + # is always mono PCM16LE at 24 kHz. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.input_audio.append"] + # The Live client event type. Always `session.input_audio.append`. + end + end + end +end diff --git a/lib/openai/models/live/input_audio_mute_event.rb b/lib/openai/models/live/input_audio_mute_event.rb new file mode 100644 index 000000000..28dea3e0f --- /dev/null +++ b/lib/openai/models/live/input_audio_mute_event.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InputAudioMuteEvent < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The Live client event type. Always `session.input_audio.mute`. + # + # @return [Symbol, :"session.input_audio.mute"] + required :type, const: :"session.input_audio.mute" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(event_id: nil, type: :"session.input_audio.mute") + # Mute audio input to the Live model without closing the session. The server + # acknowledges with `session.input_audio.muted`. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.input_audio.mute"] + # The Live client event type. Always `session.input_audio.mute`. + end + end + end +end diff --git a/lib/openai/models/live/input_audio_muted_event.rb b/lib/openai/models/live/input_audio_muted_event.rb new file mode 100644 index 000000000..29ca79f02 --- /dev/null +++ b/lib/openai/models/live/input_audio_muted_event.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InputAudioMutedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, always `session.input_audio.muted`. + # + # @return [Symbol, :"session.input_audio.muted"] + required :type, const: :"session.input_audio.muted" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(event_id:, client_event_id: nil, type: :"session.input_audio.muted") + # Returned when a session.input_audio.mute command is accepted. Input audio is no + # longer sent to the model; sideband audio reflection continues. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.input_audio.muted"] + # The event type, always `session.input_audio.muted`. + end + end + end +end diff --git a/lib/openai/models/live/input_audio_unmute_event.rb b/lib/openai/models/live/input_audio_unmute_event.rb new file mode 100644 index 000000000..6120ddbcd --- /dev/null +++ b/lib/openai/models/live/input_audio_unmute_event.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InputAudioUnmuteEvent < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The Live client event type. Always `session.input_audio.unmute`. + # + # @return [Symbol, :"session.input_audio.unmute"] + required :type, const: :"session.input_audio.unmute" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(event_id: nil, type: :"session.input_audio.unmute") + # Resume audio input to a Live model after muting it. The server acknowledges with + # `session.input_audio.unmuted`. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.input_audio.unmute"] + # The Live client event type. Always `session.input_audio.unmute`. + end + end + end +end diff --git a/lib/openai/models/live/input_audio_unmuted_event.rb b/lib/openai/models/live/input_audio_unmuted_event.rb new file mode 100644 index 000000000..443e4c8d1 --- /dev/null +++ b/lib/openai/models/live/input_audio_unmuted_event.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InputAudioUnmutedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, always `session.input_audio.unmuted`. + # + # @return [Symbol, :"session.input_audio.unmuted"] + required :type, const: :"session.input_audio.unmuted" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(event_id:, client_event_id: nil, type: :"session.input_audio.unmuted") + # Returned when a session.input_audio.unmute command is accepted. Input audio is + # sent to the model again. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.input_audio.unmuted"] + # The event type, always `session.input_audio.unmuted`. + end + end + end +end diff --git a/lib/openai/models/live/input_transcript_delta_event.rb b/lib/openai/models/live/input_transcript_delta_event.rb new file mode 100644 index 000000000..13edb43e8 --- /dev/null +++ b/lib/openai/models/live/input_transcript_delta_event.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delta + # The transcript text fragment for the audio in this time range. Append fragments + # in delivery order to build the transcript. + # + # @return [String] + required :delta, String + + # @!attribute end_ms + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @return [Integer] + required :end_ms, Integer + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute start_ms + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @return [Integer] + required :start_ms, Integer + + # @!attribute type + # The event type, always `session.input_transcript.delta`. + # + # @return [Symbol, :"session.input_transcript.delta"] + required :type, const: :"session.input_transcript.delta" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(delta:, end_ms:, event_id:, start_ms:, client_event_id: nil, type: :"session.input_transcript.delta") + # A transcript fragment for user input audio in the Live session. Accumulate + # fragments in delivery order; these events do not define complete turns or + # include a transcript-done event. + # + # @param delta [String] + # The transcript text fragment for the audio in this time range. Append fragments + # in delivery order to build the transcript. + # + # @param end_ms [Integer] + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param start_ms [Integer] + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.input_transcript.delta"] + # The event type, always `session.input_transcript.delta`. + end + end + end +end diff --git a/lib/openai/models/live/instructions_append_event.rb b/lib/openai/models/live/instructions_append_event.rb new file mode 100644 index 000000000..dbaceaf96 --- /dev/null +++ b/lib/openai/models/live/instructions_append_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InstructionsAppendEvent < OpenAI::Internal::Type::BaseModel + # @!attribute content + # Instruction text to append, limited to 500 tokens. This is a plain string, not + # an array of content parts. + # + # @return [String] + required :content, String + + # @!attribute delegation_id + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + # + # @return [String, nil] + required :delegation_id, String, nil?: true + + # @!attribute type + # The Live client event type. Always `session.instructions.append`. + # + # @return [Symbol, :"session.instructions.append"] + required :type, const: :"session.instructions.append" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(content:, delegation_id:, event_id: nil, type: :"session.instructions.append") + # Append instructions to the Live conversation while it is running, optionally + # associating them with an existing client delegation. + # + # @param content [String] + # Instruction text to append, limited to 500 tokens. This is a plain string, not + # an array of content parts. + # + # @param delegation_id [String, nil] + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.instructions.append"] + # The Live client event type. Always `session.instructions.append`. + end + end + end +end diff --git a/lib/openai/models/live/instructions_appended_event.rb b/lib/openai/models/live/instructions_appended_event.rb new file mode 100644 index 000000000..9e18dc667 --- /dev/null +++ b/lib/openai/models/live/instructions_appended_event.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class InstructionsAppendedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute end_ms + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @return [Integer] + required :end_ms, Integer + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute start_ms + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @return [Integer] + required :start_ms, Integer + + # @!attribute type + # The event type, always `session.instructions.appended`. + # + # @return [Symbol, :"session.instructions.appended"] + required :type, const: :"session.instructions.appended" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(end_ms:, event_id:, start_ms:, client_event_id: nil, type: :"session.instructions.appended") + # Returned when a session.instructions.append command is accepted into the Live + # session timeline. Acknowledges the appended instructions without guaranteeing + # that the model has acted on them. + # + # @param end_ms [Integer] + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param start_ms [Integer] + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.instructions.appended"] + # The event type, always `session.instructions.appended`. + end + end + end +end diff --git a/lib/openai/models/live/live_create_params.rb b/lib/openai/models/live/live_create_params.rb new file mode 100644 index 000000000..b953f9a5d --- /dev/null +++ b/lib/openai/models/live/live_create_params.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live#create + class LiveCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session + # Startup configuration for the Live session. + # + # @return [OpenAI::Models::Live::MediaSessionConfig] + required :session, -> { OpenAI::Live::MediaSessionConfig } + + # @!attribute transport + # WebRTC transport with the browser's SDP offer. + # + # @return [OpenAI::Models::Live::LiveCreateParams::Transport] + required :transport, -> { OpenAI::Live::LiveCreateParams::Transport } + + # @!method initialize(session:, transport:, request_options: {}) + # @param session [OpenAI::Models::Live::MediaSessionConfig] + # Startup configuration for the Live session. + # + # @param transport [OpenAI::Models::Live::LiveCreateParams::Transport] + # WebRTC transport with the browser's SDP offer. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + class Transport < OpenAI::Internal::Type::BaseModel + # @!attribute sdp + # Session Description Protocol message for the WebRTC connection. + # + # @return [String] + required :sdp, String + + # @!attribute type + # The transport used for the Live session. Always `webrtc`. + # + # @return [Symbol, :webrtc] + required :type, const: :webrtc + + # @!method initialize(sdp:, type: :webrtc) + # WebRTC transport with the browser's SDP offer. + # + # @param sdp [String] + # Session Description Protocol message for the WebRTC connection. + # + # @param type [Symbol, :webrtc] + # The transport used for the Live session. Always `webrtc`. + end + end + end + end +end diff --git a/lib/openai/models/live/live_create_response.rb b/lib/openai/models/live/live_create_response.rb new file mode 100644 index 000000000..e11b31c9b --- /dev/null +++ b/lib/openai/models/live/live_create_response.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live#create + class LiveCreateResponse < OpenAI::Internal::Type::BaseModel + # @!attribute session + # The newly created Live session. Use its ID for session controls and sideband + # connections. + # + # @return [OpenAI::Models::Live::LiveCreateResponse::Session] + required :session, -> { OpenAI::Models::Live::LiveCreateResponse::Session } + + # @!attribute transport + # WebRTC transport with the SDP answer. + # + # @return [OpenAI::Models::Live::LiveCreateResponse::Transport] + required :transport, -> { OpenAI::Models::Live::LiveCreateResponse::Transport } + + # @!method initialize(session:, transport:) + # The created Live session identifier and WebRTC answer. Apply transport.sdp as + # the peer's remote answer and wait for session.started on the data channel before + # sending commands. + # + # @param session [OpenAI::Models::Live::LiveCreateResponse::Session] + # The newly created Live session. Use its ID for session controls and sideband + # connections. + # + # @param transport [OpenAI::Models::Live::LiveCreateResponse::Transport] + # WebRTC transport with the SDP answer. + + # @see OpenAI::Models::Live::LiveCreateResponse#session + class Session < OpenAI::Internal::Type::BaseModel + # @!attribute id + # Opaque session identifier. Preserve the returned value unchanged, including its + # prefix. + # + # @return [String] + required :id, String + + # @!method initialize(id:) + # The newly created Live session. Use its ID for session controls and sideband + # connections. + # + # @param id [String] + # Opaque session identifier. Preserve the returned value unchanged, including its + # prefix. + end + + # @see OpenAI::Models::Live::LiveCreateResponse#transport + class Transport < OpenAI::Internal::Type::BaseModel + # @!attribute sdp + # Session Description Protocol message for the WebRTC connection. + # + # @return [String] + required :sdp, String + + # @!attribute type + # The transport used for the Live session. Always `webrtc`. + # + # @return [Symbol, :webrtc] + required :type, const: :webrtc + + # @!method initialize(sdp:, type: :webrtc) + # WebRTC transport with the SDP answer. + # + # @param sdp [String] + # Session Description Protocol message for the WebRTC connection. + # + # @param type [Symbol, :webrtc] + # The transport used for the Live session. Always `webrtc`. + end + end + end + end +end diff --git a/lib/openai/models/live/media_session_config.rb b/lib/openai/models/live/media_session_config.rb new file mode 100644 index 000000000..e26eba0b2 --- /dev/null +++ b/lib/openai/models/live/media_session_config.rb @@ -0,0 +1,227 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class MediaSessionConfig < OpenAI::Internal::Type::BaseModel + # @!attribute model + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @return [String, Symbol, OpenAI::Models::Live::MediaSessionConfig::Model] + required :model, union: -> { OpenAI::Live::MediaSessionConfig::Model } + + # @!attribute audio + # Startup audio configuration. WebRTC and SIP negotiate their audio format on the + # media transport. + # + # @return [OpenAI::Models::Live::MediaSessionConfig::Audio, nil] + optional :audio, -> { OpenAI::Live::MediaSessionConfig::Audio } + + # @!attribute client + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @return [OpenAI::Models::Live::ClientConfig, nil] + optional :client, -> { OpenAI::Live::ClientConfig } + + # @!attribute delegation + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @return [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::MediaSessionConfig::Delegation::Responses, nil] + optional :delegation, union: -> { OpenAI::Live::MediaSessionConfig::Delegation }, nil?: true + + # @!attribute input + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + # + # @return [Array, nil] + optional :input, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::InitialItem] } + + # @!attribute instructions + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute store + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + # + # @return [Boolean, nil] + optional :store, OpenAI::Internal::Type::Boolean + + # @!method initialize(model:, audio: nil, client: nil, delegation: nil, input: nil, instructions: nil, store: nil) + # Startup configuration for a Live media session. Follow the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # when writing frontend instructions and the backend prompt under + # delegation.responses.instructions. + # + # @param model [String, Symbol, OpenAI::Models::Live::MediaSessionConfig::Model] + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @param audio [OpenAI::Models::Live::MediaSessionConfig::Audio] + # Startup audio configuration. WebRTC and SIP negotiate their audio format on the + # media transport. + # + # @param client [OpenAI::Models::Live::ClientConfig] + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @param delegation [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::MediaSessionConfig::Delegation::Responses, nil] + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @param input [Array] + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + # + # @param instructions [String, nil] + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + # + # @param store [Boolean] + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @see OpenAI::Models::Live::MediaSessionConfig#model + module Model + extend OpenAI::Internal::Type::Union + + variant String + + variant const: -> { OpenAI::Models::Live::MediaSessionConfig::Model::GPT_LIVE_1 } + + # @!method self.variants + # @return [Array(String, Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { T.any(String, OpenAI::Live::MediaSessionConfig::Model::TaggedSymbol) } + end + + # @!group + + GPT_LIVE_1 = :"gpt-live-1" + + # @!endgroup + end + + # @see OpenAI::Models::Live::MediaSessionConfig#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute output + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + # + # @return [OpenAI::Models::Live::MediaSessionConfig::Audio::Output, nil] + optional :output, -> { OpenAI::Live::MediaSessionConfig::Audio::Output } + + # @!method initialize(output: nil) + # Startup audio configuration. WebRTC and SIP negotiate their audio format on the + # media transport. + # + # @param output [OpenAI::Models::Live::MediaSessionConfig::Audio::Output] + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + + # @see OpenAI::Models::Live::MediaSessionConfig::Audio#output + class Output < OpenAI::Internal::Type::BaseModel + # @!attribute voice + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + # + # @return [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice, nil] + optional :voice, union: -> { OpenAI::Live::MediaSessionConfig::Audio::Output::Voice } + + # @!method initialize(voice: nil) + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + # + # @param voice [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice] + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + # + # @see OpenAI::Models::Live::MediaSessionConfig::Audio::Output#voice + module Voice + extend OpenAI::Internal::Type::Union + + variant String + + # A built-in voice available for Live speech. + variant enum: -> { OpenAI::Live::BuiltInVoice } + + variant -> { OpenAI::Live::CustomVoice } + + # @!method self.variants + # @return [Array(String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice)] + end + end + end + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @see OpenAI::Models::Live::MediaSessionConfig#delegation + module Delegation + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Delegate tasks to your application. The Live session emits delegation events that your backend handles. + variant :client, -> { OpenAI::Live::ClientDelegation } + + # Delegate tasks to a Responses model managed by the Live session. + variant :responses, -> { OpenAI::Live::MediaSessionConfig::Delegation::Responses } + + class Responses < OpenAI::Internal::Type::BaseModel + # @!attribute responses + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + # + # @return [OpenAI::Models::Live::ResponsesDelegationConfig] + required :responses, -> { OpenAI::Live::ResponsesDelegationConfig } + + # @!attribute type + # The delegation owner. Always `responses` for tasks handled by the Responses API. + # + # @return [Symbol, :responses] + required :type, const: :responses + + # @!method initialize(responses:, type: :responses) + # Delegate tasks to a Responses model managed by the Live session. + # + # @param responses [OpenAI::Models::Live::ResponsesDelegationConfig] + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + # + # @param type [Symbol, :responses] + # The delegation owner. Always `responses` for tasks handled by the Responses API. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::MediaSessionConfig::Delegation::Responses)] + end + end + end + end +end diff --git a/lib/openai/models/live/media_session_fork_config.rb b/lib/openai/models/live/media_session_fork_config.rb new file mode 100644 index 000000000..7951e66de --- /dev/null +++ b/lib/openai/models/live/media_session_fork_config.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class MediaSessionForkConfig < OpenAI::Internal::Type::BaseModel + # @!attribute client + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @return [OpenAI::Models::Live::ClientConfig, nil] + optional :client, -> { OpenAI::Live::ClientConfig } + + # @!attribute delegation + # Update the Responses backend for an existing Live session without changing + # delegation ownership. + # + # @return [OpenAI::Models::Live::MediaSessionForkConfig::Delegation, nil] + optional :delegation, -> { OpenAI::Live::MediaSessionForkConfig::Delegation } + + # @!attribute store + # Whether to store the forked session. Omission inherits the stored session's + # setting. + # + # @return [Boolean, nil] + optional :store, OpenAI::Internal::Type::Boolean + + # @!method initialize(client: nil, delegation: nil, store: nil) + # Optional overrides for a stored Live session. Omitted settings are inherited. + # The model, voice, frontend instructions, and prior conversation come from the + # stored session. WebRTC negotiates its audio format; audio.format is only + # supported on WebSocket forks. + # + # @param client [OpenAI::Models::Live::ClientConfig] + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @param delegation [OpenAI::Models::Live::MediaSessionForkConfig::Delegation] + # Update the Responses backend for an existing Live session without changing + # delegation ownership. + # + # @param store [Boolean] + # Whether to store the forked session. Omission inherits the stored session's + # setting. + + # @see OpenAI::Models::Live::MediaSessionForkConfig#delegation + class Delegation < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The delegation owner. Always `responses` for tasks handled by the Responses API. + # + # @return [Symbol, :responses] + required :type, const: :responses + + # @!attribute responses + # Responses backend settings to update. Omitted settings keep their existing + # values. + # + # @return [OpenAI::Models::Live::ResponsesDelegationUpdateConfig, nil] + optional :responses, -> { OpenAI::Live::ResponsesDelegationUpdateConfig } + + # @!method initialize(responses: nil, type: :responses) + # Update the Responses backend for an existing Live session without changing + # delegation ownership. + # + # @param responses [OpenAI::Models::Live::ResponsesDelegationUpdateConfig] + # Responses backend settings to update. Omitted settings keep their existing + # values. + # + # @param type [Symbol, :responses] + # The delegation owner. Always `responses` for tasks handled by the Responses API. + end + end + end + end +end diff --git a/lib/openai/models/live/output_audio_delta_event.rb b/lib/openai/models/live/output_audio_delta_event.rb new file mode 100644 index 000000000..8fd9a6307 --- /dev/null +++ b/lib/openai/models/live/output_audio_delta_event.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class OutputAudioDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delta + # Base64-encoded raw audio. Primary WebSocket events use the session's configured + # format; reflected sideband events use mono PCM16LE at 24 kHz. + # + # @return [String] + required :delta, String + + # @!attribute type + # The event type, always `session.output_audio.delta`. + # + # @return [Symbol, :"session.output_audio.delta"] + required :type, const: :"session.output_audio.delta" + + # @!attribute end_ms + # Exclusive session-relative end in milliseconds. Required on reflected sideband + # events; omitted on the primary WebSocket. Dropped output frames leave gaps + # between reflected ranges. + # + # @return [Integer, nil] + optional :end_ms, Integer + + # @!attribute start_ms + # Inclusive session-relative start in milliseconds. Required on reflected sideband + # events; omitted on the primary WebSocket. + # + # @return [Integer, nil] + optional :start_ms, Integer + + # @!method initialize(delta:, end_ms: nil, start_ms: nil, type: :"session.output_audio.delta") + # An audio chunk generated by the Live model. Decode and play primary WebSocket + # chunks in delivery order using the configured session audio format. Sideband + # connections receive reflected output audio with timestamps. + # + # @param delta [String] + # Base64-encoded raw audio. Primary WebSocket events use the session's configured + # format; reflected sideband events use mono PCM16LE at 24 kHz. + # + # @param end_ms [Integer] + # Exclusive session-relative end in milliseconds. Required on reflected sideband + # events; omitted on the primary WebSocket. Dropped output frames leave gaps + # between reflected ranges. + # + # @param start_ms [Integer] + # Inclusive session-relative start in milliseconds. Required on reflected sideband + # events; omitted on the primary WebSocket. + # + # @param type [Symbol, :"session.output_audio.delta"] + # The event type, always `session.output_audio.delta`. + end + end + end +end diff --git a/lib/openai/models/live/output_transcript_delta_event.rb b/lib/openai/models/live/output_transcript_delta_event.rb new file mode 100644 index 000000000..a3c7c29b1 --- /dev/null +++ b/lib/openai/models/live/output_transcript_delta_event.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class OutputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delta + # The transcript text fragment for the audio in this time range. Append fragments + # in delivery order to build the transcript. + # + # @return [String] + required :delta, String + + # @!attribute end_ms + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @return [Integer] + required :end_ms, Integer + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute start_ms + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @return [Integer] + required :start_ms, Integer + + # @!attribute type + # The event type, always `session.output_transcript.delta`. + # + # @return [Symbol, :"session.output_transcript.delta"] + required :type, const: :"session.output_transcript.delta" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(delta:, end_ms:, event_id:, start_ms:, client_event_id: nil, type: :"session.output_transcript.delta") + # A transcript fragment for assistant output audio in the Live session. Accumulate + # fragments in delivery order; these events do not define complete turns or + # include a transcript-done event. + # + # @param delta [String] + # The transcript text fragment for the audio in this time range. Append fragments + # in delivery order to build the transcript. + # + # @param end_ms [Integer] + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param start_ms [Integer] + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.output_transcript.delta"] + # The event type, always `session.output_transcript.delta`. + end + end + end +end diff --git a/lib/openai/models/live/response_create_event.rb b/lib/openai/models/live/response_create_event.rb new file mode 100644 index 000000000..772a7c110 --- /dev/null +++ b/lib/openai/models/live/response_create_event.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ResponseCreateEvent < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The Live client event type. Always `response.create`. + # + # @return [Symbol, :"response.create"] + required :type, const: :"response.create" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(event_id: nil, type: :"response.create") + # Request a response from the Live session’s Responses backend, or continue a + # delegated response waiting for tool results. Requires Responses delegation. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"response.create"] + # The Live client event type. Always `response.create`. + end + end + end +end diff --git a/lib/openai/models/live/response_event.rb b/lib/openai/models/live/response_event.rb new file mode 100644 index 000000000..0136d4a13 --- /dev/null +++ b/lib/openai/models/live/response_event.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ResponseEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event + # The nested Responses streaming event. Dispatch on its type field. Response + # lifecycle snapshots omit input and clear instructions, tools, and output to keep + # messages small; consume granular output events for the generated content. + # + # @return [Hash{Symbol=>Object}] + required :event, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, always `response.event`. + # + # @return [Symbol, :"response.event"] + required :type, const: :"response.event" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!attribute delegation_id + # The Live delegation associated with the nested Responses event. May be null or + # omitted when the event cannot be correlated with a delegation. + # + # @return [String, nil] + optional :delegation_id, String, nil?: true + + # @!method initialize(event:, event_id:, client_event_id: nil, delegation_id: nil, type: :"response.event") + # A streaming Responses API event from a backend delegated to by the Live session. + # Use the outer delegation_id to associate the nested stream with its Live + # delegation. + # + # @param event [Hash{Symbol=>Object}] + # The nested Responses streaming event. Dispatch on its type field. Response + # lifecycle snapshots omit input and clear instructions, tools, and output to keep + # messages small; consume granular output events for the generated content. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param delegation_id [String, nil] + # The Live delegation associated with the nested Responses event. May be null or + # omitted when the event cannot be correlated with a delegation. + # + # @param type [Symbol, :"response.event"] + # The event type, always `response.event`. + end + end + end +end diff --git a/lib/openai/models/live/response_item_create_event.rb b/lib/openai/models/live/response_item_create_event.rb new file mode 100644 index 000000000..50a4624ba --- /dev/null +++ b/lib/openai/models/live/response_item_create_event.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ResponseItemCreateEvent < OpenAI::Internal::Type::BaseModel + # @!attribute item + # An input item to append to the Responses backend conversation, such as a user + # message or a function tool result. + # + # @return [OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseConfigurationUpdateItemParam, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput] + required :item, union: -> { OpenAI::Responses::ResponseInputItem } + + # @!attribute type + # The Live client event type. Always `response.item.create`. + # + # @return [Symbol, :"response.item.create"] + required :type, const: :"response.item.create" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(item:, event_id: nil, type: :"response.item.create") + # Add an input item to the Live session’s Responses backend. Requires Responses + # delegation; use `response.create` to request a response. + # + # @param item [OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseConfigurationUpdateItemParam, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput] + # An input item to append to the Responses backend conversation, such as a user + # message or a function tool result. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"response.item.create"] + # The Live client event type. Always `response.item.create`. + end + end + end +end diff --git a/lib/openai/models/live/responses_delegation_config.rb b/lib/openai/models/live/responses_delegation_config.rb new file mode 100644 index 000000000..fe722ed00 --- /dev/null +++ b/lib/openai/models/live/responses_delegation_config.rb @@ -0,0 +1,332 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ResponsesDelegationConfig < OpenAI::Internal::Type::BaseModel + # @!attribute model + # The model used for server-owned Responses delegations. + # + # @return [String] + required :model, String + + # @!attribute instructions + # Instructions for the delegated Responses model, separate from Live instructions. + # See + # [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute max_output_tokens + # Maximum number of output tokens for each delegated response. + # + # @return [Integer, nil] + optional :max_output_tokens, Integer, nil?: true + + # @!attribute parallel_tool_calls + # Whether the delegated Responses model may request multiple tool calls in a + # single response. + # + # @return [Boolean, nil] + optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean, nil?: true + + # @!attribute reasoning + # Reasoning settings passed to each delegated Responses request. + # + # @return [OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning, nil] + optional :reasoning, -> { OpenAI::Live::ResponsesDelegationConfig::Reasoning }, nil?: true + + # @!attribute service_tier + # Service tier for delegated Responses requests. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::ServiceTier, nil] + optional :service_tier, enum: -> { OpenAI::Live::ResponsesDelegationConfig::ServiceTier }, nil?: true + + # @!attribute text + # Text generation settings passed to each delegated Responses request. + # + # @return [OpenAI::Models::Live::ResponsesDelegationConfig::Text, nil] + optional :text, -> { OpenAI::Live::ResponsesDelegationConfig::Text }, nil?: true + + # @!attribute tool_choice + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam, nil] + optional :tool_choice, union: -> { OpenAI::Live::ResponsesDelegationConfig::ToolChoice } + + # @!attribute tools + # Tools available to the Responses backend while it handles tasks delegated by the + # Live model. + # + # @return [Array, nil] + optional( + :tools, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::ResponsesDelegationConfig::Tool] } + ) + + # @!method initialize(model:, instructions: nil, max_output_tokens: nil, parallel_tool_calls: nil, reasoning: nil, service_tier: nil, text: nil, tool_choice: nil, tools: nil) + # Model, prompt, and tool settings for tasks delegated by the Live session to a + # Responses backend. + # + # @param model [String] + # The model used for server-owned Responses delegations. + # + # @param instructions [String, nil] + # Instructions for the delegated Responses model, separate from Live instructions. + # See + # [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # + # @param max_output_tokens [Integer, nil] + # Maximum number of output tokens for each delegated response. + # + # @param parallel_tool_calls [Boolean, nil] + # Whether the delegated Responses model may request multiple tool calls in a + # single response. + # + # @param reasoning [OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning, nil] + # Reasoning settings passed to each delegated Responses request. + # + # @param service_tier [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::ServiceTier, nil] + # Service tier for delegated Responses requests. + # + # @param text [OpenAI::Models::Live::ResponsesDelegationConfig::Text, nil] + # Text generation settings passed to each delegated Responses request. + # + # @param tool_choice [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam] + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + # + # @param tools [Array] + # Tools available to the Responses backend while it handles tasks delegated by the + # Live model. + + # @see OpenAI::Models::Live::ResponsesDelegationConfig#reasoning + class Reasoning < OpenAI::Internal::Type::BaseModel + # @!attribute effort + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::Effort, nil] + optional( + :effort, + enum: -> { + OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort + }, + nil?: true + ) + + # @!attribute summary + # The reasoning summary to request from the delegated Responses model, when + # supported. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::Summary, nil] + optional( + :summary, + enum: -> { + OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary + }, + nil?: true + ) + + # @!method initialize(effort: nil, summary: nil) + # Reasoning settings passed to each delegated Responses request. + # + # @param effort [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::Effort, nil] + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + # + # @param summary [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::Summary, nil] + # The reasoning summary to request from the delegated Responses model, when + # supported. + + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + # + # @see OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning#effort + module Effort + extend OpenAI::Internal::Type::Enum + + NONE = :none + MINIMAL = :minimal + LOW = :low + MEDIUM = :medium + HIGH = :high + XHIGH = :xhigh + + # @!method self.values + # @return [Array] + end + + # The reasoning summary to request from the delegated Responses model, when + # supported. + # + # @see OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning#summary + module Summary + extend OpenAI::Internal::Type::Enum + + CONCISE = :concise + DETAILED = :detailed + AUTO = :auto + + # @!method self.values + # @return [Array] + end + end + + # Service tier for delegated Responses requests. + # + # @see OpenAI::Models::Live::ResponsesDelegationConfig#service_tier + module ServiceTier + extend OpenAI::Internal::Type::Enum + + AUTO = :auto + DEFAULT = :default + FAST_TIER_TEMP_PILOT = :fast_tier_temp_pilot + FLEX = :flex + PRIORITY = :priority + ULTRAFAST = :ultrafast + + # @!method self.values + # @return [Array] + end + + # @see OpenAI::Models::Live::ResponsesDelegationConfig#text + class Text < OpenAI::Internal::Type::BaseModel + # @!attribute verbosity + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::Text::Verbosity, nil] + optional( + :verbosity, + enum: -> { + OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity + }, + nil?: true + ) + + # @!method initialize(verbosity: nil) + # Text generation settings passed to each delegated Responses request. + # + # @param verbosity [Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::Text::Verbosity, nil] + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + # + # @see OpenAI::Models::Live::ResponsesDelegationConfig::Text#verbosity + module Verbosity + extend OpenAI::Internal::Type::Enum + + LOW = :low + MEDIUM = :medium + HIGH = :high + + # @!method self.values + # @return [Array] + end + end + + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + # + # @see OpenAI::Models::Live::ResponsesDelegationConfig#tool_choice + module ToolChoice + extend OpenAI::Internal::Type::Union + + variant enum: -> { OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum } + + variant -> { OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam } + + variant -> { OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam } + + module LiveToolChoiceEnum + extend OpenAI::Internal::Type::Enum + + AUTO = :auto + NONE = :none + REQUIRED = :required + + # @!method self.values + # @return [Array] + end + + class LiveFunctionToolChoiceParam < OpenAI::Internal::Type::BaseModel + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute type + # + # @return [Symbol, :function] + required :type, const: :function + + # @!method initialize(name:, type: :function) + # @param name [String] + # @param type [Symbol, :function] + end + + class LiveMCPToolChoiceParam < OpenAI::Internal::Type::BaseModel + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute server_label + # + # @return [String] + required :server_label, String + + # @!attribute type + # + # @return [Symbol, :mcp] + required :type, const: :mcp + + # @!method initialize(name:, server_label:, type: :mcp) + # @param name [String] + # @param server_label [String] + # @param type [Symbol, :mcp] + end + + # @!method self.variants + # @return [Array(Symbol, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam, OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam)] + end + + # A function tool available to the Responses backend when the Live model delegates + # a task. + module Tool + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A function tool available to the Responses backend when the Live model delegates a task. + variant :function, -> { OpenAI::Live::FunctionTool } + + # A web search tool available to the Live session’s Responses backend. + variant :web_search, -> { OpenAI::Live::ResponsesDelegationConfig::Tool::WebSearch } + + class WebSearch < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The tool type. Always `web_search`. + # + # @return [Symbol, :web_search] + required :type, const: :web_search + + # @!method initialize(type: :web_search) + # A web search tool available to the Live session’s Responses backend. + # + # @param type [Symbol, :web_search] + # The tool type. Always `web_search`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::FunctionTool, OpenAI::Models::Live::ResponsesDelegationConfig::Tool::WebSearch)] + end + end + end + end +end diff --git a/lib/openai/models/live/responses_delegation_update_config.rb b/lib/openai/models/live/responses_delegation_update_config.rb new file mode 100644 index 000000000..22c33a003 --- /dev/null +++ b/lib/openai/models/live/responses_delegation_update_config.rb @@ -0,0 +1,332 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ResponsesDelegationUpdateConfig < OpenAI::Internal::Type::BaseModel + # @!attribute instructions + # Instructions for the delegated Responses model, separate from Live instructions. + # See + # [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute max_output_tokens + # Maximum number of output tokens for each delegated response. + # + # @return [Integer, nil] + optional :max_output_tokens, Integer, nil?: true + + # @!attribute model + # The Responses backend model to use for subsequent delegated requests. Omit to + # keep the current backend model. + # + # @return [String, nil] + optional :model, String + + # @!attribute parallel_tool_calls + # Whether the delegated Responses model may request multiple tool calls in a + # single response. + # + # @return [Boolean, nil] + optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean, nil?: true + + # @!attribute reasoning + # Reasoning settings passed to each delegated Responses request. + # + # @return [OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning, nil] + optional :reasoning, -> { OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning }, nil?: true + + # @!attribute service_tier + # Service tier for delegated Responses requests. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ServiceTier, nil] + optional( + :service_tier, + enum: -> { OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier }, + nil?: true + ) + + # @!attribute text + # Text generation settings passed to each delegated Responses request. + # + # @return [OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text, nil] + optional :text, -> { OpenAI::Live::ResponsesDelegationUpdateConfig::Text }, nil?: true + + # @!attribute tool_choice + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam, nil] + optional :tool_choice, union: -> { OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice } + + # @!attribute tools + # Tools available to the Responses backend while it handles tasks delegated by the + # Live model. + # + # @return [Array, nil] + optional( + :tools, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::ResponsesDelegationUpdateConfig::Tool] } + ) + + # @!method initialize(instructions: nil, max_output_tokens: nil, model: nil, parallel_tool_calls: nil, reasoning: nil, service_tier: nil, text: nil, tool_choice: nil, tools: nil) + # Updates to the Responses backend of an existing Live session. Omitted settings + # retain their current values. + # + # @param instructions [String, nil] + # Instructions for the delegated Responses model, separate from Live instructions. + # See + # [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # + # @param max_output_tokens [Integer, nil] + # Maximum number of output tokens for each delegated response. + # + # @param model [String] + # The Responses backend model to use for subsequent delegated requests. Omit to + # keep the current backend model. + # + # @param parallel_tool_calls [Boolean, nil] + # Whether the delegated Responses model may request multiple tool calls in a + # single response. + # + # @param reasoning [OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning, nil] + # Reasoning settings passed to each delegated Responses request. + # + # @param service_tier [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ServiceTier, nil] + # Service tier for delegated Responses requests. + # + # @param text [OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text, nil] + # Text generation settings passed to each delegated Responses request. + # + # @param tool_choice [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam] + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + # + # @param tools [Array] + # Tools available to the Responses backend while it handles tasks delegated by the + # Live model. + + # @see OpenAI::Models::Live::ResponsesDelegationUpdateConfig#reasoning + class Reasoning < OpenAI::Internal::Type::BaseModel + # @!attribute effort + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort, nil] + optional( + :effort, + enum: -> { OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort }, + nil?: true + ) + + # @!attribute summary + # The reasoning summary to request from the delegated Responses model, when + # supported. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary, nil] + optional( + :summary, + enum: -> { OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary }, + nil?: true + ) + + # @!method initialize(effort: nil, summary: nil) + # Reasoning settings passed to each delegated Responses request. + # + # @param effort [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort, nil] + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + # + # @param summary [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary, nil] + # The reasoning summary to request from the delegated Responses model, when + # supported. + + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + # + # @see OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning#effort + module Effort + extend OpenAI::Internal::Type::Enum + + NONE = :none + MINIMAL = :minimal + LOW = :low + MEDIUM = :medium + HIGH = :high + XHIGH = :xhigh + + # @!method self.values + # @return [Array] + end + + # The reasoning summary to request from the delegated Responses model, when + # supported. + # + # @see OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning#summary + module Summary + extend OpenAI::Internal::Type::Enum + + CONCISE = :concise + DETAILED = :detailed + AUTO = :auto + + # @!method self.values + # @return [Array] + end + end + + # Service tier for delegated Responses requests. + # + # @see OpenAI::Models::Live::ResponsesDelegationUpdateConfig#service_tier + module ServiceTier + extend OpenAI::Internal::Type::Enum + + AUTO = :auto + DEFAULT = :default + FAST_TIER_TEMP_PILOT = :fast_tier_temp_pilot + FLEX = :flex + PRIORITY = :priority + ULTRAFAST = :ultrafast + + # @!method self.values + # @return [Array] + end + + # @see OpenAI::Models::Live::ResponsesDelegationUpdateConfig#text + class Text < OpenAI::Internal::Type::BaseModel + # @!attribute verbosity + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + # + # @return [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text::Verbosity, nil] + optional( + :verbosity, + enum: -> { OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity }, + nil?: true + ) + + # @!method initialize(verbosity: nil) + # Text generation settings passed to each delegated Responses request. + # + # @param verbosity [Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text::Verbosity, nil] + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + # + # @see OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text#verbosity + module Verbosity + extend OpenAI::Internal::Type::Enum + + LOW = :low + MEDIUM = :medium + HIGH = :high + + # @!method self.values + # @return [Array] + end + end + + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + # + # @see OpenAI::Models::Live::ResponsesDelegationUpdateConfig#tool_choice + module ToolChoice + extend OpenAI::Internal::Type::Union + + variant enum: -> { OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum } + + variant -> { OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam } + + variant -> { OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam } + + module LiveToolChoiceEnum + extend OpenAI::Internal::Type::Enum + + AUTO = :auto + NONE = :none + REQUIRED = :required + + # @!method self.values + # @return [Array] + end + + class LiveFunctionToolChoiceParam < OpenAI::Internal::Type::BaseModel + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute type + # + # @return [Symbol, :function] + required :type, const: :function + + # @!method initialize(name:, type: :function) + # @param name [String] + # @param type [Symbol, :function] + end + + class LiveMCPToolChoiceParam < OpenAI::Internal::Type::BaseModel + # @!attribute name + # + # @return [String] + required :name, String + + # @!attribute server_label + # + # @return [String] + required :server_label, String + + # @!attribute type + # + # @return [Symbol, :mcp] + required :type, const: :mcp + + # @!method initialize(name:, server_label:, type: :mcp) + # @param name [String] + # @param server_label [String] + # @param type [Symbol, :mcp] + end + + # @!method self.variants + # @return [Array(Symbol, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam)] + end + + # A function tool available to the Responses backend when the Live model delegates + # a task. + module Tool + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A function tool available to the Responses backend when the Live model delegates a task. + variant :function, -> { OpenAI::Live::FunctionTool } + + # A web search tool available to the Live session’s Responses backend. + variant :web_search, -> { OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch } + + class WebSearch < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The tool type. Always `web_search`. + # + # @return [Symbol, :web_search] + required :type, const: :web_search + + # @!method initialize(type: :web_search) + # A web search tool available to the Live session’s Responses backend. + # + # @param type [Symbol, :web_search] + # The tool type. Always `web_search`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::FunctionTool, OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch)] + end + end + end + end +end diff --git a/lib/openai/models/live/server_event.rb b/lib/openai/models/live/server_event.rb new file mode 100644 index 000000000..b57a99440 --- /dev/null +++ b/lib/openai/models/live/server_event.rb @@ -0,0 +1,295 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # Server events for Live. Response lifecycle events are wrapped inside + # response.event; dispatch the nested event by its full type and tolerate new + # response event types. Follow the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # when designing the conversation and delegation policy. + module ServerEvent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Returned when a Live session has started. Contains the resolved session configuration, including server defaults. + variant :"session.started", -> { OpenAI::Live::SessionStartedEvent } + + # Returned when a Live session update is accepted. Contains the resolved session configuration after the update. + variant :"session.updated", -> { OpenAI::Live::SessionUpdatedEvent } + + # Returned when a session.input_audio.mute command is accepted. Input audio is no longer sent to the model; sideband audio reflection continues. + variant :"session.input_audio.muted", -> { OpenAI::Live::InputAudioMutedEvent } + + # Returned when a session.input_audio.unmute command is accepted. Input audio is sent to the model again. + variant :"session.input_audio.unmuted", -> { OpenAI::Live::InputAudioUnmutedEvent } + + # Returned when a session.instructions.append command is accepted into the Live session timeline. Acknowledges the appended instructions without guaranteeing that the model has acted on them. + variant :"session.instructions.appended", -> { OpenAI::Live::InstructionsAppendedEvent } + + # Returned when a session.thinking.append command is accepted into the Live session timeline. Acknowledges the added reasoning context without guaranteeing any spoken output. + variant :"session.thinking.appended", -> { OpenAI::Live::ThinkingAppendedEvent } + + # Returned when a session.commentary.append command is accepted into the Live session timeline. Acknowledges the added commentary without guaranteeing exact wording or completed audio playback. + variant :"session.commentary.appended", -> { OpenAI::Live::CommentaryAppendedEvent } + + # Input audio received from the primary transport and reflected to a Live sideband connection before model-input muting. + variant :"session.input_audio.append", -> { OpenAI::Live::ServerEvent::SessionInputAudioAppend } + + # An audio chunk generated by the Live model. Decode and play primary WebSocket chunks in delivery order using the configured session audio format. Sideband connections receive reflected output audio with timestamps. + variant :"session.output_audio.delta", -> { OpenAI::Live::OutputAudioDeltaEvent } + + # A transcript fragment for user input audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event. + variant :"session.input_transcript.delta", -> { OpenAI::Live::InputTranscriptDeltaEvent } + + # A transcript fragment for assistant output audio in the Live session. Accumulate fragments in delivery order; these events do not define complete turns or include a transcript-done event. + variant :"session.output_transcript.delta", -> { OpenAI::Live::OutputTranscriptDeltaEvent } + + # Returned when the Live model delegates work to your application or a Responses backend. Contains delegation metadata and the position on the session timeline where the work was delegated. + variant :"session.delegation.created", -> { OpenAI::Live::DelegationCreatedEvent } + + # A streaming Responses API event from a backend delegated to by the Live session. Use the outer delegation_id to associate the nested stream with its Live delegation. + variant :"response.event", -> { OpenAI::Live::ResponseEvent } + + # Reports cumulative Live audio usage and, when available, the most recent context-window usage. Delegated Responses token usage is reported separately in response.event events. + variant :"session.usage.updated", -> { OpenAI::Live::SessionUsageUpdatedEvent } + + # Returned after the Live session finishes finalizing, with the close reason, final session snapshot, and cumulative audio usage. A connection closing without this event does not confirm successful finalization. + variant :"session.closed", -> { OpenAI::Live::SessionClosedEvent } + + # Reports an error in the Live session, such as an invalid client command. Use error.client_event_id, when present, to identify the command that caused the error. + variant :error, -> { OpenAI::Live::ErrorEvent } + + # An informational notice about the Live session, such as the event permissions applied to a frontend data channel. + variant :info, -> { OpenAI::Live::InfoEvent } + + # A SIP DTMF keypress received from the caller. Delivered only to sideband observers. + variant :"transport.dtmf.received", -> { OpenAI::Live::ServerEvent::TransportDtmfReceived } + + # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to sideband observers; this is not a client command. + variant :"transport.dtmf.send", -> { OpenAI::Live::ServerEvent::TransportDtmfSend } + + # The outbound SIP provider leg is ringing or providing early media. Delivered only to sideband observers. + variant :"transport.ringing", -> { OpenAI::Live::ServerEvent::TransportRinging } + + # The outbound SIP provider leg answered and media is established. Delivered only to sideband observers. + variant :"transport.answered", -> { OpenAI::Live::ServerEvent::TransportAnswered } + + # An asynchronous outbound SIP setup failure. Delivered only to sideband observers. + variant :"transport.failed", -> { OpenAI::Live::ServerEvent::TransportFailed } + + class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel + # @!attribute audio + # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, + # reflected to the sideband before model-input muting. This server event uses the + # same audio key as the client command, but is not an acknowledgment of it. + # + # @return [String] + required :audio, String + + # @!attribute type + # The event type, always `session.input_audio.append`. + # + # @return [Symbol, :"session.input_audio.append"] + required :type, const: :"session.input_audio.append" + + # @!method initialize(audio:, type: :"session.input_audio.append") + # Input audio received from the primary transport and reflected to a Live sideband + # connection before model-input muting. + # + # @param audio [String] + # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, + # reflected to the sideband before model-input muting. This server event uses the + # same audio key as the client command, but is not an acknowledgment of it. + # + # @param type [Symbol, :"session.input_audio.append"] + # The event type, always `session.input_audio.append`. + end + + class TransportDtmfReceived < OpenAI::Internal::Type::BaseModel + # @!attribute event + # + # @return [String] + required :event, String + + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.dtmf.received"] + required :type, const: :"transport.dtmf.received" + + # @!method initialize(event:, event_id:, type: :"transport.dtmf.received") + # A SIP DTMF keypress received from the caller. Delivered only to sideband + # observers. + # + # @param event [String] + # @param event_id [String] + # @param type [Symbol, :"transport.dtmf.received"] + end + + class TransportDtmfSend < OpenAI::Internal::Type::BaseModel + # @!attribute event + # + # @return [String] + required :event, String + + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.dtmf.send"] + required :type, const: :"transport.dtmf.send" + + # @!method initialize(event:, event_id:, type: :"transport.dtmf.send") + # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to + # sideband observers; this is not a client command. + # + # @param event [String] + # @param event_id [String] + # @param type [Symbol, :"transport.dtmf.send"] + end + + class TransportRinging < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The canonical Live session ID. + # + # @return [String] + required :session_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.ringing"] + required :type, const: :"transport.ringing" + + # @!method initialize(event_id:, session_id:, type: :"transport.ringing") + # The outbound SIP provider leg is ringing or providing early media. Delivered + # only to sideband observers. + # + # @param event_id [String] + # + # @param session_id [String] + # The canonical Live session ID. + # + # @param type [Symbol, :"transport.ringing"] + end + + class TransportAnswered < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The canonical Live session ID. + # + # @return [String] + required :session_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.answered"] + required :type, const: :"transport.answered" + + # @!method initialize(event_id:, session_id:, type: :"transport.answered") + # The outbound SIP provider leg answered and media is established. Delivered only + # to sideband observers. + # + # @param event_id [String] + # + # @param session_id [String] + # The canonical Live session ID. + # + # @param type [Symbol, :"transport.answered"] + end + + class TransportFailed < OpenAI::Internal::Type::BaseModel + # @!attribute error + # + # @return [OpenAI::Models::Live::ServerEvent::TransportFailed::Error] + required :error, -> { OpenAI::Live::ServerEvent::TransportFailed::Error } + + # @!attribute event_id + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The canonical Live session ID. + # + # @return [String] + required :session_id, String + + # @!attribute type + # + # @return [Symbol, :"transport.failed"] + required :type, const: :"transport.failed" + + # @!method initialize(error:, event_id:, session_id:, type: :"transport.failed") + # An asynchronous outbound SIP setup failure. Delivered only to sideband + # observers. + # + # @param error [OpenAI::Models::Live::ServerEvent::TransportFailed::Error] + # + # @param event_id [String] + # + # @param session_id [String] + # The canonical Live session ID. + # + # @param type [Symbol, :"transport.failed"] + + # @see OpenAI::Models::Live::ServerEvent::TransportFailed#error + class Error < OpenAI::Internal::Type::BaseModel + # @!attribute code + # The call setup failure code. + # + # @return [String] + required :code, String + + # @!attribute message + # + # @return [String] + required :message, String + + # @!attribute type + # + # @return [Symbol, :call_error] + required :type, const: :call_error + + # @!attribute param + # The parameter related to the error, if any. Empty when no parameter applies. + # + # @return [String, nil] + optional :param, String + + # @!method initialize(code:, message:, param: nil, type: :call_error) + # @param code [String] + # The call setup failure code. + # + # @param message [String] + # + # @param param [String] + # The parameter related to the error, if any. Empty when no parameter applies. + # + # @param type [Symbol, :call_error] + end + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::SessionStartedEvent, OpenAI::Models::Live::SessionUpdatedEvent, OpenAI::Models::Live::InputAudioMutedEvent, OpenAI::Models::Live::InputAudioUnmutedEvent, OpenAI::Models::Live::InstructionsAppendedEvent, OpenAI::Models::Live::ThinkingAppendedEvent, OpenAI::Models::Live::CommentaryAppendedEvent, OpenAI::Models::Live::ServerEvent::SessionInputAudioAppend, OpenAI::Models::Live::OutputAudioDeltaEvent, OpenAI::Models::Live::InputTranscriptDeltaEvent, OpenAI::Models::Live::OutputTranscriptDeltaEvent, OpenAI::Models::Live::DelegationCreatedEvent, OpenAI::Models::Live::ResponseEvent, OpenAI::Models::Live::SessionUsageUpdatedEvent, OpenAI::Models::Live::SessionClosedEvent, OpenAI::Models::Live::ErrorEvent, OpenAI::Models::Live::InfoEvent, OpenAI::Models::Live::ServerEvent::TransportDtmfReceived, OpenAI::Models::Live::ServerEvent::TransportDtmfSend, OpenAI::Models::Live::ServerEvent::TransportRinging, OpenAI::Models::Live::ServerEvent::TransportAnswered, OpenAI::Models::Live::ServerEvent::TransportFailed)] + end + end + end +end diff --git a/lib/openai/models/live/server_event_selector.rb b/lib/openai/models/live/server_event_selector.rb new file mode 100644 index 000000000..68126bfa1 --- /dev/null +++ b/lib/openai/models/live/server_event_selector.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ServerEventSelector < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The outer Live server event type. Use 'response.event' for Responses events. + # + # @return [String] + required :type, String + + # @!attribute response_event + # The nested Responses event type. Required when type is 'response.event'; + # forbidden for other event types. + # + # @return [String, nil] + optional :response_event, String + + # @!method initialize(type:, response_event: nil) + # A Live server event selector for the WebRTC frontend data channel. + # + # @param type [String] + # The outer Live server event type. Use 'response.event' for Responses events. + # + # @param response_event [String] + # The nested Responses event type. Required when type is 'response.event'; + # forbidden for other event types. + end + end + end +end diff --git a/lib/openai/models/live/session_accept_params.rb b/lib/openai/models/live/session_accept_params.rb new file mode 100644 index 000000000..95617fcf3 --- /dev/null +++ b/lib/openai/models/live/session_accept_params.rb @@ -0,0 +1,257 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live::Sessions#accept + class SessionAcceptParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute session + # Model and startup configuration for the Live session that answers the incoming + # SIP call. + # + # @return [OpenAI::Models::Live::SessionAcceptParams::Session] + required :session, -> { OpenAI::Live::SessionAcceptParams::Session } + + # @!method initialize(session_id:, session:, request_options: {}) + # @param session_id [String] + # + # @param session [OpenAI::Models::Live::SessionAcceptParams::Session] + # Model and startup configuration for the Live session that answers the incoming + # SIP call. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + class Session < OpenAI::Internal::Type::BaseModel + # @!attribute model + # The Live model to use for the accepted call. + # + # @return [String, Symbol, OpenAI::Models::Live::SessionAcceptParams::Session::Model] + required :model, union: -> { OpenAI::Live::SessionAcceptParams::Session::Model } + + # @!attribute type + # The session type. Always `live`. + # + # @return [Symbol, :live] + required :type, const: :live + + # @!attribute audio + # Startup audio output configuration. SIP negotiates the media format; + # audio.format is only accepted for primary WebSockets. Voice cannot change after + # startup. + # + # @return [OpenAI::Models::Live::SessionAcceptParams::Session::Audio, nil] + optional :audio, -> { OpenAI::Live::SessionAcceptParams::Session::Audio } + + # @!attribute delegation + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @return [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Responses, nil] + optional( + :delegation, + union: -> { + OpenAI::Live::SessionAcceptParams::Session::Delegation + }, + nil?: true + ) + + # @!attribute input + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + # + # @return [Array, nil] + optional :input, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::InitialItem] } + + # @!attribute instructions + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute store + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + # + # @return [Boolean, nil] + optional :store, OpenAI::Internal::Type::Boolean + + # @!method initialize(model:, audio: nil, delegation: nil, input: nil, instructions: nil, store: nil, type: :live) + # Model and startup configuration for the Live session that answers the incoming + # SIP call. + # + # @param model [String, Symbol, OpenAI::Models::Live::SessionAcceptParams::Session::Model] + # The Live model to use for the accepted call. + # + # @param audio [OpenAI::Models::Live::SessionAcceptParams::Session::Audio] + # Startup audio output configuration. SIP negotiates the media format; + # audio.format is only accepted for primary WebSockets. Voice cannot change after + # startup. + # + # @param delegation [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Responses, nil] + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @param input [Array] + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + # + # @param instructions [String, nil] + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + # + # @param store [Boolean] + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + # + # @param type [Symbol, :live] + # The session type. Always `live`. + + # The Live model to use for the accepted call. + # + # @see OpenAI::Models::Live::SessionAcceptParams::Session#model + module Model + extend OpenAI::Internal::Type::Union + + variant String + + # The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter. + variant const: -> { OpenAI::Models::Live::SessionAcceptParams::Session::Model::GPT_LIVE_1 } + + # @!method self.variants + # @return [Array(String, Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { T.any(String, OpenAI::Live::SessionAcceptParams::Session::Model::TaggedSymbol) } + end + + # @!group + + GPT_LIVE_1 = :"gpt-live-1" + + # @!endgroup + end + + # @see OpenAI::Models::Live::SessionAcceptParams::Session#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute output + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + # + # @return [OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output, nil] + optional :output, -> { OpenAI::Live::SessionAcceptParams::Session::Audio::Output } + + # @!method initialize(output: nil) + # Startup audio output configuration. SIP negotiates the media format; + # audio.format is only accepted for primary WebSockets. Voice cannot change after + # startup. + # + # @param output [OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output] + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + + # @see OpenAI::Models::Live::SessionAcceptParams::Session::Audio#output + class Output < OpenAI::Internal::Type::BaseModel + # @!attribute voice + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + # + # @return [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice, nil] + optional :voice, union: -> { OpenAI::Live::SessionAcceptParams::Session::Audio::Output::Voice } + + # @!method initialize(voice: nil) + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + # + # @param voice [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice] + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + # + # @see OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output#voice + module Voice + extend OpenAI::Internal::Type::Union + + variant String + + # A built-in voice available for Live speech. + variant enum: -> { OpenAI::Live::BuiltInVoice } + + variant -> { OpenAI::Live::CustomVoice } + + # @!method self.variants + # @return [Array(String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice)] + end + end + end + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @see OpenAI::Models::Live::SessionAcceptParams::Session#delegation + module Delegation + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Delegate tasks to your application. The Live session emits delegation events that your backend handles. + variant :client, -> { OpenAI::Live::ClientDelegation } + + # Delegate tasks to a Responses model managed by the Live session. + variant :responses, -> { OpenAI::Live::SessionAcceptParams::Session::Delegation::Responses } + + class Responses < OpenAI::Internal::Type::BaseModel + # @!attribute responses + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + # + # @return [OpenAI::Models::Live::ResponsesDelegationConfig] + required :responses, -> { OpenAI::Live::ResponsesDelegationConfig } + + # @!attribute type + # The delegation owner. Always `responses` for tasks handled by the Responses API. + # + # @return [Symbol, :responses] + required :type, const: :responses + + # @!method initialize(responses:, type: :responses) + # Delegate tasks to a Responses model managed by the Live session. + # + # @param responses [OpenAI::Models::Live::ResponsesDelegationConfig] + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + # + # @param type [Symbol, :responses] + # The delegation owner. Always `responses` for tasks handled by the Responses API. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Responses)] + end + end + end + end + end +end diff --git a/lib/openai/models/live/session_close_event.rb b/lib/openai/models/live/session_close_event.rb new file mode 100644 index 000000000..426702e62 --- /dev/null +++ b/lib/openai/models/live/session_close_event.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionCloseEvent < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The Live client event type. Always `session.close`. + # + # @return [Symbol, :"session.close"] + required :type, const: :"session.close" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(event_id: nil, type: :"session.close") + # Request that the Live session close. The terminal `session.closed` event + # contains the close reason and final usage. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.close"] + # The Live client event type. Always `session.close`. + end + end + end +end diff --git a/lib/openai/models/live/session_closed_event.rb b/lib/openai/models/live/session_closed_event.rb new file mode 100644 index 000000000..9c5008bea --- /dev/null +++ b/lib/openai/models/live/session_closed_event.rb @@ -0,0 +1,113 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionClosedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute reason + # Why the Live session ended: `close_requested` for an application close or hangup + # request, `expired` for the session duration limit, `content` for a safety + # filter, `remote_hangup` for a graceful remote disconnect, or `connection_lost` + # for an unexpected primary or upstream disconnection. + # + # @return [Symbol, OpenAI::Models::Live::SessionClosedEvent::Reason] + required :reason, union: -> { OpenAI::Live::SessionClosedEvent::Reason } + + # @!attribute session + # The resolved Live session configuration and server-assigned session metadata. + # + # @return [OpenAI::Models::Live::SessionResource] + required :session, -> { OpenAI::Live::SessionResource } + + # @!attribute type + # The event type, always `session.closed`. + # + # @return [Symbol, :"session.closed"] + required :type, const: :"session.closed" + + # @!attribute usage + # The final cumulative Live audio usage after session finalization. + # + # @return [OpenAI::Models::Live::SessionUsage] + required :usage, -> { OpenAI::Live::SessionUsage } + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(event_id:, reason:, session:, usage:, client_event_id: nil, type: :"session.closed") + # Returned after the Live session finishes finalizing, with the close reason, + # final session snapshot, and cumulative audio usage. A connection closing without + # this event does not confirm successful finalization. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param reason [Symbol, OpenAI::Models::Live::SessionClosedEvent::Reason] + # Why the Live session ended: `close_requested` for an application close or hangup + # request, `expired` for the session duration limit, `content` for a safety + # filter, `remote_hangup` for a graceful remote disconnect, or `connection_lost` + # for an unexpected primary or upstream disconnection. + # + # @param session [OpenAI::Models::Live::SessionResource] + # The resolved Live session configuration and server-assigned session metadata. + # + # @param usage [OpenAI::Models::Live::SessionUsage] + # The final cumulative Live audio usage after session finalization. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.closed"] + # The event type, always `session.closed`. + + # Why the Live session ended: `close_requested` for an application close or hangup + # request, `expired` for the session duration limit, `content` for a safety + # filter, `remote_hangup` for a graceful remote disconnect, or `connection_lost` + # for an unexpected primary or upstream disconnection. + # + # @see OpenAI::Models::Live::SessionClosedEvent#reason + module Reason + extend OpenAI::Internal::Type::Union + + variant const: -> { OpenAI::Models::Live::SessionClosedEvent::Reason::CLOSE_REQUESTED } + + variant const: -> { OpenAI::Models::Live::SessionClosedEvent::Reason::EXPIRED } + + variant const: -> { OpenAI::Models::Live::SessionClosedEvent::Reason::CONTENT } + + variant const: -> { OpenAI::Models::Live::SessionClosedEvent::Reason::REMOTE_HANGUP } + + variant const: -> { OpenAI::Models::Live::SessionClosedEvent::Reason::CONNECTION_LOST } + + # @!method self.variants + # @return [Array(Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { OpenAI::Live::SessionClosedEvent::Reason::TaggedSymbol } + end + + # @!group + + CLOSE_REQUESTED = :close_requested + EXPIRED = :expired + CONTENT = :content + REMOTE_HANGUP = :remote_hangup + CONNECTION_LOST = :connection_lost + + # @!endgroup + end + end + end + end +end diff --git a/lib/openai/models/live/session_config.rb b/lib/openai/models/live/session_config.rb new file mode 100644 index 000000000..702abbd01 --- /dev/null +++ b/lib/openai/models/live/session_config.rb @@ -0,0 +1,236 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionConfig < OpenAI::Internal::Type::BaseModel + # @!attribute model + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @return [String, Symbol, OpenAI::Models::Live::SessionConfig::Model] + required :model, union: -> { OpenAI::Live::SessionConfig::Model } + + # @!attribute audio + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + # + # @return [OpenAI::Models::Live::SessionConfig::Audio, nil] + optional :audio, -> { OpenAI::Live::SessionConfig::Audio } + + # @!attribute client + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @return [OpenAI::Models::Live::ClientConfig, nil] + optional :client, -> { OpenAI::Live::ClientConfig } + + # @!attribute delegation + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @return [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionConfig::Delegation::Responses, nil] + optional :delegation, union: -> { OpenAI::Live::SessionConfig::Delegation }, nil?: true + + # @!attribute input + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + # + # @return [Array, nil] + optional :input, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::InitialItem] } + + # @!attribute instructions + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute store + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + # + # @return [Boolean, nil] + optional :store, OpenAI::Internal::Type::Boolean + + # @!method initialize(model:, audio: nil, client: nil, delegation: nil, input: nil, instructions: nil, store: nil) + # Initial configuration for a Live session, including its model, conversation + # instructions, audio, and delegated task handling. + # + # @param model [String, Symbol, OpenAI::Models::Live::SessionConfig::Model] + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @param audio [OpenAI::Models::Live::SessionConfig::Audio] + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + # + # @param client [OpenAI::Models::Live::ClientConfig] + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @param delegation [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionConfig::Delegation::Responses, nil] + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @param input [Array] + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + # + # @param instructions [String, nil] + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + # + # @param store [Boolean] + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @see OpenAI::Models::Live::SessionConfig#model + module Model + extend OpenAI::Internal::Type::Union + + variant String + + variant const: -> { OpenAI::Models::Live::SessionConfig::Model::GPT_LIVE_1 } + + # @!method self.variants + # @return [Array(String, Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { T.any(String, OpenAI::Live::SessionConfig::Model::TaggedSymbol) } + end + + # @!group + + GPT_LIVE_1 = :"gpt-live-1" + + # @!endgroup + end + + # @see OpenAI::Models::Live::SessionConfig#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute format_ + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + # + # @return [OpenAI::Models::Live::AudioFormat::AudioPCM, OpenAI::Models::Live::AudioFormat::AudioPCMU, OpenAI::Models::Live::AudioFormat::AudioPCMA, nil] + optional :format_, union: -> { OpenAI::Live::AudioFormat }, api_name: :format + + # @!attribute output + # The voice used for speech generated by the Live model. + # + # @return [OpenAI::Models::Live::SessionConfig::Audio::Output, nil] + optional :output, -> { OpenAI::Live::SessionConfig::Audio::Output } + + # @!method initialize(format_: nil, output: nil) + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + # + # @param format_ [OpenAI::Models::Live::AudioFormat::AudioPCM, OpenAI::Models::Live::AudioFormat::AudioPCMU, OpenAI::Models::Live::AudioFormat::AudioPCMA] + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + # + # @param output [OpenAI::Models::Live::SessionConfig::Audio::Output] + # The voice used for speech generated by the Live model. + + # @see OpenAI::Models::Live::SessionConfig::Audio#output + class Output < OpenAI::Internal::Type::BaseModel + # @!attribute voice + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + # + # @return [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice, nil] + optional :voice, union: -> { OpenAI::Live::SessionConfig::Audio::Output::Voice } + + # @!method initialize(voice: nil) + # The voice used for speech generated by the Live model. + # + # @param voice [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice] + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + # + # @see OpenAI::Models::Live::SessionConfig::Audio::Output#voice + module Voice + extend OpenAI::Internal::Type::Union + + variant String + + # A built-in voice available for Live speech. + variant enum: -> { OpenAI::Live::BuiltInVoice } + + variant -> { OpenAI::Live::CustomVoice } + + # @!method self.variants + # @return [Array(String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice)] + end + end + end + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @see OpenAI::Models::Live::SessionConfig#delegation + module Delegation + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Delegate tasks to your application. The Live session emits delegation events that your backend handles. + variant :client, -> { OpenAI::Live::ClientDelegation } + + # Delegate tasks to a Responses model managed by the Live session. + variant :responses, -> { OpenAI::Live::SessionConfig::Delegation::Responses } + + class Responses < OpenAI::Internal::Type::BaseModel + # @!attribute responses + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + # + # @return [OpenAI::Models::Live::ResponsesDelegationConfig] + required :responses, -> { OpenAI::Live::ResponsesDelegationConfig } + + # @!attribute type + # The delegation owner. Always `responses` for tasks handled by the Responses API. + # + # @return [Symbol, :responses] + required :type, const: :responses + + # @!method initialize(responses:, type: :responses) + # Delegate tasks to a Responses model managed by the Live session. + # + # @param responses [OpenAI::Models::Live::ResponsesDelegationConfig] + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + # + # @param type [Symbol, :responses] + # The delegation owner. Always `responses` for tasks handled by the Responses API. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionConfig::Delegation::Responses)] + end + end + end + end +end diff --git a/lib/openai/models/live/session_download_recording_params.rb b/lib/openai/models/live/session_download_recording_params.rb new file mode 100644 index 000000000..2be948a08 --- /dev/null +++ b/lib/openai/models/live/session_download_recording_params.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live::Sessions#download_recording + class SessionDownloadRecordingParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # The ID of the stored Live session to download. Use the session ID returned when + # the session started with storage enabled. + # + # @return [String] + required :session_id, String + + # @!method initialize(session_id:, request_options: {}) + # @param session_id [String] + # The ID of the stored Live session to download. Use the session ID returned when + # the session started with storage enabled. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/openai/models/live/session_fork_params.rb b/lib/openai/models/live/session_fork_params.rb new file mode 100644 index 000000000..408f4e684 --- /dev/null +++ b/lib/openai/models/live/session_fork_params.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live::Sessions#fork + class SessionForkParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute transport + # WebRTC transport with an SDP offer for the new connection to the forked session. + # + # @return [OpenAI::Models::Live::SessionForkParams::Transport] + required :transport, -> { OpenAI::Live::SessionForkParams::Transport } + + # @!attribute session + # Optional configuration overrides for the new Live session. Omit this object or + # send an empty object to inherit the stored session's settings. + # + # @return [OpenAI::Models::Live::MediaSessionForkConfig, nil] + optional :session, -> { OpenAI::Live::MediaSessionForkConfig } + + # @!method initialize(session_id:, transport:, session: nil, request_options: {}) + # @param session_id [String] + # + # @param transport [OpenAI::Models::Live::SessionForkParams::Transport] + # WebRTC transport with an SDP offer for the new connection to the forked session. + # + # @param session [OpenAI::Models::Live::MediaSessionForkConfig] + # Optional configuration overrides for the new Live session. Omit this object or + # send an empty object to inherit the stored session's settings. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + class Transport < OpenAI::Internal::Type::BaseModel + # @!attribute sdp + # Session Description Protocol message for the WebRTC connection. + # + # @return [String] + required :sdp, String + + # @!attribute type + # The transport used for the Live session. Always `webrtc`. + # + # @return [Symbol, :webrtc] + required :type, const: :webrtc + + # @!method initialize(sdp:, type: :webrtc) + # WebRTC transport with an SDP offer for the new connection to the forked session. + # + # @param sdp [String] + # Session Description Protocol message for the WebRTC connection. + # + # @param type [Symbol, :webrtc] + # The transport used for the Live session. Always `webrtc`. + end + end + end + end +end diff --git a/lib/openai/models/live/session_fork_response.rb b/lib/openai/models/live/session_fork_response.rb new file mode 100644 index 000000000..c72e59363 --- /dev/null +++ b/lib/openai/models/live/session_fork_response.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live::Sessions#fork + class SessionForkResponse < OpenAI::Internal::Type::BaseModel + # @!attribute session + # The newly created Live session. Use its ID for session controls and sideband + # connections. + # + # @return [OpenAI::Models::Live::SessionForkResponse::Session] + required :session, -> { OpenAI::Models::Live::SessionForkResponse::Session } + + # @!attribute transport + # WebRTC transport with the SDP answer. + # + # @return [OpenAI::Models::Live::SessionForkResponse::Transport] + required :transport, -> { OpenAI::Models::Live::SessionForkResponse::Transport } + + # @!method initialize(session:, transport:) + # The created Live session identifier and WebRTC answer. Apply transport.sdp as + # the peer's remote answer and wait for session.started on the data channel before + # sending commands. + # + # @param session [OpenAI::Models::Live::SessionForkResponse::Session] + # The newly created Live session. Use its ID for session controls and sideband + # connections. + # + # @param transport [OpenAI::Models::Live::SessionForkResponse::Transport] + # WebRTC transport with the SDP answer. + + # @see OpenAI::Models::Live::SessionForkResponse#session + class Session < OpenAI::Internal::Type::BaseModel + # @!attribute id + # Opaque session identifier. Preserve the returned value unchanged, including its + # prefix. + # + # @return [String] + required :id, String + + # @!method initialize(id:) + # The newly created Live session. Use its ID for session controls and sideband + # connections. + # + # @param id [String] + # Opaque session identifier. Preserve the returned value unchanged, including its + # prefix. + end + + # @see OpenAI::Models::Live::SessionForkResponse#transport + class Transport < OpenAI::Internal::Type::BaseModel + # @!attribute sdp + # Session Description Protocol message for the WebRTC connection. + # + # @return [String] + required :sdp, String + + # @!attribute type + # The transport used for the Live session. Always `webrtc`. + # + # @return [Symbol, :webrtc] + required :type, const: :webrtc + + # @!method initialize(sdp:, type: :webrtc) + # WebRTC transport with the SDP answer. + # + # @param sdp [String] + # Session Description Protocol message for the WebRTC connection. + # + # @param type [Symbol, :webrtc] + # The transport used for the Live session. Always `webrtc`. + end + end + end + end +end diff --git a/lib/openai/models/live/session_hangup_params.rb b/lib/openai/models/live/session_hangup_params.rb new file mode 100644 index 000000000..8e37f7619 --- /dev/null +++ b/lib/openai/models/live/session_hangup_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live::Sessions#hangup + class SessionHangupParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!method initialize(session_id:, request_options: {}) + # @param session_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/openai/models/live/session_refer_params.rb b/lib/openai/models/live/session_refer_params.rb new file mode 100644 index 000000000..3e2080bff --- /dev/null +++ b/lib/openai/models/live/session_refer_params.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live::Sessions#refer + class SessionReferParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute target_uri + # Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or + # sip:agent@example.com. + # + # @return [String] + required :target_uri, String + + # @!method initialize(session_id:, target_uri:, request_options: {}) + # @param session_id [String] + # + # @param target_uri [String] + # Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or + # sip:agent@example.com. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/openai/models/live/session_reject_params.rb b/lib/openai/models/live/session_reject_params.rb new file mode 100644 index 000000000..c40c5163a --- /dev/null +++ b/lib/openai/models/live/session_reject_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + # @see OpenAI::Resources::Live::Sessions#reject + class SessionRejectParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute status_code + # SIP rejection status sent to the caller. This field is required. + # + # @return [Integer] + required :status_code, Integer + + # @!method initialize(session_id:, status_code:, request_options: {}) + # @param session_id [String] + # + # @param status_code [Integer] + # SIP rejection status sent to the caller. This field is required. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/openai/models/live/session_resource.rb b/lib/openai/models/live/session_resource.rb new file mode 100644 index 000000000..4d0cdaca6 --- /dev/null +++ b/lib/openai/models/live/session_resource.rb @@ -0,0 +1,268 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionResource < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The unique ID of the Live session. Use this ID for sideband connections, + # forking, and recording download. + # + # @return [String] + required :id, String + + # @!attribute expires_at + # The Unix timestamp, in seconds, at which the Live session expires. + # + # @return [Integer] + required :expires_at, Integer + + # @!attribute model + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @return [String, Symbol, OpenAI::Models::Live::SessionResource::Model] + required :model, union: -> { OpenAI::Live::SessionResource::Model } + + # @!attribute status + # The status of the session snapshot. Always `active`, including the final + # snapshot in session.closed; use the event type to determine that the session has + # closed. + # + # @return [Symbol, :active] + required :status, const: :active + + # @!attribute audio + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + # + # @return [OpenAI::Models::Live::SessionResource::Audio, nil] + optional :audio, -> { OpenAI::Live::SessionResource::Audio } + + # @!attribute client + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @return [OpenAI::Models::Live::ClientConfig, nil] + optional :client, -> { OpenAI::Live::ClientConfig } + + # @!attribute delegation + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @return [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionResource::Delegation::Responses, nil] + optional :delegation, union: -> { OpenAI::Live::SessionResource::Delegation }, nil?: true + + # @!attribute input + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + # + # @return [Array, nil] + optional :input, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::InitialItem] } + + # @!attribute instructions + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute store + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + # + # @return [Boolean, nil] + optional :store, OpenAI::Internal::Type::Boolean + + # @!method initialize(id:, expires_at:, model:, audio: nil, client: nil, delegation: nil, input: nil, instructions: nil, store: nil, status: :active) + # The resolved Live session configuration and server-assigned session metadata. + # + # @param id [String] + # The unique ID of the Live session. Use this ID for sideband connections, + # forking, and recording download. + # + # @param expires_at [Integer] + # The Unix timestamp, in seconds, at which the Live session expires. + # + # @param model [String, Symbol, OpenAI::Models::Live::SessionResource::Model] + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @param audio [OpenAI::Models::Live::SessionResource::Audio] + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + # + # @param client [OpenAI::Models::Live::ClientConfig] + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + # + # @param delegation [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionResource::Delegation::Responses, nil] + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @param input [Array] + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + # + # @param instructions [String, nil] + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + # + # @param store [Boolean] + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + # + # @param status [Symbol, :active] + # The status of the session snapshot. Always `active`, including the final + # snapshot in session.closed; use the event type to determine that the session has + # closed. + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + # + # @see OpenAI::Models::Live::SessionResource#model + module Model + extend OpenAI::Internal::Type::Union + + variant String + + variant const: -> { OpenAI::Models::Live::SessionResource::Model::GPT_LIVE_1 } + + # @!method self.variants + # @return [Array(String, Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { T.any(String, OpenAI::Live::SessionResource::Model::TaggedSymbol) } + end + + # @!group + + GPT_LIVE_1 = :"gpt-live-1" + + # @!endgroup + end + + # @see OpenAI::Models::Live::SessionResource#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute format_ + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + # + # @return [OpenAI::Models::Live::AudioFormat::AudioPCM, OpenAI::Models::Live::AudioFormat::AudioPCMU, OpenAI::Models::Live::AudioFormat::AudioPCMA, nil] + optional :format_, union: -> { OpenAI::Live::AudioFormat }, api_name: :format + + # @!attribute output + # The voice used for speech generated by the Live model. + # + # @return [OpenAI::Models::Live::SessionResource::Audio::Output, nil] + optional :output, -> { OpenAI::Live::SessionResource::Audio::Output } + + # @!method initialize(format_: nil, output: nil) + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + # + # @param format_ [OpenAI::Models::Live::AudioFormat::AudioPCM, OpenAI::Models::Live::AudioFormat::AudioPCMU, OpenAI::Models::Live::AudioFormat::AudioPCMA] + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + # + # @param output [OpenAI::Models::Live::SessionResource::Audio::Output] + # The voice used for speech generated by the Live model. + + # @see OpenAI::Models::Live::SessionResource::Audio#output + class Output < OpenAI::Internal::Type::BaseModel + # @!attribute voice + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + # + # @return [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice, nil] + optional :voice, union: -> { OpenAI::Live::SessionResource::Audio::Output::Voice } + + # @!method initialize(voice: nil) + # The voice used for speech generated by the Live model. + # + # @param voice [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice] + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + # + # @see OpenAI::Models::Live::SessionResource::Audio::Output#voice + module Voice + extend OpenAI::Internal::Type::Union + + variant String + + # The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup. + variant enum: -> { OpenAI::Live::BuiltInVoice } + + variant -> { OpenAI::Live::CustomVoice } + + # @!method self.variants + # @return [Array(String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice)] + end + end + end + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + # + # @see OpenAI::Models::Live::SessionResource#delegation + module Delegation + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Delegate tasks to your application. The Live session emits delegation events that your backend handles. + variant :client, -> { OpenAI::Live::ClientDelegation } + + # Delegate tasks to a Responses model managed by the Live session. + variant :responses, -> { OpenAI::Live::SessionResource::Delegation::Responses } + + class Responses < OpenAI::Internal::Type::BaseModel + # @!attribute responses + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + # + # @return [OpenAI::Models::Live::ResponsesDelegationConfig] + required :responses, -> { OpenAI::Live::ResponsesDelegationConfig } + + # @!attribute type + # The delegation owner. Always `responses` for tasks handled by the Responses API. + # + # @return [Symbol, :responses] + required :type, const: :responses + + # @!method initialize(responses:, type: :responses) + # Delegate tasks to a Responses model managed by the Live session. + # + # @param responses [OpenAI::Models::Live::ResponsesDelegationConfig] + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + # + # @param type [Symbol, :responses] + # The delegation owner. Always `responses` for tasks handled by the Responses API. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionResource::Delegation::Responses)] + end + end + end + end +end diff --git a/lib/openai/models/live/session_start_event.rb b/lib/openai/models/live/session_start_event.rb new file mode 100644 index 000000000..2d906c1fb --- /dev/null +++ b/lib/openai/models/live/session_start_event.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionStartEvent < OpenAI::Internal::Type::BaseModel + # @!attribute session + # Initial configuration for a primary WebSocket. Send session.start first and wait + # for session.started before application commands. WebRTC creation already starts + # the session; do not send this event again on its data channel. + # + # @return [OpenAI::Models::Live::SessionConfig] + required :session, -> { OpenAI::Live::SessionConfig } + + # @!attribute type + # The Live client event type. Always `session.start`. + # + # @return [Symbol, :"session.start"] + required :type, const: :"session.start" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(session:, event_id: nil, type: :"session.start") + # Start a Live session on a primary WebSocket. Send this event before other + # commands and wait for `session.started`. + # + # @param session [OpenAI::Models::Live::SessionConfig] + # Initial configuration for a primary WebSocket. Send session.start first and wait + # for session.started before application commands. WebRTC creation already starts + # the session; do not send this event again on its data channel. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.start"] + # The Live client event type. Always `session.start`. + end + end + end +end diff --git a/lib/openai/models/live/session_started_event.rb b/lib/openai/models/live/session_started_event.rb new file mode 100644 index 000000000..95b37c602 --- /dev/null +++ b/lib/openai/models/live/session_started_event.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionStartedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The resolved Live session configuration and server-assigned session metadata. + # + # @return [OpenAI::Models::Live::SessionResource] + required :session, -> { OpenAI::Live::SessionResource } + + # @!attribute type + # The event type, always `session.started`. + # + # @return [Symbol, :"session.started"] + required :type, const: :"session.started" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(event_id:, session:, client_event_id: nil, type: :"session.started") + # Returned when a Live session has started. Contains the resolved session + # configuration, including server defaults. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param session [OpenAI::Models::Live::SessionResource] + # The resolved Live session configuration and server-assigned session metadata. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.started"] + # The event type, always `session.started`. + end + end + end +end diff --git a/lib/openai/models/live/session_update_config.rb b/lib/openai/models/live/session_update_config.rb new file mode 100644 index 000000000..99879b7fe --- /dev/null +++ b/lib/openai/models/live/session_update_config.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionUpdateConfig < OpenAI::Internal::Type::BaseModel + # @!attribute delegation + # Delegation settings to update. The delegation type must match the current + # session; omitted settings retain their values. + # + # @return [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionUpdateConfig::Delegation::Responses, nil] + optional :delegation, union: -> { OpenAI::Live::SessionUpdateConfig::Delegation }, nil?: true + + # @!method initialize(delegation: nil) + # Changes to an active Live session. Only delegation backend settings can be + # updated after startup. + # + # @param delegation [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionUpdateConfig::Delegation::Responses, nil] + # Delegation settings to update. The delegation type must match the current + # session; omitted settings retain their values. + + # Delegation settings to update. The delegation type must match the current + # session; omitted settings retain their values. + # + # @see OpenAI::Models::Live::SessionUpdateConfig#delegation + module Delegation + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Delegate tasks to your application. The Live session emits delegation events that your backend handles. + variant :client, -> { OpenAI::Live::ClientDelegation } + + # Update the Responses backend for an existing Live session without changing delegation ownership. + variant :responses, -> { OpenAI::Live::SessionUpdateConfig::Delegation::Responses } + + class Responses < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The delegation owner. Always `responses` for tasks handled by the Responses API. + # + # @return [Symbol, :responses] + required :type, const: :responses + + # @!attribute responses + # Responses backend settings to update. Omitted settings keep their existing + # values. + # + # @return [OpenAI::Models::Live::ResponsesDelegationUpdateConfig, nil] + optional :responses, -> { OpenAI::Live::ResponsesDelegationUpdateConfig } + + # @!method initialize(responses: nil, type: :responses) + # Update the Responses backend for an existing Live session without changing + # delegation ownership. + # + # @param responses [OpenAI::Models::Live::ResponsesDelegationUpdateConfig] + # Responses backend settings to update. Omitted settings keep their existing + # values. + # + # @param type [Symbol, :responses] + # The delegation owner. Always `responses` for tasks handled by the Responses API. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionUpdateConfig::Delegation::Responses)] + end + end + end + end +end diff --git a/lib/openai/models/live/session_update_event.rb b/lib/openai/models/live/session_update_event.rb new file mode 100644 index 000000000..cacde1c70 --- /dev/null +++ b/lib/openai/models/live/session_update_event.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionUpdateEvent < OpenAI::Internal::Type::BaseModel + # @!attribute session + # Sparse delegation updates. Omitted settings retain their values. The delegation + # type cannot change, including resetting Responses delegation to null or client. + # Model, frontend instructions, audio, and startup input are immutable. + # + # @return [OpenAI::Models::Live::SessionUpdateConfig] + required :session, -> { OpenAI::Live::SessionUpdateConfig } + + # @!attribute type + # The Live client event type. Always `session.update`. + # + # @return [Symbol, :"session.update"] + required :type, const: :"session.update" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(session:, event_id: nil, type: :"session.update") + # Update the delegation settings of an active Live session. The server + # acknowledges accepted changes with `session.updated`. + # + # @param session [OpenAI::Models::Live::SessionUpdateConfig] + # Sparse delegation updates. Omitted settings retain their values. The delegation + # type cannot change, including resetting Responses delegation to null or client. + # Model, frontend instructions, audio, and startup input are immutable. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.update"] + # The Live client event type. Always `session.update`. + end + end + end +end diff --git a/lib/openai/models/live/session_updated_event.rb b/lib/openai/models/live/session_updated_event.rb new file mode 100644 index 000000000..50a514a61 --- /dev/null +++ b/lib/openai/models/live/session_updated_event.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionUpdatedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The resolved Live session configuration and server-assigned session metadata. + # + # @return [OpenAI::Models::Live::SessionResource] + required :session, -> { OpenAI::Live::SessionResource } + + # @!attribute type + # The event type, always `session.updated`. + # + # @return [Symbol, :"session.updated"] + required :type, const: :"session.updated" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(event_id:, session:, client_event_id: nil, type: :"session.updated") + # Returned when a Live session update is accepted. Contains the resolved session + # configuration after the update. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param session [OpenAI::Models::Live::SessionResource] + # The resolved Live session configuration and server-assigned session metadata. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.updated"] + # The event type, always `session.updated`. + end + end + end +end diff --git a/lib/openai/models/live/session_usage.rb b/lib/openai/models/live/session_usage.rb new file mode 100644 index 000000000..b54ede9ca --- /dev/null +++ b/lib/openai/models/live/session_usage.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionUsage < OpenAI::Internal::Type::BaseModel + # @!attribute seconds + # The cumulative Live audio duration in seconds. Do not sum this value across + # usage events. + # + # @return [Float] + required :seconds, Float + + # @!method initialize(seconds:) + # Cumulative audio duration for a Live session. Values are totals for the session, + # not increments to sum across usage events. + # + # @param seconds [Float] + # The cumulative Live audio duration in seconds. Do not sum this value across + # usage events. + end + end + end +end diff --git a/lib/openai/models/live/session_usage_updated_event.rb b/lib/openai/models/live/session_usage_updated_event.rb new file mode 100644 index 000000000..e11c8287e --- /dev/null +++ b/lib/openai/models/live/session_usage_updated_event.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class SessionUsageUpdatedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, always `session.usage.updated`. + # + # @return [Symbol, :"session.usage.updated"] + required :type, const: :"session.usage.updated" + + # @!attribute usage + # The cumulative Live audio usage so far. + # + # @return [OpenAI::Models::Live::SessionUsage] + required :usage, -> { OpenAI::Live::SessionUsage } + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!attribute context_window + # The latest measured Live context-window usage. Omitted when the context limit is + # unknown. + # + # @return [OpenAI::Models::Live::SessionUsageUpdatedEvent::ContextWindow, nil] + optional :context_window, -> { OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow } + + # @!method initialize(event_id:, usage:, client_event_id: nil, context_window: nil, type: :"session.usage.updated") + # Reports cumulative Live audio usage and, when available, the most recent + # context-window usage. Delegated Responses token usage is reported separately in + # response.event events. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param usage [OpenAI::Models::Live::SessionUsage] + # The cumulative Live audio usage so far. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param context_window [OpenAI::Models::Live::SessionUsageUpdatedEvent::ContextWindow] + # The latest measured Live context-window usage. Omitted when the context limit is + # unknown. + # + # @param type [Symbol, :"session.usage.updated"] + # The event type, always `session.usage.updated`. + + # @see OpenAI::Models::Live::SessionUsageUpdatedEvent#context_window + class ContextWindow < OpenAI::Internal::Type::BaseModel + # @!attribute usage_ratio + # The latest active context token count divided by the Live model context limit. + # Can decrease after compaction and may lag between measured audio frames. + # + # @return [Float] + required :usage_ratio, Float + + # @!method initialize(usage_ratio:) + # The latest measured Live context-window usage. Omitted when the context limit is + # unknown. + # + # @param usage_ratio [Float] + # The latest active context token count divided by the Live model context limit. + # Can decrease after compaction and may lag between measured audio frames. + end + end + end + end +end diff --git a/lib/openai/models/live/thinking_append_event.rb b/lib/openai/models/live/thinking_append_event.rb new file mode 100644 index 000000000..1cc8fb130 --- /dev/null +++ b/lib/openai/models/live/thinking_append_event.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ThinkingAppendEvent < OpenAI::Internal::Type::BaseModel + # @!attribute content + # Silent reasoning or progress context, limited to 500 tokens. It does not + # directly request speech, but can influence later speech and is not a secrecy + # boundary. + # + # @return [String] + required :content, String + + # @!attribute delegation_id + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + # + # @return [String, nil] + required :delegation_id, String, nil?: true + + # @!attribute type + # The Live client event type. Always `session.thinking.append`. + # + # @return [Symbol, :"session.thinking.append"] + required :type, const: :"session.thinking.append" + + # @!attribute event_id + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @return [String, nil] + optional :event_id, String, nil?: true + + # @!method initialize(content:, delegation_id:, event_id: nil, type: :"session.thinking.append") + # Provide silent reasoning or progress context to the Live model, optionally for + # an existing client delegation. + # + # @param content [String] + # Silent reasoning or progress context, limited to 500 tokens. It does not + # directly request speech, but can influence later speech and is not a secrecy + # boundary. + # + # @param delegation_id [String, nil] + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + # + # @param event_id [String, nil] + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + # + # @param type [Symbol, :"session.thinking.append"] + # The Live client event type. Always `session.thinking.append`. + end + end + end +end diff --git a/lib/openai/models/live/thinking_appended_event.rb b/lib/openai/models/live/thinking_appended_event.rb new file mode 100644 index 000000000..bcf175cc2 --- /dev/null +++ b/lib/openai/models/live/thinking_appended_event.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Live + class ThinkingAppendedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute end_ms + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @return [Integer] + required :end_ms, Integer + + # @!attribute event_id + # The unique ID of the Live server event. + # + # @return [String] + required :event_id, String + + # @!attribute start_ms + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @return [Integer] + required :start_ms, Integer + + # @!attribute type + # The event type, always `session.thinking.appended`. + # + # @return [Symbol, :"session.thinking.appended"] + required :type, const: :"session.thinking.appended" + + # @!attribute client_event_id + # The event_id of the client command associated with this server event, when + # supplied. + # + # @return [String, nil] + optional :client_event_id, String + + # @!method initialize(end_ms:, event_id:, start_ms:, client_event_id: nil, type: :"session.thinking.appended") + # Returned when a session.thinking.append command is accepted into the Live + # session timeline. Acknowledges the added reasoning context without guaranteeing + # any spoken output. + # + # @param end_ms [Integer] + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + # + # @param event_id [String] + # The unique ID of the Live server event. + # + # @param start_ms [Integer] + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + # + # @param client_event_id [String] + # The event_id of the client command associated with this server event, when + # supplied. + # + # @param type [Symbol, :"session.thinking.appended"] + # The event type, always `session.thinking.appended`. + end + end + end +end diff --git a/lib/openai/models/responses/response_input_item.rb b/lib/openai/models/responses/response_input_item.rb index 787686d9a..fba590fc2 100644 --- a/lib/openai/models/responses/response_input_item.rb +++ b/lib/openai/models/responses/response_input_item.rb @@ -655,6 +655,36 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @return [Symbol, :image_generation_call] required :type, const: :image_generation_call + # @!attribute action + # The action used for image generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::Action, nil] + optional( + :action, + enum: -> { OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action }, + nil?: true + ) + + # @!attribute background + # The background setting used for generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::Background, nil] + optional( + :background, + enum: -> { OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background }, + nil?: true + ) + + # @!attribute output_format + # The output format used for generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat, nil] + optional( + :output_format, + enum: -> { OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat }, + nil?: true + ) + # @!attribute quality # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. @@ -666,6 +696,12 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) + # @!attribute revised_prompt + # The prompt that was used after any model prompt rewriting. + # + # @return [String, nil] + optional :revised_prompt, String, nil?: true + # @!attribute size # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -678,7 +714,7 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) - # @!method initialize(id:, result:, status:, quality: nil, size: nil, type: :image_generation_call) + # @!method initialize(id:, result:, status:, action: nil, background: nil, output_format: nil, quality: nil, revised_prompt: nil, size: nil, type: :image_generation_call) # An image generation request made by the model. # # @param id [String] @@ -690,10 +726,22 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @param status [Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::Status] # The status of the image generation call. # + # @param action [Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::Action, nil] + # The action used for image generation. + # + # @param background [Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::Background, nil] + # The background setting used for generation. + # + # @param output_format [Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat, nil] + # The output format used for generation. + # # @param quality [Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::Quality, nil] # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # + # @param revised_prompt [String, nil] + # The prompt that was used after any model prompt rewriting. + # # @param size [String, Symbol, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::Size, nil] # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -715,6 +763,48 @@ module Status # @return [Array] end + # The action used for image generation. + # + # @see OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall#action + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE = :generate + EDIT = :edit + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The background setting used for generation. + # + # @see OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall#background + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT = :transparent + OPAQUE = :opaque + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The output format used for generation. + # + # @see OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall#output_format + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG = :png + WEBP = :webp + JPEG = :jpeg + + # @!method self.values + # @return [Array] + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # diff --git a/lib/openai/models/responses/response_item.rb b/lib/openai/models/responses/response_item.rb index 543d38d89..19bd46a54 100644 --- a/lib/openai/models/responses/response_item.rb +++ b/lib/openai/models/responses/response_item.rb @@ -291,6 +291,38 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @return [Symbol, :image_generation_call] required :type, const: :image_generation_call + # @!attribute action + # The action used for image generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::Action, nil] + optional( + :action, + enum: -> { + OpenAI::Responses::ResponseItem::ImageGenerationCall::Action + }, + nil?: true + ) + + # @!attribute background + # The background setting used for generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::Background, nil] + optional( + :background, + enum: -> { OpenAI::Responses::ResponseItem::ImageGenerationCall::Background }, + nil?: true + ) + + # @!attribute output_format + # The output format used for generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::OutputFormat, nil] + optional( + :output_format, + enum: -> { OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat }, + nil?: true + ) + # @!attribute quality # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. @@ -304,13 +336,19 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) + # @!attribute revised_prompt + # The prompt that was used after any model prompt rewriting. + # + # @return [String, nil] + optional :revised_prompt, String, nil?: true + # @!attribute size # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # # @return [String, Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::Size, nil] optional :size, union: -> { OpenAI::Responses::ResponseItem::ImageGenerationCall::Size }, nil?: true - # @!method initialize(id:, result:, status:, quality: nil, size: nil, type: :image_generation_call) + # @!method initialize(id:, result:, status:, action: nil, background: nil, output_format: nil, quality: nil, revised_prompt: nil, size: nil, type: :image_generation_call) # An image generation request made by the model. # # @param id [String] @@ -322,10 +360,22 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @param status [Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::Status] # The status of the image generation call. # + # @param action [Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::Action, nil] + # The action used for image generation. + # + # @param background [Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::Background, nil] + # The background setting used for generation. + # + # @param output_format [Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::OutputFormat, nil] + # The output format used for generation. + # # @param quality [Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::Quality, nil] # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # + # @param revised_prompt [String, nil] + # The prompt that was used after any model prompt rewriting. + # # @param size [String, Symbol, OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::Size, nil] # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -347,6 +397,48 @@ module Status # @return [Array] end + # The action used for image generation. + # + # @see OpenAI::Models::Responses::ResponseItem::ImageGenerationCall#action + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE = :generate + EDIT = :edit + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The background setting used for generation. + # + # @see OpenAI::Models::Responses::ResponseItem::ImageGenerationCall#background + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT = :transparent + OPAQUE = :opaque + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The output format used for generation. + # + # @see OpenAI::Models::Responses::ResponseItem::ImageGenerationCall#output_format + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG = :png + WEBP = :webp + JPEG = :jpeg + + # @!method self.values + # @return [Array] + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # diff --git a/lib/openai/models/responses/response_output_item.rb b/lib/openai/models/responses/response_output_item.rb index 349e44e85..26699d94a 100644 --- a/lib/openai/models/responses/response_output_item.rb +++ b/lib/openai/models/responses/response_output_item.rb @@ -285,6 +285,36 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @return [Symbol, :image_generation_call] required :type, const: :image_generation_call + # @!attribute action + # The action used for image generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::Action, nil] + optional( + :action, + enum: -> { OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action }, + nil?: true + ) + + # @!attribute background + # The background setting used for generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::Background, nil] + optional( + :background, + enum: -> { OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background }, + nil?: true + ) + + # @!attribute output_format + # The output format used for generation. + # + # @return [Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat, nil] + optional( + :output_format, + enum: -> { OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat }, + nil?: true + ) + # @!attribute quality # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. @@ -296,6 +326,12 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) + # @!attribute revised_prompt + # The prompt that was used after any model prompt rewriting. + # + # @return [String, nil] + optional :revised_prompt, String, nil?: true + # @!attribute size # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -308,7 +344,7 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel nil?: true ) - # @!method initialize(id:, result:, status:, quality: nil, size: nil, type: :image_generation_call) + # @!method initialize(id:, result:, status:, action: nil, background: nil, output_format: nil, quality: nil, revised_prompt: nil, size: nil, type: :image_generation_call) # An image generation request made by the model. # # @param id [String] @@ -320,10 +356,22 @@ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel # @param status [Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::Status] # The status of the image generation call. # + # @param action [Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::Action, nil] + # The action used for image generation. + # + # @param background [Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::Background, nil] + # The background setting used for generation. + # + # @param output_format [Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat, nil] + # The output format used for generation. + # # @param quality [Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::Quality, nil] # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # + # @param revised_prompt [String, nil] + # The prompt that was used after any model prompt rewriting. + # # @param size [String, Symbol, OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::Size, nil] # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. # @@ -345,6 +393,48 @@ module Status # @return [Array] end + # The action used for image generation. + # + # @see OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall#action + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE = :generate + EDIT = :edit + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The background setting used for generation. + # + # @see OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall#background + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT = :transparent + OPAQUE = :opaque + AUTO = :auto + + # @!method self.values + # @return [Array] + end + + # The output format used for generation. + # + # @see OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall#output_format + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG = :png + WEBP = :webp + JPEG = :jpeg + + # @!method self.values + # @return [Array] + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. # diff --git a/lib/openai/models/webhooks/live_call_incoming_webhook_event.rb b/lib/openai/models/webhooks/live_call_incoming_webhook_event.rb index d27a01f64..b102aaf08 100644 --- a/lib/openai/models/webhooks/live_call_incoming_webhook_event.rb +++ b/lib/openai/models/webhooks/live_call_incoming_webhook_event.rb @@ -3,6 +3,7 @@ module OpenAI module Models module Webhooks + # @deprecated class LiveCallIncomingWebhookEvent < OpenAI::Internal::Type::BaseModel # @!attribute id # The unique ID of the event. @@ -35,9 +36,11 @@ class LiveCallIncomingWebhookEvent < OpenAI::Internal::Type::BaseModel optional :object, enum: -> { OpenAI::Webhooks::LiveCallIncomingWebhookEvent::Object } # @!method initialize(id:, created_at:, data:, object: nil, type: :"live.call.incoming") - # Sent when an incoming API SIP session is available for Live acceptance. The same - # pending session can also emit `realtime.call.incoming`; the first successful - # Realtime or Live accept endpoint selects the runtime surface. + # Deprecated: use `live.transport.incoming`. Retained for existing subscriptions + # during migration; new subscriptions to this event are not allowed. Sent when an + # incoming API SIP session is available for Live acceptance. The same pending + # session can also emit `realtime.call.incoming`; the first successful Realtime or + # Live accept endpoint selects the runtime surface. # # @param id [String] # The unique ID of the event. @@ -57,8 +60,9 @@ class LiveCallIncomingWebhookEvent < OpenAI::Internal::Type::BaseModel # @see OpenAI::Models::Webhooks::LiveCallIncomingWebhookEvent#data class Data < OpenAI::Internal::Type::BaseModel # @!attribute session_id - # The `live_...` ID of the pending SIP session. Forward this value unchanged when - # accepting or rejecting the call through the Live API. + # The `live_...` ID of the pending SIP session. Pass this value unchanged to Live + # call controls and sideband connections. The corresponding + # `realtime.call.incoming` event uses a separate `rtc_...` call ID. # # @return [String] required :session_id, String @@ -78,8 +82,9 @@ class Data < OpenAI::Internal::Type::BaseModel # Event data payload. # # @param session_id [String] - # The `live_...` ID of the pending SIP session. Forward this value unchanged when - # accepting or rejecting the call through the Live API. + # The `live_...` ID of the pending SIP session. Pass this value unchanged to Live + # call controls and sideband connections. The corresponding + # `realtime.call.incoming` event uses a separate `rtc_...` call ID. # # @param sip_headers [Array] # Headers from the SIP INVITE, excluding SIP authorization headers. Retained diff --git a/lib/openai/models/webhooks/live_transport_incoming_webhook_event.rb b/lib/openai/models/webhooks/live_transport_incoming_webhook_event.rb new file mode 100644 index 000000000..667f0a27d --- /dev/null +++ b/lib/openai/models/webhooks/live_transport_incoming_webhook_event.rb @@ -0,0 +1,137 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Webhooks + class LiveTransportIncomingWebhookEvent < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The unique ID of the event. + # + # @return [String] + required :id, String + + # @!attribute created_at + # The Unix timestamp (in seconds) of when the event was created. + # + # @return [Integer] + required :created_at, Integer + + # @!attribute data + # Event data payload. + # + # @return [OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::Data] + required :data, -> { OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data } + + # @!attribute type + # The type of the event. Always `live.transport.incoming`. + # + # @return [Symbol, :"live.transport.incoming"] + required :type, const: :"live.transport.incoming" + + # @!attribute object + # The object of the event. Always `event`. + # + # @return [Symbol, OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::Object, nil] + optional :object, enum: -> { OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Object } + + # @!method initialize(id:, created_at:, data:, object: nil, type: :"live.transport.incoming") + # Sent when an incoming API SIP session is available for Live acceptance. The same + # pending session can also emit `realtime.call.incoming`; the first successful + # Realtime or Live accept endpoint selects the runtime surface. + # + # @param id [String] + # The unique ID of the event. + # + # @param created_at [Integer] + # The Unix timestamp (in seconds) of when the event was created. + # + # @param data [OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::Data] + # Event data payload. + # + # @param object [Symbol, OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::Object] + # The object of the event. Always `event`. + # + # @param type [Symbol, :"live.transport.incoming"] + # The type of the event. Always `live.transport.incoming`. + + # @see OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent#data + class Data < OpenAI::Internal::Type::BaseModel + # @!attribute session_id + # The `live_...` ID of the pending SIP session. Forward this value unchanged when + # accepting or rejecting the call through the Live API. + # + # @return [String] + required :session_id, String + + # @!attribute sip_headers + # Headers from the SIP INVITE, excluding SIP authorization headers. Retained + # names, values, repeated entries, and order are preserved. Treat these values as + # untrusted call metadata. + # + # @return [Array] + required( + :sip_headers, + -> { + OpenAI::Internal::Type::ArrayOf[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader] + } + ) + + # @!attribute type + # The incoming transport type. Always `sip`. + # + # @return [Symbol, :sip] + required :type, const: :sip + + # @!method initialize(session_id:, sip_headers:, type: :sip) + # Event data payload. + # + # @param session_id [String] + # The `live_...` ID of the pending SIP session. Forward this value unchanged when + # accepting or rejecting the call through the Live API. + # + # @param sip_headers [Array] + # Headers from the SIP INVITE, excluding SIP authorization headers. Retained + # names, values, repeated entries, and order are preserved. Treat these values as + # untrusted call metadata. + # + # @param type [Symbol, :sip] + # The incoming transport type. Always `sip`. + class SipHeader < OpenAI::Internal::Type::BaseModel + # @!attribute name + # Name of the SIP Header. + # + # @return [String] + required :name, String + + # @!attribute value + # Value of the SIP Header. + # + # @return [String] + required :value, String + + # @!method initialize(name:, value:) + # A header from the SIP Invite. + # + # @param name [String] + # Name of the SIP Header. + # + # @param value [String] + # Value of the SIP Header. + end + end + + # The object of the event. Always `event`. + # + # @see OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent#object + module Object + extend OpenAI::Internal::Type::Enum + + EVENT = :event + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb b/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb index 5384e766e..ef4263c4d 100644 --- a/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb +++ b/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb @@ -36,8 +36,8 @@ class RealtimeCallIncomingWebhookEvent < OpenAI::Internal::Type::BaseModel # @!method initialize(id:, created_at:, data:, object: nil, type: :"realtime.call.incoming") # Sent when an incoming API SIP session is available for Realtime acceptance. The - # same pending session can also emit `live.call.incoming`; the first successful - # Realtime or Live accept endpoint selects the runtime surface. + # same pending session can also emit `live.transport.incoming`; the first + # successful Realtime or Live accept endpoint selects the runtime surface. # # @param id [String] # The unique ID of the event. @@ -58,7 +58,7 @@ class RealtimeCallIncomingWebhookEvent < OpenAI::Internal::Type::BaseModel class Data < OpenAI::Internal::Type::BaseModel # @!attribute call_id # The Transceiver `rtc_...` ID of the pending SIP session. The paired - # `live.call.incoming` event derives its `session_id` by replacing the `rtc_` + # `live.transport.incoming` event derives its `session_id` by replacing the `rtc_` # prefix with `live_`. Use the ID returned by the event with the corresponding # Realtime or Live API. # @@ -81,7 +81,7 @@ class Data < OpenAI::Internal::Type::BaseModel # # @param call_id [String] # The Transceiver `rtc_...` ID of the pending SIP session. The paired - # `live.call.incoming` event derives its `session_id` by replacing the `rtc_` + # `live.transport.incoming` event derives its `session_id` by replacing the `rtc_` # prefix with `live_`. Use the ID returned by the event with the corresponding # Realtime or Live API. # diff --git a/lib/openai/models/webhooks/unwrap_webhook_event.rb b/lib/openai/models/webhooks/unwrap_webhook_event.rb index 4420db77d..9e046d57d 100644 --- a/lib/openai/models/webhooks/unwrap_webhook_event.rb +++ b/lib/openai/models/webhooks/unwrap_webhook_event.rb @@ -39,13 +39,20 @@ module UnwrapWebhookEvent # Sent when a fine-tuning job has succeeded. variant :"fine_tuning.job.succeeded", -> { OpenAI::Webhooks::FineTuningJobSucceededWebhookEvent } + # Deprecated: use `live.transport.incoming`. Retained for existing subscriptions + # during migration; new subscriptions to this event are not allowed. # Sent when an incoming API SIP session is available for Live acceptance. The # same pending session can also emit `realtime.call.incoming`; the first # successful Realtime or Live accept endpoint selects the runtime surface. variant :"live.call.incoming", -> { OpenAI::Webhooks::LiveCallIncomingWebhookEvent } + # Sent when an incoming API SIP session is available for Live acceptance. The + # same pending session can also emit `realtime.call.incoming`; the first + # successful Realtime or Live accept endpoint selects the runtime surface. + variant :"live.transport.incoming", -> { OpenAI::Webhooks::LiveTransportIncomingWebhookEvent } + # Sent when an incoming API SIP session is available for Realtime acceptance. - # The same pending session can also emit `live.call.incoming`; the first + # The same pending session can also emit `live.transport.incoming`; the first # successful Realtime or Live accept endpoint selects the runtime surface. variant :"realtime.call.incoming", -> { OpenAI::Webhooks::RealtimeCallIncomingWebhookEvent } @@ -68,7 +75,7 @@ module UnwrapWebhookEvent variant :"safety.org_alert.created", -> { OpenAI::Webhooks::SafetyOrgAlertCreatedWebhookEvent } # @!method self.variants - # @return [Array(OpenAI::Models::Webhooks::BatchCancelledWebhookEvent, OpenAI::Models::Webhooks::BatchCompletedWebhookEvent, OpenAI::Models::Webhooks::BatchExpiredWebhookEvent, OpenAI::Models::Webhooks::BatchFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunCanceledWebhookEvent, OpenAI::Models::Webhooks::EvalRunFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunSucceededWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobCancelledWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobFailedWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobSucceededWebhookEvent, OpenAI::Models::Webhooks::LiveCallIncomingWebhookEvent, OpenAI::Models::Webhooks::RealtimeCallIncomingWebhookEvent, OpenAI::Models::Webhooks::ResponseCancelledWebhookEvent, OpenAI::Models::Webhooks::ResponseCompletedWebhookEvent, OpenAI::Models::Webhooks::ResponseFailedWebhookEvent, OpenAI::Models::Webhooks::ResponseIncompleteWebhookEvent, OpenAI::Models::Webhooks::SafetyAlertCreatedWebhookEvent, OpenAI::Models::Webhooks::SafetyOrgAlertCreatedWebhookEvent)] + # @return [Array(OpenAI::Models::Webhooks::BatchCancelledWebhookEvent, OpenAI::Models::Webhooks::BatchCompletedWebhookEvent, OpenAI::Models::Webhooks::BatchExpiredWebhookEvent, OpenAI::Models::Webhooks::BatchFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunCanceledWebhookEvent, OpenAI::Models::Webhooks::EvalRunFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunSucceededWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobCancelledWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobFailedWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobSucceededWebhookEvent, OpenAI::Models::Webhooks::LiveCallIncomingWebhookEvent, OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent, OpenAI::Models::Webhooks::RealtimeCallIncomingWebhookEvent, OpenAI::Models::Webhooks::ResponseCancelledWebhookEvent, OpenAI::Models::Webhooks::ResponseCompletedWebhookEvent, OpenAI::Models::Webhooks::ResponseFailedWebhookEvent, OpenAI::Models::Webhooks::ResponseIncompleteWebhookEvent, OpenAI::Models::Webhooks::SafetyAlertCreatedWebhookEvent, OpenAI::Models::Webhooks::SafetyOrgAlertCreatedWebhookEvent)] end end end diff --git a/lib/openai/resources/live.rb b/lib/openai/resources/live.rb new file mode 100644 index 000000000..2a4e907a2 --- /dev/null +++ b/lib/openai/resources/live.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Live + # @return [OpenAI::Resources::Live::Sideband] + attr_reader :sideband + + # @return [OpenAI::Resources::Live::Forks] + attr_reader :forks + + # @return [OpenAI::Resources::Live::Sessions] + attr_reader :sessions + + # Create a Live WebRTC session. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting). + # + # @overload create(session:, transport:, request_options: {}) + # + # @param session [OpenAI::Models::Live::MediaSessionConfig] + # Startup configuration for the Live session. + # + # @param transport [OpenAI::Models::Live::LiveCreateParams::Transport] + # WebRTC transport with the browser's SDP offer. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Live::LiveCreateResponse] + # + # @see OpenAI::Models::Live::LiveCreateParams + def create(params) + parsed, options = OpenAI::Live::LiveCreateParams.dump_request(params) + @client.request( + method: :post, + path: "live/sessions", + body: parsed, + model: OpenAI::Models::Live::LiveCreateResponse, + security: {bearer_auth: true}, + options: options + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + @sideband = OpenAI::Resources::Live::Sideband.new(client: client) + @forks = OpenAI::Resources::Live::Forks.new(client: client) + @sessions = OpenAI::Resources::Live::Sessions.new(client: client) + end + end + end +end diff --git a/lib/openai/resources/live/forks.rb b/lib/openai/resources/live/forks.rb new file mode 100644 index 000000000..a9cb54816 --- /dev/null +++ b/lib/openai/resources/live/forks.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Live + class Forks + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/openai/resources/live/sessions.rb b/lib/openai/resources/live/sessions.rb new file mode 100644 index 000000000..51fcb4818 --- /dev/null +++ b/lib/openai/resources/live/sessions.rb @@ -0,0 +1,180 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Live + class Sessions + # Accept an incoming SIP call with Live startup configuration. + # + # @overload accept(session_id, session:, request_options: {}) + # + # @param session_id [String] + # Opaque Live session identifier from the creation response or incoming-call + # webhook. Preserve the returned value unchanged, including its prefix. + # + # @param session [OpenAI::Models::Live::SessionAcceptParams::Session] + # Model and startup configuration for the Live session that answers the incoming + # SIP call. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see OpenAI::Models::Live::SessionAcceptParams + def accept(session_id, params) + parsed, options = OpenAI::Live::SessionAcceptParams.dump_request(params) + @client.request( + method: :post, + path: ["live/sessions/%1$s/accept", session_id], + body: parsed, + model: NilClass, + security: {bearer_auth: true}, + options: options + ) + end + + # Get Live session content + # + # @overload download_recording(session_id, request_options: {}) + # + # @param session_id [String] + # The ID of the stored Live session to download. Use the session ID returned when + # the session started with storage enabled. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [StringIO] + # + # @see OpenAI::Models::Live::SessionDownloadRecordingParams + def download_recording(session_id, params = {}) + @client.request( + method: :get, + path: ["live/sessions/%1$s/content", session_id], + headers: {"accept" => "application/binary"}, + model: StringIO, + security: {bearer_auth: true}, + options: params[:request_options] + ) + end + + # Fork a stored Live session onto a new WebRTC connection. + # + # @overload fork(session_id, transport:, session: nil, request_options: {}) + # + # @param session_id [String] + # The ID of the stored Live session to fork. + # + # @param transport [OpenAI::Models::Live::SessionForkParams::Transport] + # WebRTC transport with an SDP offer for the new connection to the forked session. + # + # @param session [OpenAI::Models::Live::MediaSessionForkConfig] + # Optional configuration overrides for the new Live session. Omit this object or + # send an empty object to inherit the stored session's settings. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Live::SessionForkResponse] + # + # @see OpenAI::Models::Live::SessionForkParams + def fork(session_id, params) + parsed, options = OpenAI::Live::SessionForkParams.dump_request(params) + @client.request( + method: :post, + path: ["live/sessions/%1$s/fork", session_id], + body: parsed, + model: OpenAI::Models::Live::SessionForkResponse, + security: {bearer_auth: true}, + options: options + ) + end + + # Hang up a Live session. + # + # @overload hangup(session_id, request_options: {}) + # + # @param session_id [String] + # Opaque Live session identifier from the creation response or incoming-call + # webhook. Preserve the returned value unchanged, including its prefix. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see OpenAI::Models::Live::SessionHangupParams + def hangup(session_id, params = {}) + @client.request( + method: :post, + path: ["live/sessions/%1$s/hangup", session_id], + model: NilClass, + security: {bearer_auth: true}, + options: params[:request_options] + ) + end + + # Transfer a Live SIP call to another destination. + # + # @overload refer(session_id, target_uri:, request_options: {}) + # + # @param session_id [String] + # Opaque Live session identifier from the creation response or incoming-call + # webhook. Preserve the returned value unchanged, including its prefix. + # + # @param target_uri [String] + # Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or + # sip:agent@example.com. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see OpenAI::Models::Live::SessionReferParams + def refer(session_id, params) + parsed, options = OpenAI::Live::SessionReferParams.dump_request(params) + @client.request( + method: :post, + path: ["live/sessions/%1$s/refer", session_id], + body: parsed, + model: NilClass, + security: {bearer_auth: true}, + options: options + ) + end + + # Reject an incoming SIP call. + # + # @overload reject(session_id, status_code:, request_options: {}) + # + # @param session_id [String] + # Opaque Live session identifier from the creation response or incoming-call + # webhook. Preserve the returned value unchanged, including its prefix. + # + # @param status_code [Integer] + # SIP rejection status sent to the caller. This field is required. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see OpenAI::Models::Live::SessionRejectParams + def reject(session_id, params) + parsed, options = OpenAI::Live::SessionRejectParams.dump_request(params) + @client.request( + method: :post, + path: ["live/sessions/%1$s/reject", session_id], + body: parsed, + model: NilClass, + security: {bearer_auth: true}, + options: options + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/openai/resources/live/sideband.rb b/lib/openai/resources/live/sideband.rb new file mode 100644 index 000000000..6e909fee0 --- /dev/null +++ b/lib/openai/resources/live/sideband.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Live + class Sideband + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/openai/resources/webhooks.rb b/lib/openai/resources/webhooks.rb index 974db156f..1b8ad72c4 100644 --- a/lib/openai/resources/webhooks.rb +++ b/lib/openai/resources/webhooks.rb @@ -9,7 +9,7 @@ class Webhooks # @param headers [Hash] The webhook headers # @param webhook_secret [String, nil] The webhook secret (optional, will use client webhook secret or ENV["OPENAI_WEBHOOK_SECRET"] if not provided) # - # @return [OpenAI::Models::Webhooks::BatchCancelledWebhookEvent, OpenAI::Models::Webhooks::BatchCompletedWebhookEvent, OpenAI::Models::Webhooks::BatchExpiredWebhookEvent, OpenAI::Models::Webhooks::BatchFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunCanceledWebhookEvent, OpenAI::Models::Webhooks::EvalRunFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunSucceededWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobCancelledWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobFailedWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobSucceededWebhookEvent, OpenAI::Models::Webhooks::LiveCallIncomingWebhookEvent, OpenAI::Models::Webhooks::RealtimeCallIncomingWebhookEvent, OpenAI::Models::Webhooks::ResponseCancelledWebhookEvent, OpenAI::Models::Webhooks::ResponseCompletedWebhookEvent, OpenAI::Models::Webhooks::ResponseFailedWebhookEvent, OpenAI::Models::Webhooks::ResponseIncompleteWebhookEvent, OpenAI::Models::Webhooks::SafetyAlertCreatedWebhookEvent, OpenAI::Models::Webhooks::SafetyOrgAlertCreatedWebhookEvent] + # @return [OpenAI::Models::Webhooks::BatchCancelledWebhookEvent, OpenAI::Models::Webhooks::BatchCompletedWebhookEvent, OpenAI::Models::Webhooks::BatchExpiredWebhookEvent, OpenAI::Models::Webhooks::BatchFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunCanceledWebhookEvent, OpenAI::Models::Webhooks::EvalRunFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunSucceededWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobCancelledWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobFailedWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobSucceededWebhookEvent, OpenAI::Models::Webhooks::LiveCallIncomingWebhookEvent, OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent, OpenAI::Models::Webhooks::RealtimeCallIncomingWebhookEvent, OpenAI::Models::Webhooks::ResponseCancelledWebhookEvent, OpenAI::Models::Webhooks::ResponseCompletedWebhookEvent, OpenAI::Models::Webhooks::ResponseFailedWebhookEvent, OpenAI::Models::Webhooks::ResponseIncompleteWebhookEvent, OpenAI::Models::Webhooks::SafetyAlertCreatedWebhookEvent, OpenAI::Models::Webhooks::SafetyOrgAlertCreatedWebhookEvent] # # @raise [ArgumentError] if signature verification fails def unwrap( diff --git a/rbi/openai/client.rbi b/rbi/openai/client.rbi index 31f7a5b45..7c2dc9896 100644 --- a/rbi/openai/client.rbi +++ b/rbi/openai/client.rbi @@ -98,6 +98,9 @@ module OpenAI sig { returns(OpenAI::Resources::Responses) } attr_reader :responses + sig { returns(OpenAI::Resources::Live) } + attr_reader :live + sig { returns(OpenAI::Resources::Realtime) } attr_reader :realtime diff --git a/rbi/openai/models.rbi b/rbi/openai/models.rbi index 7d44c1c85..21f0d0dd6 100644 --- a/rbi/openai/models.rbi +++ b/rbi/openai/models.rbi @@ -150,6 +150,8 @@ module OpenAI ImagesResponse = OpenAI::Models::ImagesResponse + Live = OpenAI::Models::Live + Metadata = T.let(OpenAI::Models::Metadata, OpenAI::Internal::Type::Converter) Model = OpenAI::Models::Model diff --git a/rbi/openai/models/beta/beta_response_input_item.rbi b/rbi/openai/models/beta/beta_response_input_item.rbi index fe5c6b61f..cfa192724 100644 --- a/rbi/openai/models/beta/beta_response_input_item.rbi +++ b/rbi/openai/models/beta/beta_response_input_item.rbi @@ -2100,6 +2100,10 @@ module OpenAI sig { returns(Symbol) } attr_accessor :type + # The action used for image generation. + sig { returns(T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action::OrSymbol)) } + attr_accessor :action + # The agent that produced this item. sig { returns(T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Agent)) } attr_reader :agent @@ -2109,11 +2113,23 @@ module OpenAI } attr_writer :agent + # The background setting used for generation. + sig { returns(T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background::OrSymbol)) } + attr_accessor :background + + # The output format used for generation. + sig { returns(T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat::OrSymbol)) } + attr_accessor :output_format + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. sig { returns(T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Quality::OrSymbol)) } attr_accessor :quality + # The prompt that was used after any model prompt rewriting. + sig { returns(T.nilable(String)) } + attr_accessor :revised_prompt + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. sig { returns(T.nilable(T.any(String, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Size::OrSymbol))) @@ -2130,10 +2146,18 @@ module OpenAI status: OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Status::OrSymbol, + action: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action::OrSymbol), + agent: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Agent::OrHash), + background: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background::OrSymbol), + + output_format: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat::OrSymbol), + quality: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), + size: T.nilable(T.any(String, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Size::OrSymbol)), type: Symbol @@ -2151,13 +2175,25 @@ module OpenAI # The status of the image generation call. status:, + # The action used for image generation. + action: nil, + # The agent that produced this item. agent: nil, + # The background setting used for generation. + background: nil, + + # The output format used for generation. + output_format: nil, + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. quality: nil, + # The prompt that was used after any model prompt rewriting. + revised_prompt: nil, + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. size: nil, @@ -2174,8 +2210,14 @@ module OpenAI result: T.nilable(String), status: OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Status::OrSymbol, type: Symbol, + action: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action::OrSymbol), agent: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Agent), + background: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background::OrSymbol), + output_format: T.nilable( + OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat::OrSymbol + ), quality: T.nilable(OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), size: T.nilable(T.any(String, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Size::OrSymbol)) } ) @@ -2213,6 +2255,26 @@ module OpenAI end end + # The action used for image generation. + module Action + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GENERATE = T.let(:generate, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action::TaggedSymbol) + EDIT = T.let(:edit, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Action::TaggedSymbol]) + } + def self.values + end + end + class Agent < OpenAI::Internal::Type::BaseModel OrHash = T.type_alias do T.any( @@ -2251,6 +2313,53 @@ module OpenAI end + # The background setting used for generation. + module Background + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSPARENT = T.let( + :transparent, + OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background::TaggedSymbol + ) + OPAQUE = T.let(:opaque, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Background::TaggedSymbol] + ) + } + def self.values + end + end + + # The output format used for generation. + module OutputFormat + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PNG = T.let(:png, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + WEBP = T.let(:webp, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + JPEG = T.let(:jpeg, OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::OutputFormat::TaggedSymbol] + ) + } + def self.values + end + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. module Quality diff --git a/rbi/openai/models/beta/beta_response_item.rbi b/rbi/openai/models/beta/beta_response_item.rbi index ce38a3730..55bcd66e5 100644 --- a/rbi/openai/models/beta/beta_response_item.rbi +++ b/rbi/openai/models/beta/beta_response_item.rbi @@ -1353,6 +1353,10 @@ module OpenAI sig { returns(Symbol) } attr_accessor :type + # The action used for image generation. + sig { returns(T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action::TaggedSymbol)) } + attr_accessor :action + # The agent that produced this item. sig { returns(T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent)) } attr_reader :agent @@ -1360,11 +1364,23 @@ module OpenAI sig { params(agent: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent::OrHash)).void } attr_writer :agent + # The background setting used for generation. + sig { returns(T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background::TaggedSymbol)) } + attr_accessor :background + + # The output format used for generation. + sig { returns(T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol)) } + attr_accessor :output_format + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. sig { returns(T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Quality::TaggedSymbol)) } attr_accessor :quality + # The prompt that was used after any model prompt rewriting. + sig { returns(T.nilable(String)) } + attr_accessor :revised_prompt + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. sig { returns(T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Size::Variants)) } attr_accessor :size @@ -1379,10 +1395,18 @@ module OpenAI status: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Status::OrSymbol, + action: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action::OrSymbol), + agent: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent::OrHash), + background: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background::OrSymbol), + + output_format: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat::OrSymbol), + quality: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), + size: T.nilable(T.any(String, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Size::OrSymbol)), type: Symbol @@ -1400,13 +1424,25 @@ module OpenAI # The status of the image generation call. status:, + # The action used for image generation. + action: nil, + # The agent that produced this item. agent: nil, + # The background setting used for generation. + background: nil, + + # The output format used for generation. + output_format: nil, + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. quality: nil, + # The prompt that was used after any model prompt rewriting. + revised_prompt: nil, + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. size: nil, @@ -1423,8 +1459,14 @@ module OpenAI result: T.nilable(String), status: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Status::TaggedSymbol, type: Symbol, + action: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action::TaggedSymbol), agent: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent), + background: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background::TaggedSymbol), + output_format: T.nilable( + OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol + ), quality: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Quality::TaggedSymbol), + revised_prompt: T.nilable(String), size: T.nilable(OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Size::Variants) } ) @@ -1451,6 +1493,24 @@ module OpenAI end end + # The action used for image generation. + module Action + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GENERATE = T.let(:generate, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action::TaggedSymbol) + EDIT = T.let(:edit, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action::TaggedSymbol]) + } + def self.values + end + end + class Agent < OpenAI::Internal::Type::BaseModel OrHash = T.type_alias do T.any( @@ -1489,6 +1549,51 @@ module OpenAI end + # The background setting used for generation. + module Background + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSPARENT = T.let( + :transparent, + OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background::TaggedSymbol + ) + OPAQUE = T.let(:opaque, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background::TaggedSymbol]) + } + def self.values + end + end + + # The output format used for generation. + module OutputFormat + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PNG = T.let(:png, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + WEBP = T.let(:webp, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + JPEG = T.let(:jpeg, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol] + ) + } + def self.values + end + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. module Quality diff --git a/rbi/openai/models/beta/beta_response_output_item.rbi b/rbi/openai/models/beta/beta_response_output_item.rbi index d19dca617..86585019d 100644 --- a/rbi/openai/models/beta/beta_response_output_item.rbi +++ b/rbi/openai/models/beta/beta_response_output_item.rbi @@ -1381,6 +1381,10 @@ module OpenAI sig { returns(Symbol) } attr_accessor :type + # The action used for image generation. + sig { returns(T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol)) } + attr_accessor :action + # The agent that produced this item. sig { returns(T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent)) } attr_reader :agent @@ -1390,11 +1394,27 @@ module OpenAI } attr_writer :agent + # The background setting used for generation. + sig { + returns(T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol)) + } + attr_accessor :background + + # The output format used for generation. + sig { + returns(T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol)) + } + attr_accessor :output_format + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. sig { returns(T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Quality::TaggedSymbol)) } attr_accessor :quality + # The prompt that was used after any model prompt rewriting. + sig { returns(T.nilable(String)) } + attr_accessor :revised_prompt + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. sig { returns(T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Size::Variants)) } attr_accessor :size @@ -1409,10 +1429,20 @@ module OpenAI status: OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Status::OrSymbol, + action: T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action::OrSymbol), + agent: T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent::OrHash), + background: T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background::OrSymbol), + + output_format: T.nilable( + OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat::OrSymbol + ), + quality: T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), + size: T.nilable(T.any(String, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Size::OrSymbol)), type: Symbol @@ -1430,13 +1460,25 @@ module OpenAI # The status of the image generation call. status:, + # The action used for image generation. + action: nil, + # The agent that produced this item. agent: nil, + # The background setting used for generation. + background: nil, + + # The output format used for generation. + output_format: nil, + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. quality: nil, + # The prompt that was used after any model prompt rewriting. + revised_prompt: nil, + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. size: nil, @@ -1453,8 +1495,16 @@ module OpenAI result: T.nilable(String), status: OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Status::TaggedSymbol, type: Symbol, + action: T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol), agent: T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent), + background: T.nilable( + OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol + ), + output_format: T.nilable( + OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol + ), quality: T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Quality::TaggedSymbol), + revised_prompt: T.nilable(String), size: T.nilable(OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Size::Variants) } ) @@ -1494,6 +1544,28 @@ module OpenAI end end + # The action used for image generation. + module Action + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GENERATE = T.let(:generate, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol) + EDIT = T.let(:edit, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol] + ) + } + def self.values + end + end + class Agent < OpenAI::Internal::Type::BaseModel OrHash = T.type_alias do T.any( @@ -1532,6 +1604,53 @@ module OpenAI end + # The background setting used for generation. + module Background + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSPARENT = T.let( + :transparent, + OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol + ) + OPAQUE = T.let(:opaque, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol] + ) + } + def self.values + end + end + + # The output format used for generation. + module OutputFormat + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PNG = T.let(:png, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + WEBP = T.let(:webp, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + JPEG = T.let(:jpeg, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol] + ) + } + def self.values + end + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. module Quality diff --git a/rbi/openai/models/conversations/conversation_item.rbi b/rbi/openai/models/conversations/conversation_item.rbi index 111ae71c4..592d983bc 100644 --- a/rbi/openai/models/conversations/conversation_item.rbi +++ b/rbi/openai/models/conversations/conversation_item.rbi @@ -71,6 +71,24 @@ module OpenAI sig { returns(Symbol) } attr_accessor :type + # The action used for image generation. + sig { + returns(T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action::TaggedSymbol)) + } + attr_accessor :action + + # The background setting used for generation. + sig { + returns(T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background::TaggedSymbol)) + } + attr_accessor :background + + # The output format used for generation. + sig { + returns(T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol)) + } + attr_accessor :output_format + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. sig { @@ -78,6 +96,10 @@ module OpenAI } attr_accessor :quality + # The prompt that was used after any model prompt rewriting. + sig { returns(T.nilable(String)) } + attr_accessor :revised_prompt + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. sig { returns(T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size::Variants)) } attr_accessor :size @@ -92,8 +114,18 @@ module OpenAI status: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::OrSymbol, + action: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action::OrSymbol), + + background: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background::OrSymbol), + + output_format: T.nilable( + OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::OrSymbol + ), + quality: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), + size: T.nilable( T.any(String, OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size::OrSymbol) ), @@ -113,10 +145,22 @@ module OpenAI # The status of the image generation call. status:, + # The action used for image generation. + action: nil, + + # The background setting used for generation. + background: nil, + + # The output format used for generation. + output_format: nil, + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. quality: nil, + # The prompt that was used after any model prompt rewriting. + revised_prompt: nil, + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. size: nil, @@ -133,7 +177,15 @@ module OpenAI result: T.nilable(String), status: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::TaggedSymbol, type: Symbol, + action: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action::TaggedSymbol), + background: T.nilable( + OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background::TaggedSymbol + ), + output_format: T.nilable( + OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol + ), quality: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Quality::TaggedSymbol), + revised_prompt: T.nilable(String), size: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size::Variants) } ) @@ -173,6 +225,87 @@ module OpenAI end end + # The action used for image generation. + module Action + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GENERATE = T.let( + :generate, + OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action::TaggedSymbol + ) + EDIT = T.let(:edit, OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action::TaggedSymbol] + ) + } + def self.values + end + end + + # The background setting used for generation. + module Background + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSPARENT = T.let( + :transparent, + OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background::TaggedSymbol + ) + OPAQUE = T.let( + :opaque, + OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background::TaggedSymbol + ) + AUTO = T.let(:auto, OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background::TaggedSymbol] + ) + } + def self.values + end + end + + # The output format used for generation. + module OutputFormat + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PNG = T.let(:png, OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + WEBP = T.let( + :webp, + OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol + ) + JPEG = T.let( + :jpeg, + OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol + ) + + sig { + override.returns( + T::Array[OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol] + ) + } + def self.values + end + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. module Quality diff --git a/rbi/openai/models/live/audio_format.rbi b/rbi/openai/models/live/audio_format.rbi new file mode 100644 index 000000000..8d30a540e --- /dev/null +++ b/rbi/openai/models/live/audio_format.rbi @@ -0,0 +1,185 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + module AudioFormat + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Live::AudioFormat::AudioPCM, + OpenAI::Live::AudioFormat::AudioPCMU, + OpenAI::Live::AudioFormat::AudioPCMA + ) + end + + class AudioPCM < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::AudioFormat::AudioPCM, + OpenAI::Internal::AnyHash + ) + end + + # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz. + sig { returns(OpenAI::Live::AudioFormat::AudioPCM::Rate::OrInteger) } + attr_accessor :rate + + # The audio encoding. Always `audio/pcm`. + sig { returns(Symbol) } + attr_accessor :type + + # Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection. + sig do + params( + + rate: OpenAI::Live::AudioFormat::AudioPCM::Rate::OrInteger, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz. + rate:, + + # The audio encoding. Always `audio/pcm`. + + type: :"audio/pcm" + ) + end + + sig do + override.returns( + {rate: OpenAI::Live::AudioFormat::AudioPCM::Rate::OrInteger, type: Symbol} + ) + end + def to_hash + end + + # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz. + module Rate + extend OpenAI::Internal::Type::Enum + + TaggedInteger = T.type_alias { T.all(Integer, OpenAI::Live::AudioFormat::AudioPCM::Rate) } + OrInteger = T.type_alias { Integer } + + RATE_16000 = T.let(16_000, OpenAI::Live::AudioFormat::AudioPCM::Rate::TaggedInteger) + RATE_24000 = T.let(24_000, OpenAI::Live::AudioFormat::AudioPCM::Rate::TaggedInteger) + + sig { override.returns(T::Array[OpenAI::Live::AudioFormat::AudioPCM::Rate::TaggedInteger]) } + def self.values + end + end + end + + class AudioPCMU < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::AudioFormat::AudioPCMU, + OpenAI::Internal::AnyHash + ) + end + + # Audio sample rate in hertz. G.711 audio uses 8000 Hz. + sig { returns(Integer) } + attr_accessor :rate + + # The audio encoding. Always `audio/pcmu`. + sig { returns(Symbol) } + attr_accessor :type + + # Raw, mono G.711 μ-law audio for a Live WebSocket connection. + sig do + params( + + rate: Integer, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Audio sample rate in hertz. G.711 audio uses 8000 Hz. + rate:, + + # The audio encoding. Always `audio/pcmu`. + + type: :"audio/pcmu" + ) + end + + sig do + override.returns( + {rate: Integer, type: Symbol} + ) + end + def to_hash + end + + end + + class AudioPCMA < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::AudioFormat::AudioPCMA, + OpenAI::Internal::AnyHash + ) + end + + # Audio sample rate in hertz. G.711 audio uses 8000 Hz. + sig { returns(Integer) } + attr_accessor :rate + + # The audio encoding. Always `audio/pcma`. + sig { returns(Symbol) } + attr_accessor :type + + # Raw, mono G.711 A-law audio for a Live WebSocket connection. + sig do + params( + + rate: Integer, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Audio sample rate in hertz. G.711 audio uses 8000 Hz. + rate:, + + # The audio encoding. Always `audio/pcma`. + + type: :"audio/pcma" + ) + end + + sig do + override.returns( + {rate: Integer, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::AudioFormat::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/built_in_voice.rbi b/rbi/openai/models/live/built_in_voice.rbi new file mode 100644 index 000000000..7c6002f31 --- /dev/null +++ b/rbi/openai/models/live/built_in_voice.rbi @@ -0,0 +1,46 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + # A built-in voice available for Live speech. + module BuiltInVoice + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::BuiltInVoice) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ALLOY = T.let(:alloy, OpenAI::Live::BuiltInVoice::TaggedSymbol) + ASH = T.let(:ash, OpenAI::Live::BuiltInVoice::TaggedSymbol) + BALLAD = T.let(:ballad, OpenAI::Live::BuiltInVoice::TaggedSymbol) + BEACON = T.let(:beacon, OpenAI::Live::BuiltInVoice::TaggedSymbol) + BOSSA = T.let(:bossa, OpenAI::Live::BuiltInVoice::TaggedSymbol) + CEDAR = T.let(:cedar, OpenAI::Live::BuiltInVoice::TaggedSymbol) + CINDER = T.let(:cinder, OpenAI::Live::BuiltInVoice::TaggedSymbol) + CORAL = T.let(:coral, OpenAI::Live::BuiltInVoice::TaggedSymbol) + DELTA = T.let(:delta, OpenAI::Live::BuiltInVoice::TaggedSymbol) + ECHO = T.let(:echo, OpenAI::Live::BuiltInVoice::TaggedSymbol) + GLEAM = T.let(:gleam, OpenAI::Live::BuiltInVoice::TaggedSymbol) + MARIN = T.let(:marin, OpenAI::Live::BuiltInVoice::TaggedSymbol) + MERIDIAN = T.let(:meridian, OpenAI::Live::BuiltInVoice::TaggedSymbol) + QUARTZ = T.let(:quartz, OpenAI::Live::BuiltInVoice::TaggedSymbol) + RIPPLE = T.let(:ripple, OpenAI::Live::BuiltInVoice::TaggedSymbol) + SAGE = T.let(:sage, OpenAI::Live::BuiltInVoice::TaggedSymbol) + SHIMMER = T.let(:shimmer, OpenAI::Live::BuiltInVoice::TaggedSymbol) + STONE = T.let(:stone, OpenAI::Live::BuiltInVoice::TaggedSymbol) + TEMPO = T.let(:tempo, OpenAI::Live::BuiltInVoice::TaggedSymbol) + VERSE = T.let(:verse, OpenAI::Live::BuiltInVoice::TaggedSymbol) + VESPER = T.let(:vesper, OpenAI::Live::BuiltInVoice::TaggedSymbol) + WILLOW = T.let(:willow, OpenAI::Live::BuiltInVoice::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::BuiltInVoice::TaggedSymbol]) } + def self.values + end + end + + end + + end +end diff --git a/rbi/openai/models/live/client_config.rbi b/rbi/openai/models/live/client_config.rbi new file mode 100644 index 000000000..cb1c730e9 --- /dev/null +++ b/rbi/openai/models/live/client_config.rbi @@ -0,0 +1,54 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ClientConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ClientConfig, + OpenAI::Internal::AnyHash + ) + end + + # Client and server event permissions for the WebRTC frontend data channel. + sig { returns(OpenAI::Live::DataChannelConfig) } + attr_reader :data_channel + + sig { params(data_channel: OpenAI::Live::DataChannelConfig::OrHash).void } + attr_writer :data_channel + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + sig do + params( + + data_channel: OpenAI::Live::DataChannelConfig::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Client and server event permissions for the WebRTC frontend data channel. + + data_channel: + ) + end + + sig do + override.returns( + {data_channel: OpenAI::Live::DataChannelConfig} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/client_delegation.rbi b/rbi/openai/models/live/client_delegation.rbi new file mode 100644 index 000000000..6e14ae7f7 --- /dev/null +++ b/rbi/openai/models/live/client_delegation.rbi @@ -0,0 +1,51 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ClientDelegation < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ClientDelegation, + OpenAI::Internal::AnyHash + ) + end + + # The delegation owner. Always `client` for tasks handled by your application. + sig { returns(Symbol) } + attr_accessor :type + + # Delegate tasks to your application. The Live session emits delegation events + # that your backend handles. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The delegation owner. Always `client` for tasks handled by your application. + + type: :client + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/client_event.rbi b/rbi/openai/models/live/client_event.rbi new file mode 100644 index 000000000..ff74f8401 --- /dev/null +++ b/rbi/openai/models/live/client_event.rbi @@ -0,0 +1,41 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + # Client events for Live. Initialize a primary WebSocket with session.start and + # wait for session.started. WebRTC creation already starts the session. Audio + # append is primary WebSocket-only. See the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # before writing frontend instructions and delegation policies. + module ClientEvent + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Live::SessionStartEvent, + OpenAI::Live::SessionUpdateEvent, + OpenAI::Live::InputAudioAppendEvent, + OpenAI::Live::InputAudioMuteEvent, + OpenAI::Live::InputAudioUnmuteEvent, + OpenAI::Live::InstructionsAppendEvent, + OpenAI::Live::ThinkingAppendEvent, + OpenAI::Live::CommentaryAppendEvent, + OpenAI::Live::ResponseItemCreateEvent, + OpenAI::Live::ResponseCreateEvent, + OpenAI::Live::SessionCloseEvent + ) + end + + sig { override.returns(T::Array[OpenAI::Live::ClientEvent::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/commentary_append_event.rbi b/rbi/openai/models/live/commentary_append_event.rbi new file mode 100644 index 000000000..d94fe3923 --- /dev/null +++ b/rbi/openai/models/live/commentary_append_event.rbi @@ -0,0 +1,88 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class CommentaryAppendEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::CommentaryAppendEvent, + OpenAI::Internal::AnyHash + ) + end + + # Speakable context for the Live model, limited to 500 tokens. Use this for a + # result the model should communicate; use session.thinking.append for silent + # context. + sig { returns(String) } + attr_accessor :content + + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + sig { returns(T.nilable(String)) } + attr_accessor :delegation_id + + # The Live client event type. Always `session.commentary.append`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Provide context the Live model can communicate to the user, optionally for an + # existing client delegation. + sig do + params( + + content: String, + + delegation_id: T.nilable(String), + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Speakable context for the Live model, limited to 500 tokens. Use this for a + # result the model should communicate; use session.thinking.append for silent + # context. + content:, + + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + delegation_id:, + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.commentary.append`. + + type: :"session.commentary.append" + ) + end + + sig do + override.returns( + {content: String, delegation_id: T.nilable(String), type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/commentary_appended_event.rbi b/rbi/openai/models/live/commentary_appended_event.rbi new file mode 100644 index 000000000..248fb53c2 --- /dev/null +++ b/rbi/openai/models/live/commentary_appended_event.rbi @@ -0,0 +1,97 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class CommentaryAppendedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::CommentaryAppendedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + sig { returns(Integer) } + attr_accessor :end_ms + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + sig { returns(Integer) } + attr_accessor :start_ms + + # The event type, always `session.commentary.appended`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned when a session.commentary.append command is accepted into the Live + # session timeline. Acknowledges the added commentary without guaranteeing exact + # wording or completed audio playback. + sig do + params( + + end_ms: Integer, + + event_id: String, + + start_ms: Integer, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + end_ms:, + + # The unique ID of the Live server event. + event_id:, + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + start_ms:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.commentary.appended`. + + type: :"session.commentary.appended" + ) + end + + sig do + override.returns( + {end_ms: Integer, event_id: String, start_ms: Integer, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/custom_voice.rbi b/rbi/openai/models/live/custom_voice.rbi new file mode 100644 index 000000000..0ed9444c5 --- /dev/null +++ b/rbi/openai/models/live/custom_voice.rbi @@ -0,0 +1,46 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class CustomVoice < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::CustomVoice, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig do + params( + + id: String + ) + .returns(T.attached_class) + end + def self.new( + + id: + ) + end + + sig do + override.returns( + {id: String} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/data_channel_config.rbi b/rbi/openai/models/live/data_channel_config.rbi new file mode 100644 index 000000000..47b391dab --- /dev/null +++ b/rbi/openai/models/live/data_channel_config.rbi @@ -0,0 +1,119 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class DataChannelConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::DataChannelConfig, + OpenAI::Internal::AnyHash + ) + end + + # Client event types that the frontend data channel may send. Use 'all' to allow + # every client event; an empty array allows none. Omission preserves the existing + # allow-all behavior. + sig { returns(T.nilable(OpenAI::Live::DataChannelConfig::AllowedClientEvents::Variants)) } + attr_reader :allowed_client_events + + sig { params(allowed_client_events: OpenAI::Live::DataChannelConfig::AllowedClientEvents::Variants).void } + attr_writer :allowed_client_events + + # Server events that may be sent to the frontend data channel. Use 'all' to allow + # every server event; an empty array allows none. Omission preserves the existing + # allow-all behavior. Responses events use an object with type 'response.event' + # and a response_event selector. + sig { returns(T.nilable(T.any(Symbol, T::Array[OpenAI::Live::ServerEventSelector]))) } + attr_reader :allowed_server_events + + sig { params(allowed_server_events: T.any(Symbol, T::Array[OpenAI::Live::ServerEventSelector::OrHash])).void } + attr_writer :allowed_server_events + + # Control which Live events an untrusted WebRTC frontend can send and receive over + # its data channel. These restrictions do not apply to trusted sideband + # connections. + sig do + params( + + allowed_client_events: OpenAI::Live::DataChannelConfig::AllowedClientEvents::Variants, + + allowed_server_events: T.any(Symbol, T::Array[OpenAI::Live::ServerEventSelector::OrHash]) + ) + .returns(T.attached_class) + end + def self.new( + + # Client event types that the frontend data channel may send. Use 'all' to allow + # every client event; an empty array allows none. Omission preserves the existing + # allow-all behavior. + allowed_client_events: nil, + + # Server events that may be sent to the frontend data channel. Use 'all' to allow + # every server event; an empty array allows none. Omission preserves the existing + # allow-all behavior. Responses events use an object with type 'response.event' + # and a response_event selector. + + allowed_server_events: nil + ) + end + + sig do + override.returns( + { + allowed_client_events: OpenAI::Live::DataChannelConfig::AllowedClientEvents::Variants, + allowed_server_events: T.any(Symbol, T::Array[OpenAI::Live::ServerEventSelector]) + } + ) + end + def to_hash + end + + # Client event types that the frontend data channel may send. Use 'all' to allow + # every client event; an empty array allows none. Omission preserves the existing + # allow-all behavior. + module AllowedClientEvents + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { T.any(Symbol, T::Array[String]) } + + sig { override.returns(T::Array[OpenAI::Live::DataChannelConfig::AllowedClientEvents::Variants]) } + def self.variants + end + + StringArray = T.let( + OpenAI::Internal::Type::ArrayOf[String], + OpenAI::Internal::Type::Converter + ) + + end + + # Server events that may be sent to the frontend data channel. Use 'all' to allow + # every server event; an empty array allows none. Omission preserves the existing + # allow-all behavior. Responses events use an object with type 'response.event' + # and a response_event selector. + module AllowedServerEvents + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { T.any(Symbol, T::Array[OpenAI::Live::ServerEventSelector]) } + + sig { override.returns(T::Array[OpenAI::Live::DataChannelConfig::AllowedServerEvents::Variants]) } + def self.variants + end + + ServerEventSelectorArray = T.let( + OpenAI::Internal::Type::ArrayOf[OpenAI::Live::ServerEventSelector], + OpenAI::Internal::Type::Converter + ) + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/delegation_created_event.rbi b/rbi/openai/models/live/delegation_created_event.rbi new file mode 100644 index 000000000..afd8c2e50 --- /dev/null +++ b/rbi/openai/models/live/delegation_created_event.rbi @@ -0,0 +1,207 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class DelegationCreatedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::DelegationCreatedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The delegated work identifier and destination. This object contains metadata, + # not the task text. + sig { returns(OpenAI::Live::DelegationCreatedEvent::Delegation) } + attr_reader :delegation + + sig { params(delegation: OpenAI::Live::DelegationCreatedEvent::Delegation::OrHash).void } + attr_writer :delegation + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The position on the Live session timeline where the delegation was created, in + # milliseconds from the beginning of the session. + sig { returns(Integer) } + attr_accessor :offset_ms + + # The event type, always `session.delegation.created`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned when the Live model delegates work to your application or a Responses + # backend. Contains delegation metadata and the position on the session timeline + # where the work was delegated. + sig do + params( + + delegation: OpenAI::Live::DelegationCreatedEvent::Delegation::OrHash, + + event_id: String, + + offset_ms: Integer, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The delegated work identifier and destination. This object contains metadata, + # not the task text. + delegation:, + + # The unique ID of the Live server event. + event_id:, + + # The position on the Live session timeline where the delegation was created, in + # milliseconds from the beginning of the session. + offset_ms:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.delegation.created`. + + type: :"session.delegation.created" + ) + end + + sig do + override.returns( + { + delegation: OpenAI::Live::DelegationCreatedEvent::Delegation, + event_id: String, + offset_ms: Integer, + type: Symbol, + client_event_id: T.nilable(String) + } + ) + end + def to_hash + end + + class Delegation < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::DelegationCreatedEvent::Delegation, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the delegation. Use this as delegation_id when replying to + # client-owned work or correlating Responses events. + sig { returns(String) } + attr_accessor :id + + # Where the Live model delegated the work: `client` for your application, or + # `responses` for the configured Responses backend. + sig { returns(OpenAI::Live::DelegationCreatedEvent::Delegation::Target::OrSymbol) } + attr_accessor :target + + # The object type, always `delegation`. + sig { returns(Symbol) } + attr_accessor :type + + # The ID of the Responses API response associated with a Responses delegation. + # Omitted for client delegations. + sig { returns(T.nilable(String)) } + attr_reader :response_id + + sig { params(response_id: String).void } + attr_writer :response_id + + # The delegated work identifier and destination. This object contains metadata, + # not the task text. + sig do + params( + + id: String, + + target: OpenAI::Live::DelegationCreatedEvent::Delegation::Target::OrSymbol, + + response_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the delegation. Use this as delegation_id when replying to + # client-owned work or correlating Responses events. + id:, + + # Where the Live model delegated the work: `client` for your application, or + # `responses` for the configured Responses backend. + target:, + + # The ID of the Responses API response associated with a Responses delegation. + # Omitted for client delegations. + response_id: nil, + + # The object type, always `delegation`. + + type: :delegation + ) + end + + sig do + override.returns( + { + id: String, + target: OpenAI::Live::DelegationCreatedEvent::Delegation::Target::OrSymbol, + type: Symbol, + response_id: T.nilable(String) + } + ) + end + def to_hash + end + + # Where the Live model delegated the work: `client` for your application, or + # `responses` for the configured Responses backend. + module Target + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { OpenAI::Live::DelegationCreatedEvent::Delegation::Target::TaggedSymbol } + + sig { override.returns(T::Array[OpenAI::Live::DelegationCreatedEvent::Delegation::Target::Variants]) } + def self.variants + end + + TaggedSymbol = T.type_alias do + T.all(Symbol, OpenAI::Live::DelegationCreatedEvent::Delegation::Target) + end + + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CLIENT = T.let(:client, OpenAI::Live::DelegationCreatedEvent::Delegation::Target::TaggedSymbol) + RESPONSES = T.let(:responses, OpenAI::Live::DelegationCreatedEvent::Delegation::Target::TaggedSymbol) + + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/error.rbi b/rbi/openai/models/live/error.rbi new file mode 100644 index 000000000..d76e92736 --- /dev/null +++ b/rbi/openai/models/live/error.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class Error < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::Error, + OpenAI::Internal::AnyHash + ) + end + + # A machine-readable code identifying the Live error, such as `unknown_parameter`. + sig { returns(String) } + attr_accessor :code + + # A human-readable explanation of the Live error. + sig { returns(String) } + attr_accessor :message + + # The category of error, such as `invalid_request_error` for an invalid Live + # client command. + sig { returns(String) } + attr_accessor :type + + # The event_id of the client command that caused the error, when supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # The parameter that caused the error, when applicable, such as `session.voice`. + sig { returns(T.nilable(String)) } + attr_reader :param + + sig { params(param: String).void } + attr_writer :param + + # Details of an error encountered by the Live session, including the affected + # parameter or client command when available. + sig do + params( + + code: String, + + message: String, + + type: String, + + client_event_id: String, + + param: String + ) + .returns(T.attached_class) + end + def self.new( + + # A machine-readable code identifying the Live error, such as `unknown_parameter`. + code:, + + # A human-readable explanation of the Live error. + message:, + + # The category of error, such as `invalid_request_error` for an invalid Live + # client command. + type:, + + # The event_id of the client command that caused the error, when supplied. + client_event_id: nil, + + # The parameter that caused the error, when applicable, such as `session.voice`. + + param: nil + ) + end + + sig do + override.returns( + {code: String, message: String, type: String, client_event_id: String, param: String} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/error_event.rbi b/rbi/openai/models/live/error_event.rbi new file mode 100644 index 000000000..6d6e33b30 --- /dev/null +++ b/rbi/openai/models/live/error_event.rbi @@ -0,0 +1,87 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ErrorEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ErrorEvent, + OpenAI::Internal::AnyHash + ) + end + + # Details of the Live error and the client command that caused it, when known. + sig { returns(OpenAI::Live::Error) } + attr_reader :error + + sig { params(error: OpenAI::Live::Error::OrHash).void } + attr_writer :error + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, always `error`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Reports an error in the Live session, such as an invalid client command. Use + # error.client_event_id, when present, to identify the command that caused the + # error. + sig do + params( + + error: OpenAI::Live::Error::OrHash, + + event_id: String, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Details of the Live error and the client command that caused it, when known. + error:, + + # The unique ID of the Live server event. + event_id:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `error`. + + type: :error + ) + end + + sig do + override.returns( + {error: OpenAI::Live::Error, event_id: String, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/fork_client_event.rbi b/rbi/openai/models/live/fork_client_event.rbi new file mode 100644 index 000000000..d7af405d7 --- /dev/null +++ b/rbi/openai/models/live/fork_client_event.rbi @@ -0,0 +1,40 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + # Client events for a Live fork WebSocket. First send session.start with an + # overrides object (which may be empty), then wait for session.started before + # sending other commands. The model and conversation are inherited from the stored + # session. + module ForkClientEvent + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Live::ForkSessionStartEvent, + OpenAI::Live::SessionUpdateEvent, + OpenAI::Live::InputAudioAppendEvent, + OpenAI::Live::InputAudioMuteEvent, + OpenAI::Live::InputAudioUnmuteEvent, + OpenAI::Live::InstructionsAppendEvent, + OpenAI::Live::ThinkingAppendEvent, + OpenAI::Live::CommentaryAppendEvent, + OpenAI::Live::ResponseItemCreateEvent, + OpenAI::Live::ResponseCreateEvent, + OpenAI::Live::SessionCloseEvent + ) + end + + sig { override.returns(T::Array[OpenAI::Live::ForkClientEvent::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/fork_server_event.rbi b/rbi/openai/models/live/fork_server_event.rbi new file mode 100644 index 000000000..7f2b384ed --- /dev/null +++ b/rbi/openai/models/live/fork_server_event.rbi @@ -0,0 +1,436 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + # Server events for Live. Response lifecycle events are wrapped inside + # response.event; dispatch the nested event by its full type and tolerate new + # response event types. Follow the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # when designing the conversation and delegation policy. + module ForkServerEvent + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Live::SessionStartedEvent, + OpenAI::Live::SessionUpdatedEvent, + OpenAI::Live::InputAudioMutedEvent, + OpenAI::Live::InputAudioUnmutedEvent, + OpenAI::Live::InstructionsAppendedEvent, + OpenAI::Live::ThinkingAppendedEvent, + OpenAI::Live::CommentaryAppendedEvent, + OpenAI::Live::ForkServerEvent::SessionInputAudioAppend, + OpenAI::Live::OutputAudioDeltaEvent, + OpenAI::Live::InputTranscriptDeltaEvent, + OpenAI::Live::OutputTranscriptDeltaEvent, + OpenAI::Live::DelegationCreatedEvent, + OpenAI::Live::ResponseEvent, + OpenAI::Live::SessionUsageUpdatedEvent, + OpenAI::Live::SessionClosedEvent, + OpenAI::Live::ErrorEvent, + OpenAI::Live::InfoEvent, + OpenAI::Live::ForkServerEvent::TransportDtmfReceived, + OpenAI::Live::ForkServerEvent::TransportDtmfSend, + OpenAI::Live::ForkServerEvent::TransportRinging, + OpenAI::Live::ForkServerEvent::TransportAnswered, + OpenAI::Live::ForkServerEvent::TransportFailed + ) + end + + class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkServerEvent::SessionInputAudioAppend, + OpenAI::Internal::AnyHash + ) + end + + # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, + # reflected to the sideband before model-input muting. This server event uses the + # same audio key as the client command, but is not an acknowledgment of it. + sig { returns(String) } + attr_accessor :audio + + # The event type, always `session.input_audio.append`. + sig { returns(Symbol) } + attr_accessor :type + + # Input audio received from the primary transport and reflected to a Live sideband + # connection before model-input muting. + sig do + params( + + audio: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, + # reflected to the sideband before model-input muting. This server event uses the + # same audio key as the client command, but is not an acknowledgment of it. + audio:, + + # The event type, always `session.input_audio.append`. + + type: :"session.input_audio.append" + ) + end + + sig do + override.returns( + {audio: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportDtmfReceived < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkServerEvent::TransportDtmfReceived, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :event + + sig { returns(String) } + attr_accessor :event_id + + sig { returns(Symbol) } + attr_accessor :type + + # A SIP DTMF keypress received from the caller. Delivered only to sideband + # observers. + sig do + params( + + event: String, + + event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + event:, + + event_id:, + + type: :"transport.dtmf.received" + ) + end + + sig do + override.returns( + {event: String, event_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportDtmfSend < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkServerEvent::TransportDtmfSend, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :event + + sig { returns(String) } + attr_accessor :event_id + + sig { returns(Symbol) } + attr_accessor :type + + # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to + # sideband observers; this is not a client command. + sig do + params( + + event: String, + + event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + event:, + + event_id:, + + type: :"transport.dtmf.send" + ) + end + + sig do + override.returns( + {event: String, event_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportRinging < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkServerEvent::TransportRinging, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :event_id + + # The canonical Live session ID. + sig { returns(String) } + attr_accessor :session_id + + sig { returns(Symbol) } + attr_accessor :type + + # The outbound SIP provider leg is ringing or providing early media. Delivered + # only to sideband observers. + sig do + params( + + event_id: String, + + session_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + event_id:, + + # The canonical Live session ID. + session_id:, + + type: :"transport.ringing" + ) + end + + sig do + override.returns( + {event_id: String, session_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportAnswered < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkServerEvent::TransportAnswered, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :event_id + + # The canonical Live session ID. + sig { returns(String) } + attr_accessor :session_id + + sig { returns(Symbol) } + attr_accessor :type + + # The outbound SIP provider leg answered and media is established. Delivered only + # to sideband observers. + sig do + params( + + event_id: String, + + session_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + event_id:, + + # The canonical Live session ID. + session_id:, + + type: :"transport.answered" + ) + end + + sig do + override.returns( + {event_id: String, session_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportFailed < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkServerEvent::TransportFailed, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(OpenAI::Live::ForkServerEvent::TransportFailed::Error) } + attr_reader :error + + sig { params(error: OpenAI::Live::ForkServerEvent::TransportFailed::Error::OrHash).void } + attr_writer :error + + sig { returns(String) } + attr_accessor :event_id + + # The canonical Live session ID. + sig { returns(String) } + attr_accessor :session_id + + sig { returns(Symbol) } + attr_accessor :type + + # An asynchronous outbound SIP setup failure. Delivered only to sideband + # observers. + sig do + params( + + error: OpenAI::Live::ForkServerEvent::TransportFailed::Error::OrHash, + + event_id: String, + + session_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + error:, + + event_id:, + + # The canonical Live session ID. + session_id:, + + type: :"transport.failed" + ) + end + + sig do + override.returns( + { + error: OpenAI::Live::ForkServerEvent::TransportFailed::Error, + event_id: String, + session_id: String, + type: Symbol + } + ) + end + def to_hash + end + + class Error < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkServerEvent::TransportFailed::Error, + OpenAI::Internal::AnyHash + ) + end + + # The call setup failure code. + sig { returns(String) } + attr_accessor :code + + sig { returns(String) } + attr_accessor :message + + sig { returns(Symbol) } + attr_accessor :type + + # The parameter related to the error, if any. Empty when no parameter applies. + sig { returns(T.nilable(String)) } + attr_reader :param + + sig { params(param: String).void } + attr_writer :param + + sig do + params( + + code: String, + + message: String, + + param: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The call setup failure code. + code:, + + message:, + + # The parameter related to the error, if any. Empty when no parameter applies. + param: nil, + + type: :call_error + ) + end + + sig do + override.returns( + {code: String, message: String, type: Symbol, param: T.nilable(String)} + ) + end + def to_hash + end + + end + end + + sig { override.returns(T::Array[OpenAI::Live::ForkServerEvent::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/fork_session_config.rbi b/rbi/openai/models/live/fork_session_config.rbi new file mode 100644 index 000000000..bd1e9e9d2 --- /dev/null +++ b/rbi/openai/models/live/fork_session_config.rbi @@ -0,0 +1,234 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ForkSessionConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkSessionConfig, + OpenAI::Internal::AnyHash + ) + end + + # Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and + # must omit this field. + sig { returns(T.nilable(OpenAI::Live::ForkSessionConfig::Audio)) } + attr_reader :audio + + sig { params(audio: OpenAI::Live::ForkSessionConfig::Audio::OrHash).void } + attr_writer :audio + + # Frontend data-channel permissions for a WebRTC fork. Omitted permissions inherit + # the stored values. Not supported for WebSocket forks. + sig { returns(T.nilable(OpenAI::Live::ClientConfig)) } + attr_reader :client + + sig { params(client: OpenAI::Live::ClientConfig::OrHash).void } + attr_writer :client + + # Overrides for the stored session’s Responses backend. Only supported when the + # stored session already uses Responses delegation; the delegation type cannot + # change. + sig { returns(T.nilable(OpenAI::Live::ForkSessionConfig::Delegation)) } + attr_reader :delegation + + sig { params(delegation: OpenAI::Live::ForkSessionConfig::Delegation::OrHash).void } + attr_writer :delegation + + # Whether to store the forked session. Omission inherits the stored session's + # setting. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :store + + sig { params(store: T::Boolean).void } + attr_writer :store + + # Overrides for a stored session after connecting to the fork WebSocket. An empty + # object inherits the stored configuration; do not supply a new model. + # audio.format applies only to the new WebSocket connection. client overrides are + # only supported for WebRTC forks. + sig do + params( + + audio: OpenAI::Live::ForkSessionConfig::Audio::OrHash, + + client: OpenAI::Live::ClientConfig::OrHash, + + delegation: OpenAI::Live::ForkSessionConfig::Delegation::OrHash, + + store: T::Boolean + ) + .returns(T.attached_class) + end + def self.new( + + # Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and + # must omit this field. + audio: nil, + + # Frontend data-channel permissions for a WebRTC fork. Omitted permissions inherit + # the stored values. Not supported for WebSocket forks. + client: nil, + + # Overrides for the stored session’s Responses backend. Only supported when the + # stored session already uses Responses delegation; the delegation type cannot + # change. + delegation: nil, + + # Whether to store the forked session. Omission inherits the stored session's + # setting. + + store: nil + ) + end + + sig do + override.returns( + { + audio: OpenAI::Live::ForkSessionConfig::Audio, + client: OpenAI::Live::ClientConfig, + delegation: OpenAI::Live::ForkSessionConfig::Delegation, + store: T::Boolean + } + ) + end + def to_hash + end + + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkSessionConfig::Audio, + OpenAI::Internal::AnyHash + ) + end + + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + sig { + returns( + T.nilable( + T.any( + OpenAI::Live::AudioFormat::AudioPCM, + OpenAI::Live::AudioFormat::AudioPCMU, + OpenAI::Live::AudioFormat::AudioPCMA + ) + ) + ) + } + attr_reader :format_ + + sig { + params( + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM::OrHash, + OpenAI::Live::AudioFormat::AudioPCMU::OrHash, + OpenAI::Live::AudioFormat::AudioPCMA::OrHash + ) + ) + .void + } + attr_writer :format_ + + # Audio format for a WebSocket fork. WebRTC forks negotiate their audio format and + # must omit this field. + sig do + params( + + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM::OrHash, + OpenAI::Live::AudioFormat::AudioPCMU::OrHash, + OpenAI::Live::AudioFormat::AudioPCMA::OrHash + ) + ) + .returns(T.attached_class) + end + def self.new( + + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + + format_: nil + ) + end + + sig do + override.returns( + { + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM, + OpenAI::Live::AudioFormat::AudioPCMU, + OpenAI::Live::AudioFormat::AudioPCMA + ) + } + ) + end + def to_hash + end + + end + + class Delegation < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkSessionConfig::Delegation, + OpenAI::Internal::AnyHash + ) + end + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + sig { returns(Symbol) } + attr_accessor :type + + # Responses backend settings to update. Omitted settings keep their existing + # values. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig)) } + attr_reader :responses + + sig { params(responses: OpenAI::Live::ResponsesDelegationUpdateConfig::OrHash).void } + attr_writer :responses + + # Overrides for the stored session’s Responses backend. Only supported when the + # stored session already uses Responses delegation; the delegation type cannot + # change. + sig do + params( + + responses: OpenAI::Live::ResponsesDelegationUpdateConfig::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Responses backend settings to update. Omitted settings keep their existing + # values. + responses: nil, + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + + type: :responses + ) + end + + sig do + override.returns( + {type: Symbol, responses: OpenAI::Live::ResponsesDelegationUpdateConfig} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/fork_session_start_event.rbi b/rbi/openai/models/live/fork_session_start_event.rbi new file mode 100644 index 000000000..29a4a892a --- /dev/null +++ b/rbi/openai/models/live/fork_session_start_event.rbi @@ -0,0 +1,80 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ForkSessionStartEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ForkSessionStartEvent, + OpenAI::Internal::AnyHash + ) + end + + # Overrides for a stored session after connecting to the fork WebSocket. An empty + # object inherits the stored configuration; do not supply a new model. + # audio.format applies only to the new WebSocket connection. client overrides are + # only supported for WebRTC forks. + sig { returns(OpenAI::Live::ForkSessionConfig) } + attr_reader :session + + sig { params(session: OpenAI::Live::ForkSessionConfig::OrHash).void } + attr_writer :session + + # The Live client event type. Always `session.start`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Start a Live session after connecting to a stored session’s fork WebSocket. Send + # an empty `session` object to use the stored configuration. + sig do + params( + + session: OpenAI::Live::ForkSessionConfig::OrHash, + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Overrides for a stored session after connecting to the fork WebSocket. An empty + # object inherits the stored configuration; do not supply a new model. + # audio.format applies only to the new WebSocket connection. client overrides are + # only supported for WebRTC forks. + session:, + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.start`. + + type: :"session.start" + ) + end + + sig do + override.returns( + {session: OpenAI::Live::ForkSessionConfig, type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/function_tool.rbi b/rbi/openai/models/live/function_tool.rbi new file mode 100644 index 000000000..8f1959fec --- /dev/null +++ b/rbi/openai/models/live/function_tool.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class FunctionTool < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::FunctionTool, + OpenAI::Internal::AnyHash + ) + end + + # The name the delegated Responses model uses when calling this function. + sig { returns(String) } + attr_accessor :name + + # The tool type. Always `function`. + sig { returns(Symbol) } + attr_accessor :type + + # What the function does and when the delegated Responses model should call it. + sig { returns(T.nilable(String)) } + attr_accessor :description + + # A JSON Schema object describing the arguments accepted by the function. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :parameters + + # Whether the delegated Responses model must follow the function’s parameter + # schema exactly. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :strict + + # A function tool available to the Responses backend when the Live model delegates + # a task. + sig do + params( + + name: String, + + description: T.nilable(String), + + parameters: T.nilable(T::Hash[Symbol, T.anything]), + + strict: T.nilable(T::Boolean), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The name the delegated Responses model uses when calling this function. + name:, + + # What the function does and when the delegated Responses model should call it. + description: nil, + + # A JSON Schema object describing the arguments accepted by the function. + parameters: nil, + + # Whether the delegated Responses model must follow the function’s parameter + # schema exactly. + strict: nil, + + # The tool type. Always `function`. + + type: :function + ) + end + + sig do + override.returns( + { + name: String, + type: Symbol, + description: T.nilable(String), + parameters: T.nilable(T::Hash[Symbol, T.anything]), + strict: T.nilable(T::Boolean) + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/info_event.rbi b/rbi/openai/models/live/info_event.rbi new file mode 100644 index 000000000..588796dce --- /dev/null +++ b/rbi/openai/models/live/info_event.rbi @@ -0,0 +1,92 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InfoEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InfoEvent, + OpenAI::Internal::AnyHash + ) + end + + # A machine-readable code for the notice, such as `data_channel_permissions`. + sig { returns(String) } + attr_accessor :code + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # A human-readable explanation of the Live session notice. + sig { returns(String) } + attr_accessor :message + + # The event type, always `info`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # An informational notice about the Live session, such as the event permissions + # applied to a frontend data channel. + sig do + params( + + code: String, + + event_id: String, + + message: String, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # A machine-readable code for the notice, such as `data_channel_permissions`. + code:, + + # The unique ID of the Live server event. + event_id:, + + # A human-readable explanation of the Live session notice. + message:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `info`. + + type: :info + ) + end + + sig do + override.returns( + {code: String, event_id: String, message: String, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/initial_item.rbi b/rbi/openai/models/live/initial_item.rbi new file mode 100644 index 000000000..61d98df45 --- /dev/null +++ b/rbi/openai/models/live/initial_item.rbi @@ -0,0 +1,661 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + # A developer, user, or assistant message supplied as text history before the Live + # session starts. + module InitialItem + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + end + + class Developer < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Internal::AnyHash + ) + end + + # The message content. Supply exactly one text part for the initial Live + # conversation history. + sig { returns(T::Array[OpenAI::Live::InitialItem::Developer::Content]) } + attr_accessor :content + + # The author of this history message. Always `developer`. + sig { returns(Symbol) } + attr_accessor :role + + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + sig { returns(T.nilable(String)) } + attr_accessor :id + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + sig { returns(T.nilable(OpenAI::Live::InitialItem::Developer::Status::OrSymbol)) } + attr_accessor :status + + # The history item type. Always `message`. + sig { returns(T.nilable(OpenAI::Live::InitialItem::Developer::Type::OrSymbol)) } + attr_reader :type + + sig { params(type: OpenAI::Live::InitialItem::Developer::Type::OrSymbol).void } + attr_writer :type + + # A developer message included in the initial text history of a Live session. + sig do + params( + + content: T::Array[OpenAI::Live::InitialItem::Developer::Content::OrHash], + + id: T.nilable(String), + + status: T.nilable(OpenAI::Live::InitialItem::Developer::Status::OrSymbol), + + type: OpenAI::Live::InitialItem::Developer::Type::OrSymbol, + + role: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The message content. Supply exactly one text part for the initial Live + # conversation history. + content:, + + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + id: nil, + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + status: nil, + + # The history item type. Always `message`. + type: nil, + + # The author of this history message. Always `developer`. + + role: :developer + ) + end + + sig do + override.returns( + { + content: T::Array[OpenAI::Live::InitialItem::Developer::Content], + role: Symbol, + id: T.nilable(String), + status: T.nilable(OpenAI::Live::InitialItem::Developer::Status::OrSymbol), + type: OpenAI::Live::InitialItem::Developer::Type::OrSymbol + } + ) + end + def to_hash + end + + class Content < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::InitialItem::Developer::Content, + OpenAI::Internal::AnyHash + ) + end + + # The message text to include in the Live session’s initial conversation history. + sig { returns(String) } + attr_accessor :text + + # The text content type. Always `input_text`. + sig { returns(T.nilable(OpenAI::Live::InitialItem::Developer::Content::Type::OrSymbol)) } + attr_reader :type + + sig { params(type: OpenAI::Live::InitialItem::Developer::Content::Type::OrSymbol).void } + attr_writer :type + + # Text supplied in a developer or user message when starting a Live session. + sig do + params( + + text: String, + + type: OpenAI::Live::InitialItem::Developer::Content::Type::OrSymbol + ) + .returns(T.attached_class) + end + def self.new( + + # The message text to include in the Live session’s initial conversation history. + text:, + + # The text content type. Always `input_text`. + + type: nil + ) + end + + sig do + override.returns( + {text: String, type: OpenAI::Live::InitialItem::Developer::Content::Type::OrSymbol} + ) + end + def to_hash + end + + # The text content type. Always `input_text`. + module Type + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::InitialItem::Developer::Content::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INPUT_TEXT = T.let(:input_text, OpenAI::Live::InitialItem::Developer::Content::Type::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::Developer::Content::Type::TaggedSymbol]) } + def self.values + end + end + end + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + module Status + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::InitialItem::Developer::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCOMPLETE = T.let(:incomplete, OpenAI::Live::InitialItem::Developer::Status::TaggedSymbol) + COMPLETED = T.let(:completed, OpenAI::Live::InitialItem::Developer::Status::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::Developer::Status::TaggedSymbol]) } + def self.values + end + end + + # The history item type. Always `message`. + module Type + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::InitialItem::Developer::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MESSAGE = T.let(:message, OpenAI::Live::InitialItem::Developer::Type::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::Developer::Type::TaggedSymbol]) } + def self.values + end + end + end + + class User < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::InitialItem::User, + OpenAI::Internal::AnyHash + ) + end + + # The message content. Supply exactly one text part for the initial Live + # conversation history. + sig { returns(T::Array[OpenAI::Live::InitialItem::User::Content]) } + attr_accessor :content + + # The author of this history message. Always `user`. + sig { returns(Symbol) } + attr_accessor :role + + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + sig { returns(T.nilable(String)) } + attr_accessor :id + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + sig { returns(T.nilable(OpenAI::Live::InitialItem::User::Status::OrSymbol)) } + attr_accessor :status + + # The history item type. Always `message`. + sig { returns(T.nilable(OpenAI::Live::InitialItem::User::Type::OrSymbol)) } + attr_reader :type + + sig { params(type: OpenAI::Live::InitialItem::User::Type::OrSymbol).void } + attr_writer :type + + # A user message included in the initial text history of a Live session. + sig do + params( + + content: T::Array[OpenAI::Live::InitialItem::User::Content::OrHash], + + id: T.nilable(String), + + status: T.nilable(OpenAI::Live::InitialItem::User::Status::OrSymbol), + + type: OpenAI::Live::InitialItem::User::Type::OrSymbol, + + role: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The message content. Supply exactly one text part for the initial Live + # conversation history. + content:, + + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + id: nil, + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + status: nil, + + # The history item type. Always `message`. + type: nil, + + # The author of this history message. Always `user`. + + role: :user + ) + end + + sig do + override.returns( + { + content: T::Array[OpenAI::Live::InitialItem::User::Content], + role: Symbol, + id: T.nilable(String), + status: T.nilable(OpenAI::Live::InitialItem::User::Status::OrSymbol), + type: OpenAI::Live::InitialItem::User::Type::OrSymbol + } + ) + end + def to_hash + end + + class Content < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::InitialItem::User::Content, + OpenAI::Internal::AnyHash + ) + end + + # The message text to include in the Live session’s initial conversation history. + sig { returns(String) } + attr_accessor :text + + # The text content type. Always `input_text`. + sig { returns(T.nilable(OpenAI::Live::InitialItem::User::Content::Type::OrSymbol)) } + attr_reader :type + + sig { params(type: OpenAI::Live::InitialItem::User::Content::Type::OrSymbol).void } + attr_writer :type + + # Text supplied in a developer or user message when starting a Live session. + sig do + params( + + text: String, + + type: OpenAI::Live::InitialItem::User::Content::Type::OrSymbol + ) + .returns(T.attached_class) + end + def self.new( + + # The message text to include in the Live session’s initial conversation history. + text:, + + # The text content type. Always `input_text`. + + type: nil + ) + end + + sig do + override.returns( + {text: String, type: OpenAI::Live::InitialItem::User::Content::Type::OrSymbol} + ) + end + def to_hash + end + + # The text content type. Always `input_text`. + module Type + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::InitialItem::User::Content::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INPUT_TEXT = T.let(:input_text, OpenAI::Live::InitialItem::User::Content::Type::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::User::Content::Type::TaggedSymbol]) } + def self.values + end + end + end + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + module Status + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::InitialItem::User::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCOMPLETE = T.let(:incomplete, OpenAI::Live::InitialItem::User::Status::TaggedSymbol) + COMPLETED = T.let(:completed, OpenAI::Live::InitialItem::User::Status::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::User::Status::TaggedSymbol]) } + def self.values + end + end + + # The history item type. Always `message`. + module Type + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::InitialItem::User::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MESSAGE = T.let(:message, OpenAI::Live::InitialItem::User::Type::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::User::Type::TaggedSymbol]) } + def self.values + end + end + end + + class Assistant < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::InitialItem::Assistant, + OpenAI::Internal::AnyHash + ) + end + + # The message content. Supply exactly one text part for the initial Live + # conversation history. + sig { + returns( + T::Array[ + T.any( + OpenAI::Live::InitialItem::Assistant::Content::Text, + OpenAI::Live::InitialItem::Assistant::Content::OutputText + ) + ] + ) + } + attr_accessor :content + + # The author of this history message. Always `assistant`. + sig { returns(Symbol) } + attr_accessor :role + + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + sig { returns(T.nilable(String)) } + attr_accessor :id + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + sig { returns(T.nilable(OpenAI::Live::InitialItem::Assistant::Status::OrSymbol)) } + attr_accessor :status + + # The history item type. Always `message`. + sig { returns(T.nilable(OpenAI::Live::InitialItem::Assistant::Type::OrSymbol)) } + attr_reader :type + + sig { params(type: OpenAI::Live::InitialItem::Assistant::Type::OrSymbol).void } + attr_writer :type + + # An assistant message included in the initial text history of a Live session. + sig do + params( + + content: T::Array[ + T.any( + OpenAI::Live::InitialItem::Assistant::Content::Text::OrHash, + OpenAI::Live::InitialItem::Assistant::Content::OutputText::OrHash + ) + ], + + id: T.nilable(String), + + status: T.nilable(OpenAI::Live::InitialItem::Assistant::Status::OrSymbol), + + type: OpenAI::Live::InitialItem::Assistant::Type::OrSymbol, + + role: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The message content. Supply exactly one text part for the initial Live + # conversation history. + content:, + + # An optional identifier for the supplied history message. Live uses the message’s + # role and text to initialize the conversation. + id: nil, + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + status: nil, + + # The history item type. Always `message`. + type: nil, + + # The author of this history message. Always `assistant`. + + role: :assistant + ) + end + + sig do + override.returns( + { + content: T::Array[ + T.any( + OpenAI::Live::InitialItem::Assistant::Content::Text, + OpenAI::Live::InitialItem::Assistant::Content::OutputText + ) + ], + role: Symbol, + id: T.nilable(String), + status: T.nilable(OpenAI::Live::InitialItem::Assistant::Status::OrSymbol), + type: OpenAI::Live::InitialItem::Assistant::Type::OrSymbol + } + ) + end + def to_hash + end + + # Assistant text supplied as conversation history when starting a Live session. + module Content + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any( + OpenAI::Live::InitialItem::Assistant::Content::Text, + OpenAI::Live::InitialItem::Assistant::Content::OutputText + ) + } + + class Text < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::InitialItem::Assistant::Content::Text, + OpenAI::Internal::AnyHash + ) + end + + # The message text to include in the Live session’s initial conversation history. + sig { returns(String) } + attr_accessor :text + + # The text content type. Always `text`. + sig { returns(T.nilable(OpenAI::Live::InitialItem::Assistant::Content::Text::Type::OrSymbol)) } + attr_reader :type + + sig { params(type: OpenAI::Live::InitialItem::Assistant::Content::Text::Type::OrSymbol).void } + attr_writer :type + + # Assistant text supplied as conversation history when starting a Live session. + sig do + params( + + text: String, + + type: OpenAI::Live::InitialItem::Assistant::Content::Text::Type::OrSymbol + ) + .returns(T.attached_class) + end + def self.new( + + # The message text to include in the Live session’s initial conversation history. + text:, + + # The text content type. Always `text`. + + type: nil + ) + end + + sig do + override.returns( + {text: String, type: OpenAI::Live::InitialItem::Assistant::Content::Text::Type::OrSymbol} + ) + end + def to_hash + end + + # The text content type. Always `text`. + module Type + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Live::InitialItem::Assistant::Content::Text::Type) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TEXT = T.let(:text, OpenAI::Live::InitialItem::Assistant::Content::Text::Type::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Live::InitialItem::Assistant::Content::Text::Type::TaggedSymbol]) + } + def self.values + end + end + end + + class OutputText < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::InitialItem::Assistant::Content::OutputText, + OpenAI::Internal::AnyHash + ) + end + + # The message text to include in the Live session’s initial conversation history. + sig { returns(String) } + attr_accessor :text + + # The text content type. Always `output_text`. + sig { returns(Symbol) } + attr_accessor :type + + # Assistant output text supplied as conversation history when starting a Live + # session. + sig do + params( + + text: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The message text to include in the Live session’s initial conversation history. + text:, + + # The text content type. Always `output_text`. + + type: :output_text + ) + end + + sig do + override.returns( + {text: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::Assistant::Content::Variants]) } + def self.variants + end + + end + + # The supplied message’s status. Live uses its text as history and does not resume + # an incomplete message. + module Status + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::InitialItem::Assistant::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INCOMPLETE = T.let(:incomplete, OpenAI::Live::InitialItem::Assistant::Status::TaggedSymbol) + COMPLETED = T.let(:completed, OpenAI::Live::InitialItem::Assistant::Status::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::Assistant::Status::TaggedSymbol]) } + def self.values + end + end + + # The history item type. Always `message`. + module Type + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::InitialItem::Assistant::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MESSAGE = T.let(:message, OpenAI::Live::InitialItem::Assistant::Type::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::Assistant::Type::TaggedSymbol]) } + def self.values + end + end + end + + sig { override.returns(T::Array[OpenAI::Live::InitialItem::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/input_audio_append_event.rbi b/rbi/openai/models/live/input_audio_append_event.rbi new file mode 100644 index 000000000..795a71c71 --- /dev/null +++ b/rbi/openai/models/live/input_audio_append_event.rbi @@ -0,0 +1,79 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InputAudioAppendEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InputAudioAppendEvent, + OpenAI::Internal::AnyHash + ) + end + + # Base64-encoded raw audio in the startup-selected format, without a WAV or other + # container header. Primary WebSocket only; media transports use their audio + # track. Audio appends have no acknowledgment. Reflected sideband server events + # reuse this event type and audio key, with no timestamps or event_id; their audio + # is always mono PCM16LE at 24 kHz. + sig { returns(String) } + attr_accessor :audio + + # The Live client event type. Always `session.input_audio.append`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions + # send audio over their media transport. + sig do + params( + + audio: String, + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Base64-encoded raw audio in the startup-selected format, without a WAV or other + # container header. Primary WebSocket only; media transports use their audio + # track. Audio appends have no acknowledgment. Reflected sideband server events + # reuse this event type and audio key, with no timestamps or event_id; their audio + # is always mono PCM16LE at 24 kHz. + audio:, + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.input_audio.append`. + + type: :"session.input_audio.append" + ) + end + + sig do + override.returns( + {audio: String, type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/input_audio_mute_event.rbi b/rbi/openai/models/live/input_audio_mute_event.rbi new file mode 100644 index 000000000..6b7f015bf --- /dev/null +++ b/rbi/openai/models/live/input_audio_mute_event.rbi @@ -0,0 +1,62 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InputAudioMuteEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InputAudioMuteEvent, + OpenAI::Internal::AnyHash + ) + end + + # The Live client event type. Always `session.input_audio.mute`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Mute audio input to the Live model without closing the session. The server + # acknowledges with `session.input_audio.muted`. + sig do + params( + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.input_audio.mute`. + + type: :"session.input_audio.mute" + ) + end + + sig do + override.returns( + {type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/input_audio_muted_event.rbi b/rbi/openai/models/live/input_audio_muted_event.rbi new file mode 100644 index 000000000..e4cdb086e --- /dev/null +++ b/rbi/openai/models/live/input_audio_muted_event.rbi @@ -0,0 +1,74 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InputAudioMutedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InputAudioMutedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, always `session.input_audio.muted`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned when a session.input_audio.mute command is accepted. Input audio is no + # longer sent to the model; sideband audio reflection continues. + sig do + params( + + event_id: String, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the Live server event. + event_id:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.input_audio.muted`. + + type: :"session.input_audio.muted" + ) + end + + sig do + override.returns( + {event_id: String, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/input_audio_unmute_event.rbi b/rbi/openai/models/live/input_audio_unmute_event.rbi new file mode 100644 index 000000000..0f6ac140c --- /dev/null +++ b/rbi/openai/models/live/input_audio_unmute_event.rbi @@ -0,0 +1,62 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InputAudioUnmuteEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InputAudioUnmuteEvent, + OpenAI::Internal::AnyHash + ) + end + + # The Live client event type. Always `session.input_audio.unmute`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Resume audio input to a Live model after muting it. The server acknowledges with + # `session.input_audio.unmuted`. + sig do + params( + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.input_audio.unmute`. + + type: :"session.input_audio.unmute" + ) + end + + sig do + override.returns( + {type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/input_audio_unmuted_event.rbi b/rbi/openai/models/live/input_audio_unmuted_event.rbi new file mode 100644 index 000000000..c9b399e94 --- /dev/null +++ b/rbi/openai/models/live/input_audio_unmuted_event.rbi @@ -0,0 +1,74 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InputAudioUnmutedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InputAudioUnmutedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, always `session.input_audio.unmuted`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned when a session.input_audio.unmute command is accepted. Input audio is + # sent to the model again. + sig do + params( + + event_id: String, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the Live server event. + event_id:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.input_audio.unmuted`. + + type: :"session.input_audio.unmuted" + ) + end + + sig do + override.returns( + {event_id: String, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/input_transcript_delta_event.rbi b/rbi/openai/models/live/input_transcript_delta_event.rbi new file mode 100644 index 000000000..c0a88b792 --- /dev/null +++ b/rbi/openai/models/live/input_transcript_delta_event.rbi @@ -0,0 +1,115 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InputTranscriptDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # The transcript text fragment for the audio in this time range. Append fragments + # in delivery order to build the transcript. + sig { returns(String) } + attr_accessor :delta + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + sig { returns(Integer) } + attr_accessor :end_ms + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + sig { returns(Integer) } + attr_accessor :start_ms + + # The event type, always `session.input_transcript.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # A transcript fragment for user input audio in the Live session. Accumulate + # fragments in delivery order; these events do not define complete turns or + # include a transcript-done event. + sig do + params( + + delta: String, + + end_ms: Integer, + + event_id: String, + + start_ms: Integer, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The transcript text fragment for the audio in this time range. Append fragments + # in delivery order to build the transcript. + delta:, + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + end_ms:, + + # The unique ID of the Live server event. + event_id:, + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + start_ms:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.input_transcript.delta`. + + type: :"session.input_transcript.delta" + ) + end + + sig do + override.returns( + { + delta: String, + end_ms: Integer, + event_id: String, + start_ms: Integer, + type: Symbol, + client_event_id: T.nilable(String) + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/instructions_append_event.rbi b/rbi/openai/models/live/instructions_append_event.rbi new file mode 100644 index 000000000..991d0dcac --- /dev/null +++ b/rbi/openai/models/live/instructions_append_event.rbi @@ -0,0 +1,86 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InstructionsAppendEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InstructionsAppendEvent, + OpenAI::Internal::AnyHash + ) + end + + # Instruction text to append, limited to 500 tokens. This is a plain string, not + # an array of content parts. + sig { returns(String) } + attr_accessor :content + + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + sig { returns(T.nilable(String)) } + attr_accessor :delegation_id + + # The Live client event type. Always `session.instructions.append`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Append instructions to the Live conversation while it is running, optionally + # associating them with an existing client delegation. + sig do + params( + + content: String, + + delegation_id: T.nilable(String), + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Instruction text to append, limited to 500 tokens. This is a plain string, not + # an array of content parts. + content:, + + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + delegation_id:, + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.instructions.append`. + + type: :"session.instructions.append" + ) + end + + sig do + override.returns( + {content: String, delegation_id: T.nilable(String), type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/instructions_appended_event.rbi b/rbi/openai/models/live/instructions_appended_event.rbi new file mode 100644 index 000000000..44706c2d2 --- /dev/null +++ b/rbi/openai/models/live/instructions_appended_event.rbi @@ -0,0 +1,97 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class InstructionsAppendedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::InstructionsAppendedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + sig { returns(Integer) } + attr_accessor :end_ms + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + sig { returns(Integer) } + attr_accessor :start_ms + + # The event type, always `session.instructions.appended`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned when a session.instructions.append command is accepted into the Live + # session timeline. Acknowledges the appended instructions without guaranteeing + # that the model has acted on them. + sig do + params( + + end_ms: Integer, + + event_id: String, + + start_ms: Integer, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + end_ms:, + + # The unique ID of the Live server event. + event_id:, + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + start_ms:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.instructions.appended`. + + type: :"session.instructions.appended" + ) + end + + sig do + override.returns( + {end_ms: Integer, event_id: String, start_ms: Integer, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/live_create_params.rbi b/rbi/openai/models/live/live_create_params.rbi new file mode 100644 index 000000000..e6f7eb5a2 --- /dev/null +++ b/rbi/openai/models/live/live_create_params.rbi @@ -0,0 +1,121 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class LiveCreateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Live::LiveCreateParams, + OpenAI::Internal::AnyHash + ) + end + + # Startup configuration for the Live session. + sig { returns(OpenAI::Live::MediaSessionConfig) } + attr_reader :session + + sig { params(session: OpenAI::Live::MediaSessionConfig::OrHash).void } + attr_writer :session + + # WebRTC transport with the browser's SDP offer. + sig { returns(OpenAI::Live::LiveCreateParams::Transport) } + attr_reader :transport + + sig { params(transport: OpenAI::Live::LiveCreateParams::Transport::OrHash).void } + attr_writer :transport + + sig do + params( + + session: OpenAI::Live::MediaSessionConfig::OrHash, + + transport: OpenAI::Live::LiveCreateParams::Transport::OrHash, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Startup configuration for the Live session. + session:, + + # WebRTC transport with the browser's SDP offer. + transport:, + + request_options: {} + ) + end + + sig do + override.returns( + { + session: OpenAI::Live::MediaSessionConfig, + transport: OpenAI::Live::LiveCreateParams::Transport, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + class Transport < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::LiveCreateParams::Transport, + OpenAI::Internal::AnyHash + ) + end + + # Session Description Protocol message for the WebRTC connection. + sig { returns(String) } + attr_accessor :sdp + + # The transport used for the Live session. Always `webrtc`. + sig { returns(Symbol) } + attr_accessor :type + + # WebRTC transport with the browser's SDP offer. + sig do + params( + + sdp: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Session Description Protocol message for the WebRTC connection. + sdp:, + + # The transport used for the Live session. Always `webrtc`. + + type: :webrtc + ) + end + + sig do + override.returns( + {sdp: String, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/live_create_response.rbi b/rbi/openai/models/live/live_create_response.rbi new file mode 100644 index 000000000..47fbe03ae --- /dev/null +++ b/rbi/openai/models/live/live_create_response.rbi @@ -0,0 +1,160 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class LiveCreateResponse < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Models::Live::LiveCreateResponse, + OpenAI::Internal::AnyHash + ) + end + + # The newly created Live session. Use its ID for session controls and sideband + # connections. + sig { returns(OpenAI::Models::Live::LiveCreateResponse::Session) } + attr_reader :session + + sig { params(session: OpenAI::Models::Live::LiveCreateResponse::Session::OrHash).void } + attr_writer :session + + # WebRTC transport with the SDP answer. + sig { returns(OpenAI::Models::Live::LiveCreateResponse::Transport) } + attr_reader :transport + + sig { params(transport: OpenAI::Models::Live::LiveCreateResponse::Transport::OrHash).void } + attr_writer :transport + + # The created Live session identifier and WebRTC answer. Apply transport.sdp as + # the peer's remote answer and wait for session.started on the data channel before + # sending commands. + sig do + params( + + session: OpenAI::Models::Live::LiveCreateResponse::Session::OrHash, + + transport: OpenAI::Models::Live::LiveCreateResponse::Transport::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # The newly created Live session. Use its ID for session controls and sideband + # connections. + session:, + + # WebRTC transport with the SDP answer. + + transport: + ) + end + + sig do + override.returns( + { + session: OpenAI::Models::Live::LiveCreateResponse::Session, + transport: OpenAI::Models::Live::LiveCreateResponse::Transport + } + ) + end + def to_hash + end + + class Session < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Models::Live::LiveCreateResponse::Session, + OpenAI::Internal::AnyHash + ) + end + + # Opaque session identifier. Preserve the returned value unchanged, including its + # prefix. + sig { returns(String) } + attr_accessor :id + + # The newly created Live session. Use its ID for session controls and sideband + # connections. + sig do + params( + + id: String + ) + .returns(T.attached_class) + end + def self.new( + + # Opaque session identifier. Preserve the returned value unchanged, including its + # prefix. + + id: + ) + end + + sig do + override.returns( + {id: String} + ) + end + def to_hash + end + + end + + class Transport < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Models::Live::LiveCreateResponse::Transport, + OpenAI::Internal::AnyHash + ) + end + + # Session Description Protocol message for the WebRTC connection. + sig { returns(String) } + attr_accessor :sdp + + # The transport used for the Live session. Always `webrtc`. + sig { returns(Symbol) } + attr_accessor :type + + # WebRTC transport with the SDP answer. + sig do + params( + + sdp: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Session Description Protocol message for the WebRTC connection. + sdp:, + + # The transport used for the Live session. Always `webrtc`. + + type: :webrtc + ) + end + + sig do + override.returns( + {sdp: String, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/media_session_config.rbi b/rbi/openai/models/live/media_session_config.rbi new file mode 100644 index 000000000..9f0e293c0 --- /dev/null +++ b/rbi/openai/models/live/media_session_config.rbi @@ -0,0 +1,390 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class MediaSessionConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::MediaSessionConfig, + OpenAI::Internal::AnyHash + ) + end + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + sig { returns(T.any(String, OpenAI::Live::MediaSessionConfig::Model::OrSymbol)) } + attr_accessor :model + + # Startup audio configuration. WebRTC and SIP negotiate their audio format on the + # media transport. + sig { returns(T.nilable(OpenAI::Live::MediaSessionConfig::Audio)) } + attr_reader :audio + + sig { params(audio: OpenAI::Live::MediaSessionConfig::Audio::OrHash).void } + attr_writer :audio + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + sig { returns(T.nilable(OpenAI::Live::ClientConfig)) } + attr_reader :client + + sig { params(client: OpenAI::Live::ClientConfig::OrHash).void } + attr_writer :client + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + sig { + returns( + T.nilable(T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::MediaSessionConfig::Delegation::Responses)) + ) + } + attr_accessor :delegation + + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + ] + ) + ) + } + attr_reader :input + + sig { + params( + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer::OrHash, + OpenAI::Live::InitialItem::User::OrHash, + OpenAI::Live::InitialItem::Assistant::OrHash + ) + ] + ) + .void + } + attr_writer :input + + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :store + + sig { params(store: T::Boolean).void } + attr_writer :store + + # Startup configuration for a Live media session. Follow the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # when writing frontend instructions and the backend prompt under + # delegation.responses.instructions. + sig do + params( + + model: T.any(String, OpenAI::Live::MediaSessionConfig::Model::OrSymbol), + + audio: OpenAI::Live::MediaSessionConfig::Audio::OrHash, + + client: OpenAI::Live::ClientConfig::OrHash, + + delegation: T.nilable( + T.any( + OpenAI::Live::ClientDelegation::OrHash, + OpenAI::Live::MediaSessionConfig::Delegation::Responses::OrHash + ) + ), + + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer::OrHash, + OpenAI::Live::InitialItem::User::OrHash, + OpenAI::Live::InitialItem::Assistant::OrHash + ) + ], + + instructions: T.nilable(String), + + store: T::Boolean + ) + .returns(T.attached_class) + end + def self.new( + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + model:, + + # Startup audio configuration. WebRTC and SIP negotiate their audio format on the + # media transport. + audio: nil, + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + client: nil, + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + delegation: nil, + + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + input: nil, + + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + instructions: nil, + + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + + store: nil + ) + end + + sig do + override.returns( + { + model: T.any(String, OpenAI::Live::MediaSessionConfig::Model::OrSymbol), + audio: OpenAI::Live::MediaSessionConfig::Audio, + client: OpenAI::Live::ClientConfig, + delegation: T.nilable( + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::MediaSessionConfig::Delegation::Responses) + ), + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + ], + instructions: T.nilable(String), + store: T::Boolean + } + ) + end + def to_hash + end + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + module Model + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { T.any(String, OpenAI::Live::MediaSessionConfig::Model::TaggedSymbol) } + + sig { override.returns(T::Array[OpenAI::Live::MediaSessionConfig::Model::Variants]) } + def self.variants + end + + TaggedSymbol = T.type_alias do + T.all(Symbol, OpenAI::Live::MediaSessionConfig::Model) + end + + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GPT_LIVE_1 = T.let(:"gpt-live-1", OpenAI::Live::MediaSessionConfig::Model::TaggedSymbol) + + end + + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::MediaSessionConfig::Audio, + OpenAI::Internal::AnyHash + ) + end + + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + sig { returns(T.nilable(OpenAI::Live::MediaSessionConfig::Audio::Output)) } + attr_reader :output + + sig { params(output: OpenAI::Live::MediaSessionConfig::Audio::Output::OrHash).void } + attr_writer :output + + # Startup audio configuration. WebRTC and SIP negotiate their audio format on the + # media transport. + sig do + params( + + output: OpenAI::Live::MediaSessionConfig::Audio::Output::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + + output: nil + ) + end + + sig do + override.returns( + {output: OpenAI::Live::MediaSessionConfig::Audio::Output} + ) + end + def to_hash + end + + class Output < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::MediaSessionConfig::Audio::Output, + OpenAI::Internal::AnyHash + ) + end + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + sig { returns(T.nilable(T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice))) } + attr_reader :voice + + sig { + params(voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice::OrHash)).void + } + attr_writer :voice + + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + sig do + params( + + voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice::OrHash) + ) + .returns(T.attached_class) + end + def self.new( + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + + voice: nil + ) + end + + sig do + override.returns( + {voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice)} + ) + end + def to_hash + end + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + module Voice + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(String, OpenAI::Live::BuiltInVoice::TaggedSymbol, OpenAI::Live::CustomVoice) + } + + sig { override.returns(T::Array[OpenAI::Live::MediaSessionConfig::Audio::Output::Voice::Variants]) } + def self.variants + end + + end + end + end + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + module Delegation + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::MediaSessionConfig::Delegation::Responses) + } + + class Responses < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::MediaSessionConfig::Delegation::Responses, + OpenAI::Internal::AnyHash + ) + end + + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + sig { returns(OpenAI::Live::ResponsesDelegationConfig) } + attr_reader :responses + + sig { params(responses: OpenAI::Live::ResponsesDelegationConfig::OrHash).void } + attr_writer :responses + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + sig { returns(Symbol) } + attr_accessor :type + + # Delegate tasks to a Responses model managed by the Live session. + sig do + params( + + responses: OpenAI::Live::ResponsesDelegationConfig::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + responses:, + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + + type: :responses + ) + end + + sig do + override.returns( + {responses: OpenAI::Live::ResponsesDelegationConfig, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::MediaSessionConfig::Delegation::Variants]) } + def self.variants + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/media_session_fork_config.rbi b/rbi/openai/models/live/media_session_fork_config.rbi new file mode 100644 index 000000000..9cc8eba59 --- /dev/null +++ b/rbi/openai/models/live/media_session_fork_config.rbi @@ -0,0 +1,143 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class MediaSessionForkConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::MediaSessionForkConfig, + OpenAI::Internal::AnyHash + ) + end + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + sig { returns(T.nilable(OpenAI::Live::ClientConfig)) } + attr_reader :client + + sig { params(client: OpenAI::Live::ClientConfig::OrHash).void } + attr_writer :client + + # Update the Responses backend for an existing Live session without changing + # delegation ownership. + sig { returns(T.nilable(OpenAI::Live::MediaSessionForkConfig::Delegation)) } + attr_reader :delegation + + sig { params(delegation: OpenAI::Live::MediaSessionForkConfig::Delegation::OrHash).void } + attr_writer :delegation + + # Whether to store the forked session. Omission inherits the stored session's + # setting. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :store + + sig { params(store: T::Boolean).void } + attr_writer :store + + # Optional overrides for a stored Live session. Omitted settings are inherited. + # The model, voice, frontend instructions, and prior conversation come from the + # stored session. WebRTC negotiates its audio format; audio.format is only + # supported on WebSocket forks. + sig do + params( + + client: OpenAI::Live::ClientConfig::OrHash, + + delegation: OpenAI::Live::MediaSessionForkConfig::Delegation::OrHash, + + store: T::Boolean + ) + .returns(T.attached_class) + end + def self.new( + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + client: nil, + + # Update the Responses backend for an existing Live session without changing + # delegation ownership. + delegation: nil, + + # Whether to store the forked session. Omission inherits the stored session's + # setting. + + store: nil + ) + end + + sig do + override.returns( + { + client: OpenAI::Live::ClientConfig, + delegation: OpenAI::Live::MediaSessionForkConfig::Delegation, + store: T::Boolean + } + ) + end + def to_hash + end + + class Delegation < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::MediaSessionForkConfig::Delegation, + OpenAI::Internal::AnyHash + ) + end + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + sig { returns(Symbol) } + attr_accessor :type + + # Responses backend settings to update. Omitted settings keep their existing + # values. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig)) } + attr_reader :responses + + sig { params(responses: OpenAI::Live::ResponsesDelegationUpdateConfig::OrHash).void } + attr_writer :responses + + # Update the Responses backend for an existing Live session without changing + # delegation ownership. + sig do + params( + + responses: OpenAI::Live::ResponsesDelegationUpdateConfig::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Responses backend settings to update. Omitted settings keep their existing + # values. + responses: nil, + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + + type: :responses + ) + end + + sig do + override.returns( + {type: Symbol, responses: OpenAI::Live::ResponsesDelegationUpdateConfig} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/output_audio_delta_event.rbi b/rbi/openai/models/live/output_audio_delta_event.rbi new file mode 100644 index 000000000..4c51f8367 --- /dev/null +++ b/rbi/openai/models/live/output_audio_delta_event.rbi @@ -0,0 +1,93 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class OutputAudioDeltaEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::OutputAudioDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # Base64-encoded raw audio. Primary WebSocket events use the session's configured + # format; reflected sideband events use mono PCM16LE at 24 kHz. + sig { returns(String) } + attr_accessor :delta + + # The event type, always `session.output_audio.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # Exclusive session-relative end in milliseconds. Required on reflected sideband + # events; omitted on the primary WebSocket. Dropped output frames leave gaps + # between reflected ranges. + sig { returns(T.nilable(Integer)) } + attr_reader :end_ms + + sig { params(end_ms: Integer).void } + attr_writer :end_ms + + # Inclusive session-relative start in milliseconds. Required on reflected sideband + # events; omitted on the primary WebSocket. + sig { returns(T.nilable(Integer)) } + attr_reader :start_ms + + sig { params(start_ms: Integer).void } + attr_writer :start_ms + + # An audio chunk generated by the Live model. Decode and play primary WebSocket + # chunks in delivery order using the configured session audio format. Sideband + # connections receive reflected output audio with timestamps. + sig do + params( + + delta: String, + + end_ms: Integer, + + start_ms: Integer, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Base64-encoded raw audio. Primary WebSocket events use the session's configured + # format; reflected sideband events use mono PCM16LE at 24 kHz. + delta:, + + # Exclusive session-relative end in milliseconds. Required on reflected sideband + # events; omitted on the primary WebSocket. Dropped output frames leave gaps + # between reflected ranges. + end_ms: nil, + + # Inclusive session-relative start in milliseconds. Required on reflected sideband + # events; omitted on the primary WebSocket. + start_ms: nil, + + # The event type, always `session.output_audio.delta`. + + type: :"session.output_audio.delta" + ) + end + + sig do + override.returns( + {delta: String, type: Symbol, end_ms: Integer, start_ms: Integer} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/output_transcript_delta_event.rbi b/rbi/openai/models/live/output_transcript_delta_event.rbi new file mode 100644 index 000000000..8776aeba3 --- /dev/null +++ b/rbi/openai/models/live/output_transcript_delta_event.rbi @@ -0,0 +1,115 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class OutputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::OutputTranscriptDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # The transcript text fragment for the audio in this time range. Append fragments + # in delivery order to build the transcript. + sig { returns(String) } + attr_accessor :delta + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + sig { returns(Integer) } + attr_accessor :end_ms + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + sig { returns(Integer) } + attr_accessor :start_ms + + # The event type, always `session.output_transcript.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # A transcript fragment for assistant output audio in the Live session. Accumulate + # fragments in delivery order; these events do not define complete turns or + # include a transcript-done event. + sig do + params( + + delta: String, + + end_ms: Integer, + + event_id: String, + + start_ms: Integer, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The transcript text fragment for the audio in this time range. Append fragments + # in delivery order to build the transcript. + delta:, + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + end_ms:, + + # The unique ID of the Live server event. + event_id:, + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + start_ms:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.output_transcript.delta`. + + type: :"session.output_transcript.delta" + ) + end + + sig do + override.returns( + { + delta: String, + end_ms: Integer, + event_id: String, + start_ms: Integer, + type: Symbol, + client_event_id: T.nilable(String) + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/response_create_event.rbi b/rbi/openai/models/live/response_create_event.rbi new file mode 100644 index 000000000..0b916280f --- /dev/null +++ b/rbi/openai/models/live/response_create_event.rbi @@ -0,0 +1,62 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ResponseCreateEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponseCreateEvent, + OpenAI::Internal::AnyHash + ) + end + + # The Live client event type. Always `response.create`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Request a response from the Live session’s Responses backend, or continue a + # delegated response waiting for tool results. Requires Responses delegation. + sig do + params( + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `response.create`. + + type: :"response.create" + ) + end + + sig do + override.returns( + {type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/response_event.rbi b/rbi/openai/models/live/response_event.rbi new file mode 100644 index 000000000..0d5cacc69 --- /dev/null +++ b/rbi/openai/models/live/response_event.rbi @@ -0,0 +1,105 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ResponseEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponseEvent, + OpenAI::Internal::AnyHash + ) + end + + # The nested Responses streaming event. Dispatch on its type field. Response + # lifecycle snapshots omit input and clear instructions, tools, and output to keep + # messages small; consume granular output events for the generated content. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :event + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, always `response.event`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # The Live delegation associated with the nested Responses event. May be null or + # omitted when the event cannot be correlated with a delegation. + sig { returns(T.nilable(String)) } + attr_accessor :delegation_id + + # A streaming Responses API event from a backend delegated to by the Live session. + # Use the outer delegation_id to associate the nested stream with its Live + # delegation. + sig do + params( + + event: T::Hash[Symbol, T.anything], + + event_id: String, + + client_event_id: String, + + delegation_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The nested Responses streaming event. Dispatch on its type field. Response + # lifecycle snapshots omit input and clear instructions, tools, and output to keep + # messages small; consume granular output events for the generated content. + event:, + + # The unique ID of the Live server event. + event_id:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The Live delegation associated with the nested Responses event. May be null or + # omitted when the event cannot be correlated with a delegation. + delegation_id: nil, + + # The event type, always `response.event`. + + type: :"response.event" + ) + end + + sig do + override.returns( + { + event: T::Hash[Symbol, T.anything], + event_id: String, + type: Symbol, + client_event_id: T.nilable(String), + delegation_id: T.nilable(String) + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/response_item_create_event.rbi b/rbi/openai/models/live/response_item_create_event.rbi new file mode 100644 index 000000000..cdc1f318c --- /dev/null +++ b/rbi/openai/models/live/response_item_create_event.rbi @@ -0,0 +1,183 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ResponseItemCreateEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponseItemCreateEvent, + OpenAI::Internal::AnyHash + ) + end + + # An input item to append to the Responses backend conversation, such as a user + # message or a function tool result. + sig { + returns( + T.any( + OpenAI::Responses::EasyInputMessage, + OpenAI::Responses::ResponseInputItem::Message, + OpenAI::Responses::ResponseOutputMessage, + OpenAI::Responses::ResponseFileSearchToolCall, + OpenAI::Responses::ResponseComputerToolCall, + OpenAI::Responses::ResponseInputItem::ComputerCallOutput, + OpenAI::Responses::ResponseFunctionWebSearch, + OpenAI::Responses::ResponseFunctionToolCall, + OpenAI::Responses::ResponseInputItem::FunctionCallOutput, + OpenAI::Responses::ResponseInputItem::ToolSearchCall, + OpenAI::Responses::ResponseToolSearchOutputItemParam, + OpenAI::Responses::ResponseInputItem::AdditionalTools, + OpenAI::Responses::ResponseConfigurationUpdateItemParam, + OpenAI::Responses::ResponseReasoningItem, + OpenAI::Responses::ResponseCompactionItemParam, + OpenAI::Responses::ResponseInputItem::ImageGenerationCall, + OpenAI::Responses::ResponseCodeInterpreterToolCall, + OpenAI::Responses::ResponseInputItem::LocalShellCall, + OpenAI::Responses::ResponseInputItem::LocalShellCallOutput, + OpenAI::Responses::ResponseInputItem::ShellCall, + OpenAI::Responses::ResponseInputItem::ShellCallOutput, + OpenAI::Responses::ResponseInputItem::ApplyPatchCall, + OpenAI::Responses::ResponseInputItem::ApplyPatchCallOutput, + OpenAI::Responses::ResponseInputItem::McpListTools, + OpenAI::Responses::ResponseInputItem::McpApprovalRequest, + OpenAI::Responses::ResponseInputItem::McpApprovalResponse, + OpenAI::Responses::ResponseInputItem::McpCall, + OpenAI::Responses::ResponseCustomToolCallOutput, + OpenAI::Responses::ResponseCustomToolCall, + OpenAI::Responses::ResponseInputItem::CompactionTrigger, + OpenAI::Responses::ResponseInputItem::ItemReference, + OpenAI::Responses::ResponseInputItem::Program, + OpenAI::Responses::ResponseInputItem::ProgramOutput + ) + ) + } + attr_accessor :item + + # The Live client event type. Always `response.item.create`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Add an input item to the Live session’s Responses backend. Requires Responses + # delegation; use `response.create` to request a response. + sig do + params( + + item: T.any( + OpenAI::Responses::EasyInputMessage::OrHash, + OpenAI::Responses::ResponseInputItem::Message::OrHash, + OpenAI::Responses::ResponseOutputMessage::OrHash, + OpenAI::Responses::ResponseFileSearchToolCall::OrHash, + OpenAI::Responses::ResponseComputerToolCall::OrHash, + OpenAI::Responses::ResponseInputItem::ComputerCallOutput::OrHash, + OpenAI::Responses::ResponseFunctionWebSearch::OrHash, + OpenAI::Responses::ResponseFunctionToolCall::OrHash, + OpenAI::Responses::ResponseInputItem::FunctionCallOutput::OrHash, + OpenAI::Responses::ResponseInputItem::ToolSearchCall::OrHash, + OpenAI::Responses::ResponseToolSearchOutputItemParam::OrHash, + OpenAI::Responses::ResponseInputItem::AdditionalTools::OrHash, + OpenAI::Responses::ResponseConfigurationUpdateItemParam::OrHash, + OpenAI::Responses::ResponseReasoningItem::OrHash, + OpenAI::Responses::ResponseCompactionItemParam::OrHash, + OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OrHash, + OpenAI::Responses::ResponseCodeInterpreterToolCall::OrHash, + OpenAI::Responses::ResponseInputItem::LocalShellCall::OrHash, + OpenAI::Responses::ResponseInputItem::LocalShellCallOutput::OrHash, + OpenAI::Responses::ResponseInputItem::ShellCall::OrHash, + OpenAI::Responses::ResponseInputItem::ShellCallOutput::OrHash, + OpenAI::Responses::ResponseInputItem::ApplyPatchCall::OrHash, + OpenAI::Responses::ResponseInputItem::ApplyPatchCallOutput::OrHash, + OpenAI::Responses::ResponseInputItem::McpListTools::OrHash, + OpenAI::Responses::ResponseInputItem::McpApprovalRequest::OrHash, + OpenAI::Responses::ResponseInputItem::McpApprovalResponse::OrHash, + OpenAI::Responses::ResponseInputItem::McpCall::OrHash, + OpenAI::Responses::ResponseCustomToolCallOutput::OrHash, + OpenAI::Responses::ResponseCustomToolCall::OrHash, + OpenAI::Responses::ResponseInputItem::CompactionTrigger::OrHash, + OpenAI::Responses::ResponseInputItem::ItemReference::OrHash, + OpenAI::Responses::ResponseInputItem::Program::OrHash, + OpenAI::Responses::ResponseInputItem::ProgramOutput::OrHash + ), + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # An input item to append to the Responses backend conversation, such as a user + # message or a function tool result. + item:, + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `response.item.create`. + + type: :"response.item.create" + ) + end + + sig do + override.returns( + { + item: T.any( + OpenAI::Responses::EasyInputMessage, + OpenAI::Responses::ResponseInputItem::Message, + OpenAI::Responses::ResponseOutputMessage, + OpenAI::Responses::ResponseFileSearchToolCall, + OpenAI::Responses::ResponseComputerToolCall, + OpenAI::Responses::ResponseInputItem::ComputerCallOutput, + OpenAI::Responses::ResponseFunctionWebSearch, + OpenAI::Responses::ResponseFunctionToolCall, + OpenAI::Responses::ResponseInputItem::FunctionCallOutput, + OpenAI::Responses::ResponseInputItem::ToolSearchCall, + OpenAI::Responses::ResponseToolSearchOutputItemParam, + OpenAI::Responses::ResponseInputItem::AdditionalTools, + OpenAI::Responses::ResponseConfigurationUpdateItemParam, + OpenAI::Responses::ResponseReasoningItem, + OpenAI::Responses::ResponseCompactionItemParam, + OpenAI::Responses::ResponseInputItem::ImageGenerationCall, + OpenAI::Responses::ResponseCodeInterpreterToolCall, + OpenAI::Responses::ResponseInputItem::LocalShellCall, + OpenAI::Responses::ResponseInputItem::LocalShellCallOutput, + OpenAI::Responses::ResponseInputItem::ShellCall, + OpenAI::Responses::ResponseInputItem::ShellCallOutput, + OpenAI::Responses::ResponseInputItem::ApplyPatchCall, + OpenAI::Responses::ResponseInputItem::ApplyPatchCallOutput, + OpenAI::Responses::ResponseInputItem::McpListTools, + OpenAI::Responses::ResponseInputItem::McpApprovalRequest, + OpenAI::Responses::ResponseInputItem::McpApprovalResponse, + OpenAI::Responses::ResponseInputItem::McpCall, + OpenAI::Responses::ResponseCustomToolCallOutput, + OpenAI::Responses::ResponseCustomToolCall, + OpenAI::Responses::ResponseInputItem::CompactionTrigger, + OpenAI::Responses::ResponseInputItem::ItemReference, + OpenAI::Responses::ResponseInputItem::Program, + OpenAI::Responses::ResponseInputItem::ProgramOutput + ), + type: Symbol, + event_id: T.nilable(String) + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/responses_delegation_config.rbi b/rbi/openai/models/live/responses_delegation_config.rbi new file mode 100644 index 000000000..44dca0bd3 --- /dev/null +++ b/rbi/openai/models/live/responses_delegation_config.rbi @@ -0,0 +1,562 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ResponsesDelegationConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationConfig, + OpenAI::Internal::AnyHash + ) + end + + # The model used for server-owned Responses delegations. + sig { returns(String) } + attr_accessor :model + + # Instructions for the delegated Responses model, separate from Live instructions. + # See + # [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Maximum number of output tokens for each delegated response. + sig { returns(T.nilable(Integer)) } + attr_accessor :max_output_tokens + + # Whether the delegated Responses model may request multiple tool calls in a + # single response. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :parallel_tool_calls + + # Reasoning settings passed to each delegated Responses request. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning)) } + attr_reader :reasoning + + sig { params(reasoning: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning::OrHash)).void } + attr_writer :reasoning + + # Service tier for delegated Responses requests. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationConfig::ServiceTier::OrSymbol)) } + attr_accessor :service_tier + + # Text generation settings passed to each delegated Responses request. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationConfig::Text)) } + attr_reader :text + + sig { params(text: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Text::OrHash)).void } + attr_writer :text + + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + sig { + returns( + T.nilable( + T.any( + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::OrSymbol, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam + ) + ) + ) + } + attr_reader :tool_choice + + sig { + params( + tool_choice: T.any( + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::OrSymbol, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam::OrHash, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam::OrHash + ) + ) + .void + } + attr_writer :tool_choice + + # Tools available to the Responses backend while it handles tasks delegated by the + # Live model. + sig { + returns( + T.nilable( + T::Array[T.any(OpenAI::Live::FunctionTool, OpenAI::Live::ResponsesDelegationConfig::Tool::WebSearch)] + ) + ) + } + attr_reader :tools + + sig { + params( + tools: T::Array[ + T.any( + OpenAI::Live::FunctionTool::OrHash, + OpenAI::Live::ResponsesDelegationConfig::Tool::WebSearch::OrHash + ) + ] + ) + .void + } + attr_writer :tools + + # Model, prompt, and tool settings for tasks delegated by the Live session to a + # Responses backend. + sig do + params( + + model: String, + + instructions: T.nilable(String), + + max_output_tokens: T.nilable(Integer), + + parallel_tool_calls: T.nilable(T::Boolean), + + reasoning: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning::OrHash), + + service_tier: T.nilable(OpenAI::Live::ResponsesDelegationConfig::ServiceTier::OrSymbol), + + text: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Text::OrHash), + + tool_choice: T.any( + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::OrSymbol, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam::OrHash, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam::OrHash + ), + + tools: T::Array[ + T.any( + OpenAI::Live::FunctionTool::OrHash, + OpenAI::Live::ResponsesDelegationConfig::Tool::WebSearch::OrHash + ) + ] + ) + .returns(T.attached_class) + end + def self.new( + + # The model used for server-owned Responses delegations. + model:, + + # Instructions for the delegated Responses model, separate from Live instructions. + # See + # [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + instructions: nil, + + # Maximum number of output tokens for each delegated response. + max_output_tokens: nil, + + # Whether the delegated Responses model may request multiple tool calls in a + # single response. + parallel_tool_calls: nil, + + # Reasoning settings passed to each delegated Responses request. + reasoning: nil, + + # Service tier for delegated Responses requests. + service_tier: nil, + + # Text generation settings passed to each delegated Responses request. + text: nil, + + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + tool_choice: nil, + + # Tools available to the Responses backend while it handles tasks delegated by the + # Live model. + + tools: nil + ) + end + + sig do + override.returns( + { + model: String, + instructions: T.nilable(String), + max_output_tokens: T.nilable(Integer), + parallel_tool_calls: T.nilable(T::Boolean), + reasoning: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning), + service_tier: T.nilable(OpenAI::Live::ResponsesDelegationConfig::ServiceTier::OrSymbol), + text: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Text), + tool_choice: T.any( + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::OrSymbol, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam + ), + tools: T::Array[ + T.any(OpenAI::Live::FunctionTool, OpenAI::Live::ResponsesDelegationConfig::Tool::WebSearch) + ] + } + ) + end + def to_hash + end + + class Reasoning < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationConfig::Reasoning, + OpenAI::Internal::AnyHash + ) + end + + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::OrSymbol)) } + attr_accessor :effort + + # The reasoning summary to request from the delegated Responses model, when + # supported. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary::OrSymbol)) } + attr_accessor :summary + + # Reasoning settings passed to each delegated Responses request. + sig do + params( + + effort: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::OrSymbol), + + summary: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary::OrSymbol) + ) + .returns(T.attached_class) + end + def self.new( + + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + effort: nil, + + # The reasoning summary to request from the delegated Responses model, when + # supported. + + summary: nil + ) + end + + sig do + override.returns( + { + effort: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::OrSymbol), + summary: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary::OrSymbol) + } + ) + end + def to_hash + end + + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + module Effort + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = T.let(:none, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::TaggedSymbol) + MINIMAL = T.let(:minimal, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::TaggedSymbol) + LOW = T.let(:low, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::TaggedSymbol) + XHIGH = T.let(:xhigh, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Live::ResponsesDelegationConfig::Reasoning::Effort::TaggedSymbol]) + } + def self.values + end + end + + # The reasoning summary to request from the delegated Responses model, when + # supported. + module Summary + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CONCISE = T.let(:concise, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary::TaggedSymbol) + DETAILED = T.let(:detailed, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Live::ResponsesDelegationConfig::Reasoning::Summary::TaggedSymbol]) + } + def self.values + end + end + end + + # Service tier for delegated Responses requests. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::ResponsesDelegationConfig::ServiceTier) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, OpenAI::Live::ResponsesDelegationConfig::ServiceTier::TaggedSymbol) + DEFAULT = T.let(:default, OpenAI::Live::ResponsesDelegationConfig::ServiceTier::TaggedSymbol) + FAST_TIER_TEMP_PILOT = T.let( + :fast_tier_temp_pilot, + OpenAI::Live::ResponsesDelegationConfig::ServiceTier::TaggedSymbol + ) + FLEX = T.let(:flex, OpenAI::Live::ResponsesDelegationConfig::ServiceTier::TaggedSymbol) + PRIORITY = T.let(:priority, OpenAI::Live::ResponsesDelegationConfig::ServiceTier::TaggedSymbol) + ULTRAFAST = T.let(:ultrafast, OpenAI::Live::ResponsesDelegationConfig::ServiceTier::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::ResponsesDelegationConfig::ServiceTier::TaggedSymbol]) } + def self.values + end + end + + class Text < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationConfig::Text, + OpenAI::Internal::AnyHash + ) + end + + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity::OrSymbol)) } + attr_accessor :verbosity + + # Text generation settings passed to each delegated Responses request. + sig do + params( + + verbosity: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity::OrSymbol) + ) + .returns(T.attached_class) + end + def self.new( + + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + + verbosity: nil + ) + end + + sig do + override.returns( + {verbosity: T.nilable(OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity::OrSymbol)} + ) + end + def to_hash + end + + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + module Verbosity + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOW = T.let(:low, OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::ResponsesDelegationConfig::Text::Verbosity::TaggedSymbol]) } + def self.values + end + end + end + + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + module ToolChoice + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any( + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam + ) + } + + module LiveToolChoiceEnum + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol) + NONE = T.let(:none, OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol) + REQUIRED = T.let( + :required, + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol + ) + + sig { + override.returns( + T::Array[OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol] + ) + } + def self.values + end + end + + class LiveFunctionToolChoiceParam < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :name + + sig { returns(Symbol) } + attr_accessor :type + + sig do + params( + + name: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + name:, + + type: :function + ) + end + + sig do + override.returns( + {name: String, type: Symbol} + ) + end + def to_hash + end + + end + + class LiveMCPToolChoiceParam < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :name + + sig { returns(String) } + attr_accessor :server_label + + sig { returns(Symbol) } + attr_accessor :type + + sig do + params( + + name: String, + + server_label: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + name:, + + server_label:, + + type: :mcp + ) + end + + sig do + override.returns( + {name: String, server_label: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::ResponsesDelegationConfig::ToolChoice::Variants]) } + def self.variants + end + + end + + # A function tool available to the Responses backend when the Live model delegates + # a task. + module Tool + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(OpenAI::Live::FunctionTool, OpenAI::Live::ResponsesDelegationConfig::Tool::WebSearch) + } + + class WebSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationConfig::Tool::WebSearch, + OpenAI::Internal::AnyHash + ) + end + + # The tool type. Always `web_search`. + sig { returns(Symbol) } + attr_accessor :type + + # A web search tool available to the Live session’s Responses backend. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The tool type. Always `web_search`. + + type: :web_search + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::ResponsesDelegationConfig::Tool::Variants]) } + def self.variants + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/responses_delegation_update_config.rbi b/rbi/openai/models/live/responses_delegation_update_config.rbi new file mode 100644 index 000000000..7947642e8 --- /dev/null +++ b/rbi/openai/models/live/responses_delegation_update_config.rbi @@ -0,0 +1,585 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ResponsesDelegationUpdateConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig, + OpenAI::Internal::AnyHash + ) + end + + # Instructions for the delegated Responses model, separate from Live instructions. + # See + # [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Maximum number of output tokens for each delegated response. + sig { returns(T.nilable(Integer)) } + attr_accessor :max_output_tokens + + # The Responses backend model to use for subsequent delegated requests. Omit to + # keep the current backend model. + sig { returns(T.nilable(String)) } + attr_reader :model + + sig { params(model: String).void } + attr_writer :model + + # Whether the delegated Responses model may request multiple tool calls in a + # single response. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :parallel_tool_calls + + # Reasoning settings passed to each delegated Responses request. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning)) } + attr_reader :reasoning + + sig { params(reasoning: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::OrHash)).void } + attr_writer :reasoning + + # Service tier for delegated Responses requests. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::OrSymbol)) } + attr_accessor :service_tier + + # Text generation settings passed to each delegated Responses request. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Text)) } + attr_reader :text + + sig { params(text: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Text::OrHash)).void } + attr_writer :text + + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + sig { + returns( + T.nilable( + T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::OrSymbol, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam + ) + ) + ) + } + attr_reader :tool_choice + + sig { + params( + tool_choice: T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::OrSymbol, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam::OrHash, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam::OrHash + ) + ) + .void + } + attr_writer :tool_choice + + # Tools available to the Responses backend while it handles tasks delegated by the + # Live model. + sig { + returns( + T.nilable( + T::Array[ + T.any(OpenAI::Live::FunctionTool, OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch) + ] + ) + ) + } + attr_reader :tools + + sig { + params( + tools: T::Array[ + T.any( + OpenAI::Live::FunctionTool::OrHash, + OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch::OrHash + ) + ] + ) + .void + } + attr_writer :tools + + # Updates to the Responses backend of an existing Live session. Omitted settings + # retain their current values. + sig do + params( + + instructions: T.nilable(String), + + max_output_tokens: T.nilable(Integer), + + model: String, + + parallel_tool_calls: T.nilable(T::Boolean), + + reasoning: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::OrHash), + + service_tier: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::OrSymbol), + + text: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Text::OrHash), + + tool_choice: T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::OrSymbol, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam::OrHash, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam::OrHash + ), + + tools: T::Array[ + T.any( + OpenAI::Live::FunctionTool::OrHash, + OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch::OrHash + ) + ] + ) + .returns(T.attached_class) + end + def self.new( + + # Instructions for the delegated Responses model, separate from Live instructions. + # See + # [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + instructions: nil, + + # Maximum number of output tokens for each delegated response. + max_output_tokens: nil, + + # The Responses backend model to use for subsequent delegated requests. Omit to + # keep the current backend model. + model: nil, + + # Whether the delegated Responses model may request multiple tool calls in a + # single response. + parallel_tool_calls: nil, + + # Reasoning settings passed to each delegated Responses request. + reasoning: nil, + + # Service tier for delegated Responses requests. + service_tier: nil, + + # Text generation settings passed to each delegated Responses request. + text: nil, + + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + tool_choice: nil, + + # Tools available to the Responses backend while it handles tasks delegated by the + # Live model. + + tools: nil + ) + end + + sig do + override.returns( + { + instructions: T.nilable(String), + max_output_tokens: T.nilable(Integer), + model: String, + parallel_tool_calls: T.nilable(T::Boolean), + reasoning: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning), + service_tier: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::OrSymbol), + text: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Text), + tool_choice: T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::OrSymbol, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam + ), + tools: T::Array[ + T.any(OpenAI::Live::FunctionTool, OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch) + ] + } + ) + end + def to_hash + end + + class Reasoning < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning, + OpenAI::Internal::AnyHash + ) + end + + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::OrSymbol)) } + attr_accessor :effort + + # The reasoning summary to request from the delegated Responses model, when + # supported. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary::OrSymbol)) } + attr_accessor :summary + + # Reasoning settings passed to each delegated Responses request. + sig do + params( + + effort: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::OrSymbol), + + summary: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary::OrSymbol) + ) + .returns(T.attached_class) + end + def self.new( + + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + effort: nil, + + # The reasoning summary to request from the delegated Responses model, when + # supported. + + summary: nil + ) + end + + sig do + override.returns( + { + effort: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::OrSymbol), + summary: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary::OrSymbol) + } + ) + end + def to_hash + end + + # How much reasoning effort the delegated Responses model should use. Supported + # values depend on the backend model. + module Effort + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = T.let(:none, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::TaggedSymbol) + MINIMAL = T.let(:minimal, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::TaggedSymbol) + LOW = T.let(:low, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::TaggedSymbol) + XHIGH = T.let(:xhigh, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Effort::TaggedSymbol]) + } + def self.values + end + end + + # The reasoning summary to request from the delegated Responses model, when + # supported. + module Summary + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CONCISE = T.let(:concise, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary::TaggedSymbol) + DETAILED = T.let(:detailed, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning::Summary::TaggedSymbol] + ) + } + def self.values + end + end + end + + # Service tier for delegated Responses requests. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::TaggedSymbol) + DEFAULT = T.let(:default, OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::TaggedSymbol) + FAST_TIER_TEMP_PILOT = T.let( + :fast_tier_temp_pilot, + OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::TaggedSymbol + ) + FLEX = T.let(:flex, OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::TaggedSymbol) + PRIORITY = T.let(:priority, OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::TaggedSymbol) + ULTRAFAST = T.let(:ultrafast, OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Live::ResponsesDelegationUpdateConfig::ServiceTier::TaggedSymbol]) } + def self.values + end + end + + class Text < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::Text, + OpenAI::Internal::AnyHash + ) + end + + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity::OrSymbol)) } + attr_accessor :verbosity + + # Text generation settings passed to each delegated Responses request. + sig do + params( + + verbosity: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity::OrSymbol) + ) + .returns(T.attached_class) + end + def self.new( + + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + + verbosity: nil + ) + end + + sig do + override.returns( + {verbosity: T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity::OrSymbol)} + ) + end + def to_hash + end + + # The amount of detail in text generated by the Responses backend. This does not + # configure the Live model’s spoken delivery. + module Verbosity + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOW = T.let(:low, OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Live::ResponsesDelegationUpdateConfig::Text::Verbosity::TaggedSymbol]) + } + def self.values + end + end + end + + # Controls which tool the Responses backend uses when handling a task delegated by + # the Live model. + module ToolChoice + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam + ) + } + + module LiveToolChoiceEnum + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let( + :auto, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol + ) + NONE = T.let( + :none, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol + ) + REQUIRED = T.let( + :required, + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol + ) + + sig { + override.returns( + T::Array[OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveToolChoiceEnum::TaggedSymbol] + ) + } + def self.values + end + end + + class LiveFunctionToolChoiceParam < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :name + + sig { returns(Symbol) } + attr_accessor :type + + sig do + params( + + name: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + name:, + + type: :function + ) + end + + sig do + override.returns( + {name: String, type: Symbol} + ) + end + def to_hash + end + + end + + class LiveMCPToolChoiceParam < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :name + + sig { returns(String) } + attr_accessor :server_label + + sig { returns(Symbol) } + attr_accessor :type + + sig do + params( + + name: String, + + server_label: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + name:, + + server_label:, + + type: :mcp + ) + end + + sig do + override.returns( + {name: String, server_label: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::Variants]) } + def self.variants + end + + end + + # A function tool available to the Responses backend when the Live model delegates + # a task. + module Tool + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(OpenAI::Live::FunctionTool, OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch) + } + + class WebSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch, + OpenAI::Internal::AnyHash + ) + end + + # The tool type. Always `web_search`. + sig { returns(Symbol) } + attr_accessor :type + + # A web search tool available to the Live session’s Responses backend. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The tool type. Always `web_search`. + + type: :web_search + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::Variants]) } + def self.variants + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/server_event.rbi b/rbi/openai/models/live/server_event.rbi new file mode 100644 index 000000000..954675cea --- /dev/null +++ b/rbi/openai/models/live/server_event.rbi @@ -0,0 +1,436 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + # Server events for Live. Response lifecycle events are wrapped inside + # response.event; dispatch the nested event by its full type and tolerate new + # response event types. Follow the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # when designing the conversation and delegation policy. + module ServerEvent + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Live::SessionStartedEvent, + OpenAI::Live::SessionUpdatedEvent, + OpenAI::Live::InputAudioMutedEvent, + OpenAI::Live::InputAudioUnmutedEvent, + OpenAI::Live::InstructionsAppendedEvent, + OpenAI::Live::ThinkingAppendedEvent, + OpenAI::Live::CommentaryAppendedEvent, + OpenAI::Live::ServerEvent::SessionInputAudioAppend, + OpenAI::Live::OutputAudioDeltaEvent, + OpenAI::Live::InputTranscriptDeltaEvent, + OpenAI::Live::OutputTranscriptDeltaEvent, + OpenAI::Live::DelegationCreatedEvent, + OpenAI::Live::ResponseEvent, + OpenAI::Live::SessionUsageUpdatedEvent, + OpenAI::Live::SessionClosedEvent, + OpenAI::Live::ErrorEvent, + OpenAI::Live::InfoEvent, + OpenAI::Live::ServerEvent::TransportDtmfReceived, + OpenAI::Live::ServerEvent::TransportDtmfSend, + OpenAI::Live::ServerEvent::TransportRinging, + OpenAI::Live::ServerEvent::TransportAnswered, + OpenAI::Live::ServerEvent::TransportFailed + ) + end + + class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ServerEvent::SessionInputAudioAppend, + OpenAI::Internal::AnyHash + ) + end + + # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, + # reflected to the sideband before model-input muting. This server event uses the + # same audio key as the client command, but is not an acknowledgment of it. + sig { returns(String) } + attr_accessor :audio + + # The event type, always `session.input_audio.append`. + sig { returns(Symbol) } + attr_accessor :type + + # Input audio received from the primary transport and reflected to a Live sideband + # connection before model-input muting. + sig do + params( + + audio: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport, + # reflected to the sideband before model-input muting. This server event uses the + # same audio key as the client command, but is not an acknowledgment of it. + audio:, + + # The event type, always `session.input_audio.append`. + + type: :"session.input_audio.append" + ) + end + + sig do + override.returns( + {audio: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportDtmfReceived < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ServerEvent::TransportDtmfReceived, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :event + + sig { returns(String) } + attr_accessor :event_id + + sig { returns(Symbol) } + attr_accessor :type + + # A SIP DTMF keypress received from the caller. Delivered only to sideband + # observers. + sig do + params( + + event: String, + + event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + event:, + + event_id:, + + type: :"transport.dtmf.received" + ) + end + + sig do + override.returns( + {event: String, event_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportDtmfSend < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ServerEvent::TransportDtmfSend, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :event + + sig { returns(String) } + attr_accessor :event_id + + sig { returns(Symbol) } + attr_accessor :type + + # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to + # sideband observers; this is not a client command. + sig do + params( + + event: String, + + event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + event:, + + event_id:, + + type: :"transport.dtmf.send" + ) + end + + sig do + override.returns( + {event: String, event_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportRinging < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ServerEvent::TransportRinging, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :event_id + + # The canonical Live session ID. + sig { returns(String) } + attr_accessor :session_id + + sig { returns(Symbol) } + attr_accessor :type + + # The outbound SIP provider leg is ringing or providing early media. Delivered + # only to sideband observers. + sig do + params( + + event_id: String, + + session_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + event_id:, + + # The canonical Live session ID. + session_id:, + + type: :"transport.ringing" + ) + end + + sig do + override.returns( + {event_id: String, session_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportAnswered < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ServerEvent::TransportAnswered, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :event_id + + # The canonical Live session ID. + sig { returns(String) } + attr_accessor :session_id + + sig { returns(Symbol) } + attr_accessor :type + + # The outbound SIP provider leg answered and media is established. Delivered only + # to sideband observers. + sig do + params( + + event_id: String, + + session_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + event_id:, + + # The canonical Live session ID. + session_id:, + + type: :"transport.answered" + ) + end + + sig do + override.returns( + {event_id: String, session_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class TransportFailed < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ServerEvent::TransportFailed, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(OpenAI::Live::ServerEvent::TransportFailed::Error) } + attr_reader :error + + sig { params(error: OpenAI::Live::ServerEvent::TransportFailed::Error::OrHash).void } + attr_writer :error + + sig { returns(String) } + attr_accessor :event_id + + # The canonical Live session ID. + sig { returns(String) } + attr_accessor :session_id + + sig { returns(Symbol) } + attr_accessor :type + + # An asynchronous outbound SIP setup failure. Delivered only to sideband + # observers. + sig do + params( + + error: OpenAI::Live::ServerEvent::TransportFailed::Error::OrHash, + + event_id: String, + + session_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + error:, + + event_id:, + + # The canonical Live session ID. + session_id:, + + type: :"transport.failed" + ) + end + + sig do + override.returns( + { + error: OpenAI::Live::ServerEvent::TransportFailed::Error, + event_id: String, + session_id: String, + type: Symbol + } + ) + end + def to_hash + end + + class Error < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::ServerEvent::TransportFailed::Error, + OpenAI::Internal::AnyHash + ) + end + + # The call setup failure code. + sig { returns(String) } + attr_accessor :code + + sig { returns(String) } + attr_accessor :message + + sig { returns(Symbol) } + attr_accessor :type + + # The parameter related to the error, if any. Empty when no parameter applies. + sig { returns(T.nilable(String)) } + attr_reader :param + + sig { params(param: String).void } + attr_writer :param + + sig do + params( + + code: String, + + message: String, + + param: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The call setup failure code. + code:, + + message:, + + # The parameter related to the error, if any. Empty when no parameter applies. + param: nil, + + type: :call_error + ) + end + + sig do + override.returns( + {code: String, message: String, type: Symbol, param: T.nilable(String)} + ) + end + def to_hash + end + + end + end + + sig { override.returns(T::Array[OpenAI::Live::ServerEvent::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/server_event_selector.rbi b/rbi/openai/models/live/server_event_selector.rbi new file mode 100644 index 000000000..7a5183b51 --- /dev/null +++ b/rbi/openai/models/live/server_event_selector.rbi @@ -0,0 +1,64 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ServerEventSelector < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ServerEventSelector, + OpenAI::Internal::AnyHash + ) + end + + # The outer Live server event type. Use 'response.event' for Responses events. + sig { returns(String) } + attr_accessor :type + + # The nested Responses event type. Required when type is 'response.event'; + # forbidden for other event types. + sig { returns(T.nilable(String)) } + attr_reader :response_event + + sig { params(response_event: String).void } + attr_writer :response_event + + # A Live server event selector for the WebRTC frontend data channel. + sig do + params( + + type: String, + + response_event: String + ) + .returns(T.attached_class) + end + def self.new( + + # The outer Live server event type. Use 'response.event' for Responses events. + type:, + + # The nested Responses event type. Required when type is 'response.event'; + # forbidden for other event types. + + response_event: nil + ) + end + + sig do + override.returns( + {type: String, response_event: String} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_accept_params.rbi b/rbi/openai/models/live/session_accept_params.rbi new file mode 100644 index 000000000..17cde5964 --- /dev/null +++ b/rbi/openai/models/live/session_accept_params.rbi @@ -0,0 +1,451 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionAcceptParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionAcceptParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # Model and startup configuration for the Live session that answers the incoming + # SIP call. + sig { returns(OpenAI::Live::SessionAcceptParams::Session) } + attr_reader :session + + sig { params(session: OpenAI::Live::SessionAcceptParams::Session::OrHash).void } + attr_writer :session + + sig do + params( + + session_id: String, + + session: OpenAI::Live::SessionAcceptParams::Session::OrHash, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # Model and startup configuration for the Live session that answers the incoming + # SIP call. + session:, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + session: OpenAI::Live::SessionAcceptParams::Session, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + class Session < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionAcceptParams::Session, + OpenAI::Internal::AnyHash + ) + end + + # The Live model to use for the accepted call. + sig { returns(T.any(String, OpenAI::Live::SessionAcceptParams::Session::Model::OrSymbol)) } + attr_accessor :model + + # The session type. Always `live`. + sig { returns(Symbol) } + attr_accessor :type + + # Startup audio output configuration. SIP negotiates the media format; + # audio.format is only accepted for primary WebSockets. Voice cannot change after + # startup. + sig { returns(T.nilable(OpenAI::Live::SessionAcceptParams::Session::Audio)) } + attr_reader :audio + + sig { params(audio: OpenAI::Live::SessionAcceptParams::Session::Audio::OrHash).void } + attr_writer :audio + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + sig { + returns( + T.nilable( + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionAcceptParams::Session::Delegation::Responses) + ) + ) + } + attr_accessor :delegation + + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + ] + ) + ) + } + attr_reader :input + + sig { + params( + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer::OrHash, + OpenAI::Live::InitialItem::User::OrHash, + OpenAI::Live::InitialItem::Assistant::OrHash + ) + ] + ) + .void + } + attr_writer :input + + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :store + + sig { params(store: T::Boolean).void } + attr_writer :store + + # Model and startup configuration for the Live session that answers the incoming + # SIP call. + sig do + params( + + model: T.any(String, OpenAI::Live::SessionAcceptParams::Session::Model::OrSymbol), + + audio: OpenAI::Live::SessionAcceptParams::Session::Audio::OrHash, + + delegation: T.nilable( + T.any( + OpenAI::Live::ClientDelegation::OrHash, + OpenAI::Live::SessionAcceptParams::Session::Delegation::Responses::OrHash + ) + ), + + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer::OrHash, + OpenAI::Live::InitialItem::User::OrHash, + OpenAI::Live::InitialItem::Assistant::OrHash + ) + ], + + instructions: T.nilable(String), + + store: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The Live model to use for the accepted call. + model:, + + # Startup audio output configuration. SIP negotiates the media format; + # audio.format is only accepted for primary WebSockets. Voice cannot change after + # startup. + audio: nil, + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + delegation: nil, + + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + input: nil, + + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + instructions: nil, + + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + store: nil, + + # The session type. Always `live`. + + type: :live + ) + end + + sig do + override.returns( + { + model: T.any(String, OpenAI::Live::SessionAcceptParams::Session::Model::OrSymbol), + type: Symbol, + audio: OpenAI::Live::SessionAcceptParams::Session::Audio, + delegation: T.nilable( + T.any( + OpenAI::Live::ClientDelegation, + OpenAI::Live::SessionAcceptParams::Session::Delegation::Responses + ) + ), + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + ], + instructions: T.nilable(String), + store: T::Boolean + } + ) + end + def to_hash + end + + # The Live model to use for the accepted call. + module Model + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { T.any(String, OpenAI::Live::SessionAcceptParams::Session::Model::TaggedSymbol) } + + sig { override.returns(T::Array[OpenAI::Live::SessionAcceptParams::Session::Model::Variants]) } + def self.variants + end + + TaggedSymbol = T.type_alias do + T.all(Symbol, OpenAI::Live::SessionAcceptParams::Session::Model) + end + + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GPT_LIVE_1 = T.let(:"gpt-live-1", OpenAI::Live::SessionAcceptParams::Session::Model::TaggedSymbol) + + end + + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionAcceptParams::Session::Audio, + OpenAI::Internal::AnyHash + ) + end + + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + sig { returns(T.nilable(OpenAI::Live::SessionAcceptParams::Session::Audio::Output)) } + attr_reader :output + + sig { params(output: OpenAI::Live::SessionAcceptParams::Session::Audio::Output::OrHash).void } + attr_writer :output + + # Startup audio output configuration. SIP negotiates the media format; + # audio.format is only accepted for primary WebSockets. Voice cannot change after + # startup. + sig do + params( + + output: OpenAI::Live::SessionAcceptParams::Session::Audio::Output::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + + output: nil + ) + end + + sig do + override.returns( + {output: OpenAI::Live::SessionAcceptParams::Session::Audio::Output} + ) + end + def to_hash + end + + class Output < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionAcceptParams::Session::Audio::Output, + OpenAI::Internal::AnyHash + ) + end + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + sig { + returns(T.nilable(T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice))) + } + attr_reader :voice + + sig { + params(voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice::OrHash)) + .void + } + attr_writer :voice + + # Settings for speech generated by the Live model. Choose the voice before + # starting the session. + sig do + params( + + voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice::OrHash) + ) + .returns(T.attached_class) + end + def self.new( + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + + voice: nil + ) + end + + sig do + override.returns( + {voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice)} + ) + end + def to_hash + end + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + module Voice + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(String, OpenAI::Live::BuiltInVoice::TaggedSymbol, OpenAI::Live::CustomVoice) + } + + sig { + override.returns(T::Array[OpenAI::Live::SessionAcceptParams::Session::Audio::Output::Voice::Variants]) + } + def self.variants + end + + end + end + end + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + module Delegation + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionAcceptParams::Session::Delegation::Responses) + } + + class Responses < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionAcceptParams::Session::Delegation::Responses, + OpenAI::Internal::AnyHash + ) + end + + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + sig { returns(OpenAI::Live::ResponsesDelegationConfig) } + attr_reader :responses + + sig { params(responses: OpenAI::Live::ResponsesDelegationConfig::OrHash).void } + attr_writer :responses + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + sig { returns(Symbol) } + attr_accessor :type + + # Delegate tasks to a Responses model managed by the Live session. + sig do + params( + + responses: OpenAI::Live::ResponsesDelegationConfig::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + responses:, + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + + type: :responses + ) + end + + sig do + override.returns( + {responses: OpenAI::Live::ResponsesDelegationConfig, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::SessionAcceptParams::Session::Delegation::Variants]) } + def self.variants + end + + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_close_event.rbi b/rbi/openai/models/live/session_close_event.rbi new file mode 100644 index 000000000..f1e241c43 --- /dev/null +++ b/rbi/openai/models/live/session_close_event.rbi @@ -0,0 +1,62 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionCloseEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionCloseEvent, + OpenAI::Internal::AnyHash + ) + end + + # The Live client event type. Always `session.close`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Request that the Live session close. The terminal `session.closed` event + # contains the close reason and final usage. + sig do + params( + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.close`. + + type: :"session.close" + ) + end + + sig do + override.returns( + {type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_closed_event.rbi b/rbi/openai/models/live/session_closed_event.rbi new file mode 100644 index 000000000..34a77b13d --- /dev/null +++ b/rbi/openai/models/live/session_closed_event.rbi @@ -0,0 +1,148 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionClosedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionClosedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # Why the Live session ended: `close_requested` for an application close or hangup + # request, `expired` for the session duration limit, `content` for a safety + # filter, `remote_hangup` for a graceful remote disconnect, or `connection_lost` + # for an unexpected primary or upstream disconnection. + sig { returns(OpenAI::Live::SessionClosedEvent::Reason::OrSymbol) } + attr_accessor :reason + + # The resolved Live session configuration and server-assigned session metadata. + sig { returns(OpenAI::Live::SessionResource) } + attr_reader :session + + sig { params(session: OpenAI::Live::SessionResource::OrHash).void } + attr_writer :session + + # The event type, always `session.closed`. + sig { returns(Symbol) } + attr_accessor :type + + # The final cumulative Live audio usage after session finalization. + sig { returns(OpenAI::Live::SessionUsage) } + attr_reader :usage + + sig { params(usage: OpenAI::Live::SessionUsage::OrHash).void } + attr_writer :usage + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned after the Live session finishes finalizing, with the close reason, + # final session snapshot, and cumulative audio usage. A connection closing without + # this event does not confirm successful finalization. + sig do + params( + + event_id: String, + + reason: OpenAI::Live::SessionClosedEvent::Reason::OrSymbol, + + session: OpenAI::Live::SessionResource::OrHash, + + usage: OpenAI::Live::SessionUsage::OrHash, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the Live server event. + event_id:, + + # Why the Live session ended: `close_requested` for an application close or hangup + # request, `expired` for the session duration limit, `content` for a safety + # filter, `remote_hangup` for a graceful remote disconnect, or `connection_lost` + # for an unexpected primary or upstream disconnection. + reason:, + + # The resolved Live session configuration and server-assigned session metadata. + session:, + + # The final cumulative Live audio usage after session finalization. + usage:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.closed`. + + type: :"session.closed" + ) + end + + sig do + override.returns( + { + event_id: String, + reason: OpenAI::Live::SessionClosedEvent::Reason::OrSymbol, + session: OpenAI::Live::SessionResource, + type: Symbol, + usage: OpenAI::Live::SessionUsage, + client_event_id: T.nilable(String) + } + ) + end + def to_hash + end + + # Why the Live session ended: `close_requested` for an application close or hangup + # request, `expired` for the session duration limit, `content` for a safety + # filter, `remote_hangup` for a graceful remote disconnect, or `connection_lost` + # for an unexpected primary or upstream disconnection. + module Reason + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { OpenAI::Live::SessionClosedEvent::Reason::TaggedSymbol } + + sig { override.returns(T::Array[OpenAI::Live::SessionClosedEvent::Reason::Variants]) } + def self.variants + end + + TaggedSymbol = T.type_alias do + T.all(Symbol, OpenAI::Live::SessionClosedEvent::Reason) + end + + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CLOSE_REQUESTED = T.let(:close_requested, OpenAI::Live::SessionClosedEvent::Reason::TaggedSymbol) + EXPIRED = T.let(:expired, OpenAI::Live::SessionClosedEvent::Reason::TaggedSymbol) + CONTENT = T.let(:content, OpenAI::Live::SessionClosedEvent::Reason::TaggedSymbol) + REMOTE_HANGUP = T.let(:remote_hangup, OpenAI::Live::SessionClosedEvent::Reason::TaggedSymbol) + CONNECTION_LOST = T.let(:connection_lost, OpenAI::Live::SessionClosedEvent::Reason::TaggedSymbol) + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_config.rbi b/rbi/openai/models/live/session_config.rbi new file mode 100644 index 000000000..6a992646e --- /dev/null +++ b/rbi/openai/models/live/session_config.rbi @@ -0,0 +1,427 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionConfig, + OpenAI::Internal::AnyHash + ) + end + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + sig { returns(T.any(String, OpenAI::Live::SessionConfig::Model::OrSymbol)) } + attr_accessor :model + + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + sig { returns(T.nilable(OpenAI::Live::SessionConfig::Audio)) } + attr_reader :audio + + sig { params(audio: OpenAI::Live::SessionConfig::Audio::OrHash).void } + attr_writer :audio + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + sig { returns(T.nilable(OpenAI::Live::ClientConfig)) } + attr_reader :client + + sig { params(client: OpenAI::Live::ClientConfig::OrHash).void } + attr_writer :client + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + sig { + returns(T.nilable(T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionConfig::Delegation::Responses))) + } + attr_accessor :delegation + + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + ] + ) + ) + } + attr_reader :input + + sig { + params( + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer::OrHash, + OpenAI::Live::InitialItem::User::OrHash, + OpenAI::Live::InitialItem::Assistant::OrHash + ) + ] + ) + .void + } + attr_writer :input + + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :store + + sig { params(store: T::Boolean).void } + attr_writer :store + + # Initial configuration for a Live session, including its model, conversation + # instructions, audio, and delegated task handling. + sig do + params( + + model: T.any(String, OpenAI::Live::SessionConfig::Model::OrSymbol), + + audio: OpenAI::Live::SessionConfig::Audio::OrHash, + + client: OpenAI::Live::ClientConfig::OrHash, + + delegation: T.nilable( + T.any(OpenAI::Live::ClientDelegation::OrHash, OpenAI::Live::SessionConfig::Delegation::Responses::OrHash) + ), + + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer::OrHash, + OpenAI::Live::InitialItem::User::OrHash, + OpenAI::Live::InitialItem::Assistant::OrHash + ) + ], + + instructions: T.nilable(String), + + store: T::Boolean + ) + .returns(T.attached_class) + end + def self.new( + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + model:, + + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + audio: nil, + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + client: nil, + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + delegation: nil, + + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + input: nil, + + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + instructions: nil, + + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + + store: nil + ) + end + + sig do + override.returns( + { + model: T.any(String, OpenAI::Live::SessionConfig::Model::OrSymbol), + audio: OpenAI::Live::SessionConfig::Audio, + client: OpenAI::Live::ClientConfig, + delegation: T.nilable( + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionConfig::Delegation::Responses) + ), + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + ], + instructions: T.nilable(String), + store: T::Boolean + } + ) + end + def to_hash + end + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + module Model + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { T.any(String, OpenAI::Live::SessionConfig::Model::TaggedSymbol) } + + sig { override.returns(T::Array[OpenAI::Live::SessionConfig::Model::Variants]) } + def self.variants + end + + TaggedSymbol = T.type_alias do + T.all(Symbol, OpenAI::Live::SessionConfig::Model) + end + + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GPT_LIVE_1 = T.let(:"gpt-live-1", OpenAI::Live::SessionConfig::Model::TaggedSymbol) + + end + + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionConfig::Audio, + OpenAI::Internal::AnyHash + ) + end + + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + sig { + returns( + T.nilable( + T.any( + OpenAI::Live::AudioFormat::AudioPCM, + OpenAI::Live::AudioFormat::AudioPCMU, + OpenAI::Live::AudioFormat::AudioPCMA + ) + ) + ) + } + attr_reader :format_ + + sig { + params( + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM::OrHash, + OpenAI::Live::AudioFormat::AudioPCMU::OrHash, + OpenAI::Live::AudioFormat::AudioPCMA::OrHash + ) + ) + .void + } + attr_writer :format_ + + # The voice used for speech generated by the Live model. + sig { returns(T.nilable(OpenAI::Live::SessionConfig::Audio::Output)) } + attr_reader :output + + sig { params(output: OpenAI::Live::SessionConfig::Audio::Output::OrHash).void } + attr_writer :output + + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + sig do + params( + + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM::OrHash, + OpenAI::Live::AudioFormat::AudioPCMU::OrHash, + OpenAI::Live::AudioFormat::AudioPCMA::OrHash + ), + + output: OpenAI::Live::SessionConfig::Audio::Output::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + format_: nil, + + # The voice used for speech generated by the Live model. + + output: nil + ) + end + + sig do + override.returns( + { + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM, + OpenAI::Live::AudioFormat::AudioPCMU, + OpenAI::Live::AudioFormat::AudioPCMA + ), + output: OpenAI::Live::SessionConfig::Audio::Output + } + ) + end + def to_hash + end + + class Output < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionConfig::Audio::Output, + OpenAI::Internal::AnyHash + ) + end + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + sig { returns(T.nilable(T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice))) } + attr_reader :voice + + sig { + params(voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice::OrHash)).void + } + attr_writer :voice + + # The voice used for speech generated by the Live model. + sig do + params( + + voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice::OrHash) + ) + .returns(T.attached_class) + end + def self.new( + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + + voice: nil + ) + end + + sig do + override.returns( + {voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice)} + ) + end + def to_hash + end + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + module Voice + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(String, OpenAI::Live::BuiltInVoice::TaggedSymbol, OpenAI::Live::CustomVoice) + } + + sig { override.returns(T::Array[OpenAI::Live::SessionConfig::Audio::Output::Voice::Variants]) } + def self.variants + end + + end + end + end + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + module Delegation + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionConfig::Delegation::Responses) + } + + class Responses < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionConfig::Delegation::Responses, + OpenAI::Internal::AnyHash + ) + end + + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + sig { returns(OpenAI::Live::ResponsesDelegationConfig) } + attr_reader :responses + + sig { params(responses: OpenAI::Live::ResponsesDelegationConfig::OrHash).void } + attr_writer :responses + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + sig { returns(Symbol) } + attr_accessor :type + + # Delegate tasks to a Responses model managed by the Live session. + sig do + params( + + responses: OpenAI::Live::ResponsesDelegationConfig::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + responses:, + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + + type: :responses + ) + end + + sig do + override.returns( + {responses: OpenAI::Live::ResponsesDelegationConfig, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::SessionConfig::Delegation::Variants]) } + def self.variants + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_download_recording_params.rbi b/rbi/openai/models/live/session_download_recording_params.rbi new file mode 100644 index 000000000..c990e2a6f --- /dev/null +++ b/rbi/openai/models/live/session_download_recording_params.rbi @@ -0,0 +1,57 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionDownloadRecordingParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionDownloadRecordingParams, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the stored Live session to download. Use the session ID returned when + # the session started with storage enabled. + sig { returns(String) } + attr_accessor :session_id + + sig do + params( + + session_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the stored Live session to download. Use the session ID returned when + # the session started with storage enabled. + session_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_fork_params.rbi b/rbi/openai/models/live/session_fork_params.rbi new file mode 100644 index 000000000..a78a91600 --- /dev/null +++ b/rbi/openai/models/live/session_fork_params.rbi @@ -0,0 +1,131 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionForkParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionForkParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # WebRTC transport with an SDP offer for the new connection to the forked session. + sig { returns(OpenAI::Live::SessionForkParams::Transport) } + attr_reader :transport + + sig { params(transport: OpenAI::Live::SessionForkParams::Transport::OrHash).void } + attr_writer :transport + + # Optional configuration overrides for the new Live session. Omit this object or + # send an empty object to inherit the stored session's settings. + sig { returns(T.nilable(OpenAI::Live::MediaSessionForkConfig)) } + attr_reader :session + + sig { params(session: OpenAI::Live::MediaSessionForkConfig::OrHash).void } + attr_writer :session + + sig do + params( + + session_id: String, + + transport: OpenAI::Live::SessionForkParams::Transport::OrHash, + + session: OpenAI::Live::MediaSessionForkConfig::OrHash, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # WebRTC transport with an SDP offer for the new connection to the forked session. + transport:, + + # Optional configuration overrides for the new Live session. Omit this object or + # send an empty object to inherit the stored session's settings. + session: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + transport: OpenAI::Live::SessionForkParams::Transport, + session: OpenAI::Live::MediaSessionForkConfig, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + class Transport < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionForkParams::Transport, + OpenAI::Internal::AnyHash + ) + end + + # Session Description Protocol message for the WebRTC connection. + sig { returns(String) } + attr_accessor :sdp + + # The transport used for the Live session. Always `webrtc`. + sig { returns(Symbol) } + attr_accessor :type + + # WebRTC transport with an SDP offer for the new connection to the forked session. + sig do + params( + + sdp: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Session Description Protocol message for the WebRTC connection. + sdp:, + + # The transport used for the Live session. Always `webrtc`. + + type: :webrtc + ) + end + + sig do + override.returns( + {sdp: String, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_fork_response.rbi b/rbi/openai/models/live/session_fork_response.rbi new file mode 100644 index 000000000..e26fe4c70 --- /dev/null +++ b/rbi/openai/models/live/session_fork_response.rbi @@ -0,0 +1,160 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionForkResponse < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Models::Live::SessionForkResponse, + OpenAI::Internal::AnyHash + ) + end + + # The newly created Live session. Use its ID for session controls and sideband + # connections. + sig { returns(OpenAI::Models::Live::SessionForkResponse::Session) } + attr_reader :session + + sig { params(session: OpenAI::Models::Live::SessionForkResponse::Session::OrHash).void } + attr_writer :session + + # WebRTC transport with the SDP answer. + sig { returns(OpenAI::Models::Live::SessionForkResponse::Transport) } + attr_reader :transport + + sig { params(transport: OpenAI::Models::Live::SessionForkResponse::Transport::OrHash).void } + attr_writer :transport + + # The created Live session identifier and WebRTC answer. Apply transport.sdp as + # the peer's remote answer and wait for session.started on the data channel before + # sending commands. + sig do + params( + + session: OpenAI::Models::Live::SessionForkResponse::Session::OrHash, + + transport: OpenAI::Models::Live::SessionForkResponse::Transport::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # The newly created Live session. Use its ID for session controls and sideband + # connections. + session:, + + # WebRTC transport with the SDP answer. + + transport: + ) + end + + sig do + override.returns( + { + session: OpenAI::Models::Live::SessionForkResponse::Session, + transport: OpenAI::Models::Live::SessionForkResponse::Transport + } + ) + end + def to_hash + end + + class Session < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Models::Live::SessionForkResponse::Session, + OpenAI::Internal::AnyHash + ) + end + + # Opaque session identifier. Preserve the returned value unchanged, including its + # prefix. + sig { returns(String) } + attr_accessor :id + + # The newly created Live session. Use its ID for session controls and sideband + # connections. + sig do + params( + + id: String + ) + .returns(T.attached_class) + end + def self.new( + + # Opaque session identifier. Preserve the returned value unchanged, including its + # prefix. + + id: + ) + end + + sig do + override.returns( + {id: String} + ) + end + def to_hash + end + + end + + class Transport < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Models::Live::SessionForkResponse::Transport, + OpenAI::Internal::AnyHash + ) + end + + # Session Description Protocol message for the WebRTC connection. + sig { returns(String) } + attr_accessor :sdp + + # The transport used for the Live session. Always `webrtc`. + sig { returns(Symbol) } + attr_accessor :type + + # WebRTC transport with the SDP answer. + sig do + params( + + sdp: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Session Description Protocol message for the WebRTC connection. + sdp:, + + # The transport used for the Live session. Always `webrtc`. + + type: :webrtc + ) + end + + sig do + override.returns( + {sdp: String, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_hangup_params.rbi b/rbi/openai/models/live/session_hangup_params.rbi new file mode 100644 index 000000000..b1297f24e --- /dev/null +++ b/rbi/openai/models/live/session_hangup_params.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionHangupParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionHangupParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig do + params( + + session_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_refer_params.rbi b/rbi/openai/models/live/session_refer_params.rbi new file mode 100644 index 000000000..adfc2057b --- /dev/null +++ b/rbi/openai/models/live/session_refer_params.rbi @@ -0,0 +1,64 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionReferParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionReferParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or + # sip:agent@example.com. + sig { returns(String) } + attr_accessor :target_uri + + sig do + params( + + session_id: String, + + target_uri: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or + # sip:agent@example.com. + target_uri:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, target_uri: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_reject_params.rbi b/rbi/openai/models/live/session_reject_params.rbi new file mode 100644 index 000000000..d8b329f71 --- /dev/null +++ b/rbi/openai/models/live/session_reject_params.rbi @@ -0,0 +1,62 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionRejectParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionRejectParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # SIP rejection status sent to the caller. This field is required. + sig { returns(Integer) } + attr_accessor :status_code + + sig do + params( + + session_id: String, + + status_code: Integer, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # SIP rejection status sent to the caller. This field is required. + status_code:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, status_code: Integer, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_resource.rbi b/rbi/openai/models/live/session_resource.rbi new file mode 100644 index 000000000..71b7e0cf1 --- /dev/null +++ b/rbi/openai/models/live/session_resource.rbi @@ -0,0 +1,461 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionResource < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionResource, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the Live session. Use this ID for sideband connections, + # forking, and recording download. + sig { returns(String) } + attr_accessor :id + + # The Unix timestamp, in seconds, at which the Live session expires. + sig { returns(Integer) } + attr_accessor :expires_at + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + sig { returns(OpenAI::Live::SessionResource::Model::Variants) } + attr_accessor :model + + # The status of the session snapshot. Always `active`, including the final + # snapshot in session.closed; use the event type to determine that the session has + # closed. + sig { returns(Symbol) } + attr_accessor :status + + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + sig { returns(T.nilable(OpenAI::Live::SessionResource::Audio)) } + attr_reader :audio + + sig { params(audio: OpenAI::Live::SessionResource::Audio::OrHash).void } + attr_writer :audio + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + sig { returns(T.nilable(OpenAI::Live::ClientConfig)) } + attr_reader :client + + sig { params(client: OpenAI::Live::ClientConfig::OrHash).void } + attr_writer :client + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + sig { returns(T.nilable(OpenAI::Live::SessionResource::Delegation::Variants)) } + attr_accessor :delegation + + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + ] + ) + ) + } + attr_reader :input + + sig { + params( + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer::OrHash, + OpenAI::Live::InitialItem::User::OrHash, + OpenAI::Live::InitialItem::Assistant::OrHash + ) + ] + ) + .void + } + attr_writer :input + + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :store + + sig { params(store: T::Boolean).void } + attr_writer :store + + # The resolved Live session configuration and server-assigned session metadata. + sig do + params( + + id: String, + + expires_at: Integer, + + model: T.any(String, OpenAI::Live::SessionResource::Model::OrSymbol), + + audio: OpenAI::Live::SessionResource::Audio::OrHash, + + client: OpenAI::Live::ClientConfig::OrHash, + + delegation: T.nilable( + T.any( + OpenAI::Live::ClientDelegation::OrHash, + OpenAI::Live::SessionResource::Delegation::Responses::OrHash + ) + ), + + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer::OrHash, + OpenAI::Live::InitialItem::User::OrHash, + OpenAI::Live::InitialItem::Assistant::OrHash + ) + ], + + instructions: T.nilable(String), + + store: T::Boolean, + + status: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the Live session. Use this ID for sideband connections, + # forking, and recording download. + id:, + + # The Unix timestamp, in seconds, at which the Live session expires. + expires_at:, + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + model:, + + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + audio: nil, + + # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC + # session. Trusted sideband connections are unaffected. + client: nil, + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + delegation: nil, + + # Ordered text-only history supplied before startup. Supports developer, user, and + # assistant messages with one text part each; at most 128 messages and 8,192 + # rendered tokens in total. + input: nil, + + # Frontend instructions for voice, conversation, interruptions, and when to + # delegate. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); + # put business rules and tool workflows in a separate + # [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + # Limited to 16,384 client-supplied tokens. Omitted or blank instructions use + # server defaults. Immutable after startup. + instructions: nil, + + # Whether to store the session for later forking and recording download. Defaults + # to false for new sessions. + store: nil, + + # The status of the session snapshot. Always `active`, including the final + # snapshot in session.closed; use the event type to determine that the session has + # closed. + + status: :active + ) + end + + sig do + override.returns( + { + id: String, + expires_at: Integer, + model: OpenAI::Live::SessionResource::Model::Variants, + status: Symbol, + audio: OpenAI::Live::SessionResource::Audio, + client: OpenAI::Live::ClientConfig, + delegation: T.nilable(OpenAI::Live::SessionResource::Delegation::Variants), + input: T::Array[ + T.any( + OpenAI::Live::InitialItem::Developer, + OpenAI::Live::InitialItem::User, + OpenAI::Live::InitialItem::Assistant + ) + ], + instructions: T.nilable(String), + store: T::Boolean + } + ) + end + def to_hash + end + + # The Live model. Required in the session configuration for every transport; do + # not pass it as a URL query parameter. + module Model + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { T.any(String, OpenAI::Live::SessionResource::Model::TaggedSymbol) } + + sig { override.returns(T::Array[OpenAI::Live::SessionResource::Model::Variants]) } + def self.variants + end + + TaggedSymbol = T.type_alias do + T.all(Symbol, OpenAI::Live::SessionResource::Model) + end + + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GPT_LIVE_1 = T.let(:"gpt-live-1", OpenAI::Live::SessionResource::Model::TaggedSymbol) + + end + + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionResource::Audio, + OpenAI::Internal::AnyHash + ) + end + + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + sig { + returns( + T.nilable( + T.any( + OpenAI::Live::AudioFormat::AudioPCM, + OpenAI::Live::AudioFormat::AudioPCMU, + OpenAI::Live::AudioFormat::AudioPCMA + ) + ) + ) + } + attr_reader :format_ + + sig { + params( + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM::OrHash, + OpenAI::Live::AudioFormat::AudioPCMU::OrHash, + OpenAI::Live::AudioFormat::AudioPCMA::OrHash + ) + ) + .void + } + attr_writer :format_ + + # The voice used for speech generated by the Live model. + sig { returns(T.nilable(OpenAI::Live::SessionResource::Audio::Output)) } + attr_reader :output + + sig { params(output: OpenAI::Live::SessionResource::Audio::Output::OrHash).void } + attr_writer :output + + # Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC + # and SIP negotiate their media format. Voice and format are immutable after + # startup. + sig do + params( + + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM::OrHash, + OpenAI::Live::AudioFormat::AudioPCMU::OrHash, + OpenAI::Live::AudioFormat::AudioPCMA::OrHash + ), + + output: OpenAI::Live::SessionResource::Audio::Output::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Audio encoding and sample rate for audio sent and received over a Live WebSocket + # connection. WebRTC and SIP negotiate their media format separately. + format_: nil, + + # The voice used for speech generated by the Live model. + + output: nil + ) + end + + sig do + override.returns( + { + format_: T.any( + OpenAI::Live::AudioFormat::AudioPCM, + OpenAI::Live::AudioFormat::AudioPCMU, + OpenAI::Live::AudioFormat::AudioPCMA + ), + output: OpenAI::Live::SessionResource::Audio::Output + } + ) + end + def to_hash + end + + class Output < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionResource::Audio::Output, + OpenAI::Internal::AnyHash + ) + end + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + sig { returns(T.nilable(T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice))) } + attr_reader :voice + + sig { + params(voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice::OrHash)).void + } + attr_writer :voice + + # The voice used for speech generated by the Live model. + sig do + params( + + voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice::OrHash) + ) + .returns(T.attached_class) + end + def self.new( + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + + voice: nil + ) + end + + sig do + override.returns( + {voice: T.any(String, OpenAI::Live::BuiltInVoice::OrSymbol, OpenAI::Live::CustomVoice)} + ) + end + def to_hash + end + + # The voice used for Live speech, as a built-in voice name or a custom voice + # object containing its ID. Defaults to `marin` and cannot change after startup. + module Voice + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(String, OpenAI::Live::BuiltInVoice::TaggedSymbol, OpenAI::Live::CustomVoice) + } + + sig { override.returns(T::Array[OpenAI::Live::SessionResource::Audio::Output::Voice::Variants]) } + def self.variants + end + + end + end + end + + # Who handles tasks delegated by the Live model. Omitted or null selects your + # application; use `responses` to let the API manage a Responses backend. + module Delegation + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionResource::Delegation::Responses) + } + + class Responses < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionResource::Delegation::Responses, + OpenAI::Internal::AnyHash + ) + end + + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + sig { returns(OpenAI::Live::ResponsesDelegationConfig) } + attr_reader :responses + + sig { params(responses: OpenAI::Live::ResponsesDelegationConfig::OrHash).void } + attr_writer :responses + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + sig { returns(Symbol) } + attr_accessor :type + + # Delegate tasks to a Responses model managed by the Live session. + sig do + params( + + responses: OpenAI::Live::ResponsesDelegationConfig::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Backend model, prompt, and tools used when the Live session delegates a task to + # Responses. + responses:, + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + + type: :responses + ) + end + + sig do + override.returns( + {responses: OpenAI::Live::ResponsesDelegationConfig, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::SessionResource::Delegation::Variants]) } + def self.variants + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_start_event.rbi b/rbi/openai/models/live/session_start_event.rbi new file mode 100644 index 000000000..8e0bd0d1f --- /dev/null +++ b/rbi/openai/models/live/session_start_event.rbi @@ -0,0 +1,78 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionStartEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionStartEvent, + OpenAI::Internal::AnyHash + ) + end + + # Initial configuration for a primary WebSocket. Send session.start first and wait + # for session.started before application commands. WebRTC creation already starts + # the session; do not send this event again on its data channel. + sig { returns(OpenAI::Live::SessionConfig) } + attr_reader :session + + sig { params(session: OpenAI::Live::SessionConfig::OrHash).void } + attr_writer :session + + # The Live client event type. Always `session.start`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Start a Live session on a primary WebSocket. Send this event before other + # commands and wait for `session.started`. + sig do + params( + + session: OpenAI::Live::SessionConfig::OrHash, + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Initial configuration for a primary WebSocket. Send session.start first and wait + # for session.started before application commands. WebRTC creation already starts + # the session; do not send this event again on its data channel. + session:, + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.start`. + + type: :"session.start" + ) + end + + sig do + override.returns( + {session: OpenAI::Live::SessionConfig, type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_started_event.rbi b/rbi/openai/models/live/session_started_event.rbi new file mode 100644 index 000000000..771f76296 --- /dev/null +++ b/rbi/openai/models/live/session_started_event.rbi @@ -0,0 +1,86 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionStartedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionStartedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The resolved Live session configuration and server-assigned session metadata. + sig { returns(OpenAI::Live::SessionResource) } + attr_reader :session + + sig { params(session: OpenAI::Live::SessionResource::OrHash).void } + attr_writer :session + + # The event type, always `session.started`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned when a Live session has started. Contains the resolved session + # configuration, including server defaults. + sig do + params( + + event_id: String, + + session: OpenAI::Live::SessionResource::OrHash, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the Live server event. + event_id:, + + # The resolved Live session configuration and server-assigned session metadata. + session:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.started`. + + type: :"session.started" + ) + end + + sig do + override.returns( + {event_id: String, session: OpenAI::Live::SessionResource, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_update_config.rbi b/rbi/openai/models/live/session_update_config.rbi new file mode 100644 index 000000000..00ec5a025 --- /dev/null +++ b/rbi/openai/models/live/session_update_config.rbi @@ -0,0 +1,134 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionUpdateConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionUpdateConfig, + OpenAI::Internal::AnyHash + ) + end + + # Delegation settings to update. The delegation type must match the current + # session; omitted settings retain their values. + sig { + returns( + T.nilable(T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionUpdateConfig::Delegation::Responses)) + ) + } + attr_accessor :delegation + + # Changes to an active Live session. Only delegation backend settings can be + # updated after startup. + sig do + params( + + delegation: T.nilable( + T.any( + OpenAI::Live::ClientDelegation::OrHash, + OpenAI::Live::SessionUpdateConfig::Delegation::Responses::OrHash + ) + ) + ) + .returns(T.attached_class) + end + def self.new( + + # Delegation settings to update. The delegation type must match the current + # session; omitted settings retain their values. + + delegation: nil + ) + end + + sig do + override.returns( + { + delegation: T.nilable( + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionUpdateConfig::Delegation::Responses) + ) + } + ) + end + def to_hash + end + + # Delegation settings to update. The delegation type must match the current + # session; omitted settings retain their values. + module Delegation + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any(OpenAI::Live::ClientDelegation, OpenAI::Live::SessionUpdateConfig::Delegation::Responses) + } + + class Responses < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionUpdateConfig::Delegation::Responses, + OpenAI::Internal::AnyHash + ) + end + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + sig { returns(Symbol) } + attr_accessor :type + + # Responses backend settings to update. Omitted settings keep their existing + # values. + sig { returns(T.nilable(OpenAI::Live::ResponsesDelegationUpdateConfig)) } + attr_reader :responses + + sig { params(responses: OpenAI::Live::ResponsesDelegationUpdateConfig::OrHash).void } + attr_writer :responses + + # Update the Responses backend for an existing Live session without changing + # delegation ownership. + sig do + params( + + responses: OpenAI::Live::ResponsesDelegationUpdateConfig::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Responses backend settings to update. Omitted settings keep their existing + # values. + responses: nil, + + # The delegation owner. Always `responses` for tasks handled by the Responses API. + + type: :responses + ) + end + + sig do + override.returns( + {type: Symbol, responses: OpenAI::Live::ResponsesDelegationUpdateConfig} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Live::SessionUpdateConfig::Delegation::Variants]) } + def self.variants + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_update_event.rbi b/rbi/openai/models/live/session_update_event.rbi new file mode 100644 index 000000000..dfe684140 --- /dev/null +++ b/rbi/openai/models/live/session_update_event.rbi @@ -0,0 +1,78 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionUpdateEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionUpdateEvent, + OpenAI::Internal::AnyHash + ) + end + + # Sparse delegation updates. Omitted settings retain their values. The delegation + # type cannot change, including resetting Responses delegation to null or client. + # Model, frontend instructions, audio, and startup input are immutable. + sig { returns(OpenAI::Live::SessionUpdateConfig) } + attr_reader :session + + sig { params(session: OpenAI::Live::SessionUpdateConfig::OrHash).void } + attr_writer :session + + # The Live client event type. Always `session.update`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Update the delegation settings of an active Live session. The server + # acknowledges accepted changes with `session.updated`. + sig do + params( + + session: OpenAI::Live::SessionUpdateConfig::OrHash, + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Sparse delegation updates. Omitted settings retain their values. The delegation + # type cannot change, including resetting Responses delegation to null or client. + # Model, frontend instructions, audio, and startup input are immutable. + session:, + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.update`. + + type: :"session.update" + ) + end + + sig do + override.returns( + {session: OpenAI::Live::SessionUpdateConfig, type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_updated_event.rbi b/rbi/openai/models/live/session_updated_event.rbi new file mode 100644 index 000000000..0567c56ac --- /dev/null +++ b/rbi/openai/models/live/session_updated_event.rbi @@ -0,0 +1,86 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionUpdatedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionUpdatedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The resolved Live session configuration and server-assigned session metadata. + sig { returns(OpenAI::Live::SessionResource) } + attr_reader :session + + sig { params(session: OpenAI::Live::SessionResource::OrHash).void } + attr_writer :session + + # The event type, always `session.updated`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned when a Live session update is accepted. Contains the resolved session + # configuration after the update. + sig do + params( + + event_id: String, + + session: OpenAI::Live::SessionResource::OrHash, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the Live server event. + event_id:, + + # The resolved Live session configuration and server-assigned session metadata. + session:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.updated`. + + type: :"session.updated" + ) + end + + sig do + override.returns( + {event_id: String, session: OpenAI::Live::SessionResource, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_usage.rbi b/rbi/openai/models/live/session_usage.rbi new file mode 100644 index 000000000..e8abd595b --- /dev/null +++ b/rbi/openai/models/live/session_usage.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionUsage < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionUsage, + OpenAI::Internal::AnyHash + ) + end + + # The cumulative Live audio duration in seconds. Do not sum this value across + # usage events. + sig { returns(Float) } + attr_accessor :seconds + + # Cumulative audio duration for a Live session. Values are totals for the session, + # not increments to sum across usage events. + sig do + params( + + seconds: Float + ) + .returns(T.attached_class) + end + def self.new( + + # The cumulative Live audio duration in seconds. Do not sum this value across + # usage events. + + seconds: + ) + end + + sig do + override.returns( + {seconds: Float} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/session_usage_updated_event.rbi b/rbi/openai/models/live/session_usage_updated_event.rbi new file mode 100644 index 000000000..9ae276916 --- /dev/null +++ b/rbi/openai/models/live/session_usage_updated_event.rbi @@ -0,0 +1,148 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class SessionUsageUpdatedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionUsageUpdatedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, always `session.usage.updated`. + sig { returns(Symbol) } + attr_accessor :type + + # The cumulative Live audio usage so far. + sig { returns(OpenAI::Live::SessionUsage) } + attr_reader :usage + + sig { params(usage: OpenAI::Live::SessionUsage::OrHash).void } + attr_writer :usage + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # The latest measured Live context-window usage. Omitted when the context limit is + # unknown. + sig { returns(T.nilable(OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow)) } + attr_reader :context_window + + sig { params(context_window: OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow::OrHash).void } + attr_writer :context_window + + # Reports cumulative Live audio usage and, when available, the most recent + # context-window usage. Delegated Responses token usage is reported separately in + # response.event events. + sig do + params( + + event_id: String, + + usage: OpenAI::Live::SessionUsage::OrHash, + + client_event_id: String, + + context_window: OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the Live server event. + event_id:, + + # The cumulative Live audio usage so far. + usage:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The latest measured Live context-window usage. Omitted when the context limit is + # unknown. + context_window: nil, + + # The event type, always `session.usage.updated`. + + type: :"session.usage.updated" + ) + end + + sig do + override.returns( + { + event_id: String, + type: Symbol, + usage: OpenAI::Live::SessionUsage, + client_event_id: T.nilable(String), + context_window: T.nilable(OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow) + } + ) + end + def to_hash + end + + class ContextWindow < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow, + OpenAI::Internal::AnyHash + ) + end + + # The latest active context token count divided by the Live model context limit. + # Can decrease after compaction and may lag between measured audio frames. + sig { returns(Float) } + attr_accessor :usage_ratio + + # The latest measured Live context-window usage. Omitted when the context limit is + # unknown. + sig do + params( + + usage_ratio: Float + ) + .returns(T.attached_class) + end + def self.new( + + # The latest active context token count divided by the Live model context limit. + # Can decrease after compaction and may lag between measured audio frames. + + usage_ratio: + ) + end + + sig do + override.returns( + {usage_ratio: Float} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/thinking_append_event.rbi b/rbi/openai/models/live/thinking_append_event.rbi new file mode 100644 index 000000000..00b8a8e27 --- /dev/null +++ b/rbi/openai/models/live/thinking_append_event.rbi @@ -0,0 +1,88 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ThinkingAppendEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ThinkingAppendEvent, + OpenAI::Internal::AnyHash + ) + end + + # Silent reasoning or progress context, limited to 500 tokens. It does not + # directly request speech, but can influence later speech and is not a secrecy + # boundary. + sig { returns(String) } + attr_accessor :content + + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + sig { returns(T.nilable(String)) } + attr_accessor :delegation_id + + # The Live client event type. Always `session.thinking.append`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + sig { returns(T.nilable(String)) } + attr_accessor :event_id + + # Provide silent reasoning or progress context to the Live model, optionally for + # an existing client delegation. + sig do + params( + + content: String, + + delegation_id: T.nilable(String), + + event_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Silent reasoning or progress context, limited to 500 tokens. It does not + # directly request speech, but can influence later speech and is not a secrecy + # boundary. + content:, + + # Required, nullable. Set null for general session context, or use the ID from + # session.delegation.created for an existing client delegation. Non-null IDs are + # not accepted with Responses delegation. + delegation_id:, + + # Optional client identifier for correlating this command with a server event's + # client_event_id or error.client_event_id. + event_id: nil, + + # The Live client event type. Always `session.thinking.append`. + + type: :"session.thinking.append" + ) + end + + sig do + override.returns( + {content: String, delegation_id: T.nilable(String), type: Symbol, event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/live/thinking_appended_event.rbi b/rbi/openai/models/live/thinking_appended_event.rbi new file mode 100644 index 000000000..7a0ebb494 --- /dev/null +++ b/rbi/openai/models/live/thinking_appended_event.rbi @@ -0,0 +1,97 @@ +# typed: strong + +module OpenAI + module Models + + module Live + + class ThinkingAppendedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Live::ThinkingAppendedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + sig { returns(Integer) } + attr_accessor :end_ms + + # The unique ID of the Live server event. + sig { returns(String) } + attr_accessor :event_id + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + sig { returns(Integer) } + attr_accessor :start_ms + + # The event type, always `session.thinking.appended`. + sig { returns(Symbol) } + attr_accessor :type + + # The event_id of the client command associated with this server event, when + # supplied. + sig { returns(T.nilable(String)) } + attr_reader :client_event_id + + sig { params(client_event_id: String).void } + attr_writer :client_event_id + + # Returned when a session.thinking.append command is accepted into the Live + # session timeline. Acknowledges the added reasoning context without guaranteeing + # any spoken output. + sig do + params( + + end_ms: Integer, + + event_id: String, + + start_ms: Integer, + + client_event_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The end of this event on the Live session timeline, in milliseconds from the + # beginning of the session. For appended context, this can equal start_ms. + end_ms:, + + # The unique ID of the Live server event. + event_id:, + + # The start of this event on the Live session timeline, in milliseconds from the + # beginning of the session. + start_ms:, + + # The event_id of the client command associated with this server event, when + # supplied. + client_event_id: nil, + + # The event type, always `session.thinking.appended`. + + type: :"session.thinking.appended" + ) + end + + sig do + override.returns( + {end_ms: Integer, event_id: String, start_ms: Integer, type: Symbol, client_event_id: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/responses/response_input_item.rbi b/rbi/openai/models/responses/response_input_item.rbi index f7a810f56..46b9eda57 100644 --- a/rbi/openai/models/responses/response_input_item.rbi +++ b/rbi/openai/models/responses/response_input_item.rbi @@ -956,11 +956,27 @@ module OpenAI sig { returns(Symbol) } attr_accessor :type + # The action used for image generation. + sig { returns(T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action::OrSymbol)) } + attr_accessor :action + + # The background setting used for generation. + sig { returns(T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background::OrSymbol)) } + attr_accessor :background + + # The output format used for generation. + sig { returns(T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat::OrSymbol)) } + attr_accessor :output_format + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. sig { returns(T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::OrSymbol)) } attr_accessor :quality + # The prompt that was used after any model prompt rewriting. + sig { returns(T.nilable(String)) } + attr_accessor :revised_prompt + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. sig { returns(T.nilable(T.any(String, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::OrSymbol))) @@ -977,8 +993,18 @@ module OpenAI status: OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Status::OrSymbol, + action: T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action::OrSymbol), + + background: T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background::OrSymbol), + + output_format: T.nilable( + OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat::OrSymbol + ), + quality: T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), + size: T.nilable(T.any(String, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::OrSymbol)), type: Symbol @@ -996,10 +1022,22 @@ module OpenAI # The status of the image generation call. status:, + # The action used for image generation. + action: nil, + + # The background setting used for generation. + background: nil, + + # The output format used for generation. + output_format: nil, + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. quality: nil, + # The prompt that was used after any model prompt rewriting. + revised_prompt: nil, + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. size: nil, @@ -1016,7 +1054,13 @@ module OpenAI result: T.nilable(String), status: OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Status::OrSymbol, type: Symbol, + action: T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action::OrSymbol), + background: T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background::OrSymbol), + output_format: T.nilable( + OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat::OrSymbol + ), quality: T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), size: T.nilable( T.any(String, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::OrSymbol) ) @@ -1058,6 +1102,75 @@ module OpenAI end end + # The action used for image generation. + module Action + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GENERATE = T.let(:generate, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action::TaggedSymbol) + EDIT = T.let(:edit, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Action::TaggedSymbol] + ) + } + def self.values + end + end + + # The background setting used for generation. + module Background + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSPARENT = T.let( + :transparent, + OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background::TaggedSymbol + ) + OPAQUE = T.let(:opaque, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Background::TaggedSymbol] + ) + } + def self.values + end + end + + # The output format used for generation. + module OutputFormat + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PNG = T.let(:png, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + WEBP = T.let(:webp, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + JPEG = T.let(:jpeg, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OutputFormat::TaggedSymbol] + ) + } + def self.values + end + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. module Quality diff --git a/rbi/openai/models/responses/response_item.rbi b/rbi/openai/models/responses/response_item.rbi index 7bd5e497e..a962ea9cc 100644 --- a/rbi/openai/models/responses/response_item.rbi +++ b/rbi/openai/models/responses/response_item.rbi @@ -342,11 +342,27 @@ module OpenAI sig { returns(Symbol) } attr_accessor :type + # The action used for image generation. + sig { returns(T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Action::TaggedSymbol)) } + attr_accessor :action + + # The background setting used for generation. + sig { returns(T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Background::TaggedSymbol)) } + attr_accessor :background + + # The output format used for generation. + sig { returns(T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol)) } + attr_accessor :output_format + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. sig { returns(T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol)) } attr_accessor :quality + # The prompt that was used after any model prompt rewriting. + sig { returns(T.nilable(String)) } + attr_accessor :revised_prompt + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. sig { returns(T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::Variants)) } attr_accessor :size @@ -361,8 +377,16 @@ module OpenAI status: OpenAI::Responses::ResponseItem::ImageGenerationCall::Status::OrSymbol, + action: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Action::OrSymbol), + + background: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Background::OrSymbol), + + output_format: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat::OrSymbol), + quality: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), + size: T.nilable(T.any(String, OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::OrSymbol)), type: Symbol @@ -380,10 +404,22 @@ module OpenAI # The status of the image generation call. status:, + # The action used for image generation. + action: nil, + + # The background setting used for generation. + background: nil, + + # The output format used for generation. + output_format: nil, + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. quality: nil, + # The prompt that was used after any model prompt rewriting. + revised_prompt: nil, + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. size: nil, @@ -400,7 +436,13 @@ module OpenAI result: T.nilable(String), status: OpenAI::Responses::ResponseItem::ImageGenerationCall::Status::TaggedSymbol, type: Symbol, + action: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Action::TaggedSymbol), + background: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Background::TaggedSymbol), + output_format: T.nilable( + OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol + ), quality: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol), + revised_prompt: T.nilable(String), size: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::Variants) } ) @@ -430,6 +472,69 @@ module OpenAI end end + # The action used for image generation. + module Action + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Responses::ResponseItem::ImageGenerationCall::Action) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GENERATE = T.let(:generate, OpenAI::Responses::ResponseItem::ImageGenerationCall::Action::TaggedSymbol) + EDIT = T.let(:edit, OpenAI::Responses::ResponseItem::ImageGenerationCall::Action::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Responses::ResponseItem::ImageGenerationCall::Action::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Responses::ResponseItem::ImageGenerationCall::Action::TaggedSymbol]) + } + def self.values + end + end + + # The background setting used for generation. + module Background + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Responses::ResponseItem::ImageGenerationCall::Background) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSPARENT = T.let( + :transparent, + OpenAI::Responses::ResponseItem::ImageGenerationCall::Background::TaggedSymbol + ) + OPAQUE = T.let(:opaque, OpenAI::Responses::ResponseItem::ImageGenerationCall::Background::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Responses::ResponseItem::ImageGenerationCall::Background::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Responses::ResponseItem::ImageGenerationCall::Background::TaggedSymbol]) + } + def self.values + end + end + + # The output format used for generation. + module OutputFormat + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PNG = T.let(:png, OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + WEBP = T.let(:webp, OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + JPEG = T.let(:jpeg, OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat::TaggedSymbol] + ) + } + def self.values + end + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. module Quality diff --git a/rbi/openai/models/responses/response_output_item.rbi b/rbi/openai/models/responses/response_output_item.rbi index cebc0d27d..c3013ee34 100644 --- a/rbi/openai/models/responses/response_output_item.rbi +++ b/rbi/openai/models/responses/response_output_item.rbi @@ -347,11 +347,31 @@ module OpenAI sig { returns(Symbol) } attr_accessor :type + # The action used for image generation. + sig { returns(T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol)) } + attr_accessor :action + + # The background setting used for generation. + sig { + returns(T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol)) + } + attr_accessor :background + + # The output format used for generation. + sig { + returns(T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol)) + } + attr_accessor :output_format + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. sig { returns(T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Quality::TaggedSymbol)) } attr_accessor :quality + # The prompt that was used after any model prompt rewriting. + sig { returns(T.nilable(String)) } + attr_accessor :revised_prompt + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. sig { returns(T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Size::Variants)) } attr_accessor :size @@ -366,8 +386,18 @@ module OpenAI status: OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Status::OrSymbol, + action: T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action::OrSymbol), + + background: T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background::OrSymbol), + + output_format: T.nilable( + OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat::OrSymbol + ), + quality: T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Quality::OrSymbol), + revised_prompt: T.nilable(String), + size: T.nilable(T.any(String, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Size::OrSymbol)), type: Symbol @@ -385,10 +415,22 @@ module OpenAI # The status of the image generation call. status:, + # The action used for image generation. + action: nil, + + # The background setting used for generation. + background: nil, + + # The output format used for generation. + output_format: nil, + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. quality: nil, + # The prompt that was used after any model prompt rewriting. + revised_prompt: nil, + # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. size: nil, @@ -405,7 +447,15 @@ module OpenAI result: T.nilable(String), status: OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Status::TaggedSymbol, type: Symbol, + action: T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol), + background: T.nilable( + OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol + ), + output_format: T.nilable( + OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol + ), quality: T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Quality::TaggedSymbol), + revised_prompt: T.nilable(String), size: T.nilable(OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Size::Variants) } ) @@ -445,6 +495,81 @@ module OpenAI end end + # The action used for image generation. + module Action + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GENERATE = T.let( + :generate, + OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol + ) + EDIT = T.let(:edit, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Action::TaggedSymbol] + ) + } + def self.values + end + end + + # The background setting used for generation. + module Background + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSPARENT = T.let( + :transparent, + OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol + ) + OPAQUE = T.let( + :opaque, + OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol + ) + AUTO = T.let(:auto, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::Background::TaggedSymbol] + ) + } + def self.values + end + end + + # The output format used for generation. + module OutputFormat + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PNG = T.let(:png, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + WEBP = T.let(:webp, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + JPEG = T.let(:jpeg, OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Responses::ResponseOutputItem::ImageGenerationCall::OutputFormat::TaggedSymbol] + ) + } + def self.values + end + end + # The quality of the image generated by the image generation tool call. One of # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. module Quality diff --git a/rbi/openai/models/webhooks/live_call_incoming_webhook_event.rbi b/rbi/openai/models/webhooks/live_call_incoming_webhook_event.rbi index be9fc2f6d..1aa9fb9cb 100644 --- a/rbi/openai/models/webhooks/live_call_incoming_webhook_event.rbi +++ b/rbi/openai/models/webhooks/live_call_incoming_webhook_event.rbi @@ -40,9 +40,11 @@ module OpenAI sig { params(object: OpenAI::Webhooks::LiveCallIncomingWebhookEvent::Object::OrSymbol).void } attr_writer :object - # Sent when an incoming API SIP session is available for Live acceptance. The same - # pending session can also emit `realtime.call.incoming`; the first successful - # Realtime or Live accept endpoint selects the runtime surface. + # Deprecated: use `live.transport.incoming`. Retained for existing subscriptions + # during migration; new subscriptions to this event are not allowed. Sent when an + # incoming API SIP session is available for Live acceptance. The same pending + # session can also emit `realtime.call.incoming`; the first successful Realtime or + # Live accept endpoint selects the runtime surface. sig do params( @@ -100,8 +102,9 @@ module OpenAI ) end - # The `live_...` ID of the pending SIP session. Forward this value unchanged when - # accepting or rejecting the call through the Live API. + # The `live_...` ID of the pending SIP session. Pass this value unchanged to Live + # call controls and sideband connections. The corresponding + # `realtime.call.incoming` event uses a separate `rtc_...` call ID. sig { returns(String) } attr_accessor :session_id @@ -123,8 +126,9 @@ module OpenAI end def self.new( - # The `live_...` ID of the pending SIP session. Forward this value unchanged when - # accepting or rejecting the call through the Live API. + # The `live_...` ID of the pending SIP session. Pass this value unchanged to Live + # call controls and sideband connections. The corresponding + # `realtime.call.incoming` event uses a separate `rtc_...` call ID. session_id:, # Headers from the SIP INVITE, excluding SIP authorization headers. Retained diff --git a/rbi/openai/models/webhooks/live_transport_incoming_webhook_event.rbi b/rbi/openai/models/webhooks/live_transport_incoming_webhook_event.rbi new file mode 100644 index 000000000..9104394bd --- /dev/null +++ b/rbi/openai/models/webhooks/live_transport_incoming_webhook_event.rbi @@ -0,0 +1,226 @@ +# typed: strong + +module OpenAI + module Models + + module Webhooks + + class LiveTransportIncomingWebhookEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Webhooks::LiveTransportIncomingWebhookEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :id + + # The Unix timestamp (in seconds) of when the event was created. + sig { returns(Integer) } + attr_accessor :created_at + + # Event data payload. + sig { returns(OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data) } + attr_reader :data + + sig { params(data: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::OrHash).void } + attr_writer :data + + # The type of the event. Always `live.transport.incoming`. + sig { returns(Symbol) } + attr_accessor :type + + # The object of the event. Always `event`. + sig { returns(T.nilable(OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Object::TaggedSymbol)) } + attr_reader :object + + sig { params(object: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Object::OrSymbol).void } + attr_writer :object + + # Sent when an incoming API SIP session is available for Live acceptance. The same + # pending session can also emit `realtime.call.incoming`; the first successful + # Realtime or Live accept endpoint selects the runtime surface. + sig do + params( + + id: String, + + created_at: Integer, + + data: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::OrHash, + + object: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Object::OrSymbol, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + id:, + + # The Unix timestamp (in seconds) of when the event was created. + created_at:, + + # Event data payload. + data:, + + # The object of the event. Always `event`. + object: nil, + + # The type of the event. Always `live.transport.incoming`. + + type: :"live.transport.incoming" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Integer, + data: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data, + type: Symbol, + object: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Object::TaggedSymbol + } + ) + end + def to_hash + end + + class Data < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data, + OpenAI::Internal::AnyHash + ) + end + + # The `live_...` ID of the pending SIP session. Forward this value unchanged when + # accepting or rejecting the call through the Live API. + sig { returns(String) } + attr_accessor :session_id + + # Headers from the SIP INVITE, excluding SIP authorization headers. Retained + # names, values, repeated entries, and order are preserved. Treat these values as + # untrusted call metadata. + sig { returns(T::Array[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader]) } + attr_accessor :sip_headers + + # The incoming transport type. Always `sip`. + sig { returns(Symbol) } + attr_accessor :type + + # Event data payload. + sig do + params( + + session_id: String, + + sip_headers: T::Array[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader::OrHash], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The `live_...` ID of the pending SIP session. Forward this value unchanged when + # accepting or rejecting the call through the Live API. + session_id:, + + # Headers from the SIP INVITE, excluding SIP authorization headers. Retained + # names, values, repeated entries, and order are preserved. Treat these values as + # untrusted call metadata. + sip_headers:, + + # The incoming transport type. Always `sip`. + + type: :sip + ) + end + + sig do + override.returns( + { + session_id: String, + sip_headers: T::Array[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader], + type: Symbol + } + ) + end + def to_hash + end + + class SipHeader < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader, + OpenAI::Internal::AnyHash + ) + end + + # Name of the SIP Header. + sig { returns(String) } + attr_accessor :name + + # Value of the SIP Header. + sig { returns(String) } + attr_accessor :value + + # A header from the SIP Invite. + sig do + params( + + name: String, + + value: String + ) + .returns(T.attached_class) + end + def self.new( + + # Name of the SIP Header. + name:, + + # Value of the SIP Header. + + value: + ) + end + + sig do + override.returns( + {name: String, value: String} + ) + end + def to_hash + end + + end + end + + # The object of the event. Always `event`. + module Object + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Object) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EVENT = T.let(:event, OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Object::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Object::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi b/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi index 87ce99071..a7a736874 100644 --- a/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi +++ b/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi @@ -41,8 +41,8 @@ module OpenAI attr_writer :object # Sent when an incoming API SIP session is available for Realtime acceptance. The - # same pending session can also emit `live.call.incoming`; the first successful - # Realtime or Live accept endpoint selects the runtime surface. + # same pending session can also emit `live.transport.incoming`; the first + # successful Realtime or Live accept endpoint selects the runtime surface. sig do params( @@ -101,7 +101,7 @@ module OpenAI end # The Transceiver `rtc_...` ID of the pending SIP session. The paired - # `live.call.incoming` event derives its `session_id` by replacing the `rtc_` + # `live.transport.incoming` event derives its `session_id` by replacing the `rtc_` # prefix with `live_`. Use the ID returned by the event with the corresponding # Realtime or Live API. sig { returns(String) } @@ -126,7 +126,7 @@ module OpenAI def self.new( # The Transceiver `rtc_...` ID of the pending SIP session. The paired - # `live.call.incoming` event derives its `session_id` by replacing the `rtc_` + # `live.transport.incoming` event derives its `session_id` by replacing the `rtc_` # prefix with `live_`. Use the ID returned by the event with the corresponding # Realtime or Live API. call_id:, diff --git a/rbi/openai/models/webhooks/unwrap_webhook_event.rbi b/rbi/openai/models/webhooks/unwrap_webhook_event.rbi index b66fbd438..5254d562e 100644 --- a/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +++ b/rbi/openai/models/webhooks/unwrap_webhook_event.rbi @@ -22,6 +22,7 @@ module OpenAI OpenAI::Webhooks::FineTuningJobFailedWebhookEvent, OpenAI::Webhooks::FineTuningJobSucceededWebhookEvent, OpenAI::Webhooks::LiveCallIncomingWebhookEvent, + OpenAI::Webhooks::LiveTransportIncomingWebhookEvent, OpenAI::Webhooks::RealtimeCallIncomingWebhookEvent, OpenAI::Webhooks::ResponseCancelledWebhookEvent, OpenAI::Webhooks::ResponseCompletedWebhookEvent, diff --git a/rbi/openai/resources/live.rbi b/rbi/openai/resources/live.rbi new file mode 100644 index 000000000..6761bffeb --- /dev/null +++ b/rbi/openai/resources/live.rbi @@ -0,0 +1,43 @@ +# typed: strong + +module OpenAI + module Resources + + class Live + + sig { returns(OpenAI::Resources::Live::Sideband) } + attr_reader :sideband + + sig { returns(OpenAI::Resources::Live::Forks) } + attr_reader :forks + + sig { returns(OpenAI::Resources::Live::Sessions) } + attr_reader :sessions + + # Create a Live WebRTC session. Start with the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting). + sig { + params( + session: OpenAI::Live::MediaSessionConfig::OrHash, + transport: OpenAI::Live::LiveCreateParams::Transport::OrHash, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Models::Live::LiveCreateResponse) + } + def create( + # Startup configuration for the Live session. + session:, + # WebRTC transport with the browser's SDP offer. + transport:, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end +end diff --git a/rbi/openai/resources/live/forks.rbi b/rbi/openai/resources/live/forks.rbi new file mode 100644 index 000000000..0419430aa --- /dev/null +++ b/rbi/openai/resources/live/forks.rbi @@ -0,0 +1,19 @@ +# typed: strong + +module OpenAI + module Resources + + class Live + + class Forks + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end +end diff --git a/rbi/openai/resources/live/sessions.rbi b/rbi/openai/resources/live/sessions.rbi new file mode 100644 index 000000000..3663ecc61 --- /dev/null +++ b/rbi/openai/resources/live/sessions.rbi @@ -0,0 +1,110 @@ +# typed: strong + +module OpenAI + module Resources + + class Live + + class Sessions + + # Accept an incoming SIP call with Live startup configuration. + sig { + params( + session_id: String, + session: OpenAI::Live::SessionAcceptParams::Session::OrHash, + request_options: OpenAI::RequestOptions::OrHash + ) + .void + } + def accept( + # Opaque Live session identifier from the creation response or incoming-call + # webhook. Preserve the returned value unchanged, including its prefix. + session_id, + # Model and startup configuration for the Live session that answers the incoming + # SIP call. + session:, + request_options: {} + ) + end + + # Get Live session content + sig { + params(session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + T.all(StringIO, OpenAI::ResponseCarrier) + ) + } + def download_recording( + # The ID of the stored Live session to download. Use the session ID returned when + # the session started with storage enabled. + session_id, + request_options: {} + ) + end + + # Fork a stored Live session onto a new WebRTC connection. + sig { + params( + session_id: String, + transport: OpenAI::Live::SessionForkParams::Transport::OrHash, + session: OpenAI::Live::MediaSessionForkConfig::OrHash, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Models::Live::SessionForkResponse) + } + def fork( + # The ID of the stored Live session to fork. + session_id, + # WebRTC transport with an SDP offer for the new connection to the forked session. + transport:, + # Optional configuration overrides for the new Live session. Omit this object or + # send an empty object to inherit the stored session's settings. + session: nil, + request_options: {} + ) + end + + # Hang up a Live session. + sig { params(session_id: String, request_options: OpenAI::RequestOptions::OrHash).void } + def hangup( + # Opaque Live session identifier from the creation response or incoming-call + # webhook. Preserve the returned value unchanged, including its prefix. + session_id, + request_options: {} + ) + end + + # Transfer a Live SIP call to another destination. + sig { params(session_id: String, target_uri: String, request_options: OpenAI::RequestOptions::OrHash).void } + def refer( + # Opaque Live session identifier from the creation response or incoming-call + # webhook. Preserve the returned value unchanged, including its prefix. + session_id, + # Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or + # sip:agent@example.com. + target_uri:, + request_options: {} + ) + end + + # Reject an incoming SIP call. + sig { params(session_id: String, status_code: Integer, request_options: OpenAI::RequestOptions::OrHash).void } + def reject( + # Opaque Live session identifier from the creation response or incoming-call + # webhook. Preserve the returned value unchanged, including its prefix. + session_id, + # SIP rejection status sent to the caller. This field is required. + status_code:, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end +end diff --git a/rbi/openai/resources/live/sideband.rbi b/rbi/openai/resources/live/sideband.rbi new file mode 100644 index 000000000..49ce03afb --- /dev/null +++ b/rbi/openai/resources/live/sideband.rbi @@ -0,0 +1,19 @@ +# typed: strong + +module OpenAI + module Resources + + class Live + + class Sideband + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end +end diff --git a/rbi/openai/resources/responses.rbi b/rbi/openai/resources/responses.rbi index 1c72bae55..b18daeac7 100644 --- a/rbi/openai/resources/responses.rbi +++ b/rbi/openai/resources/responses.rbi @@ -662,6 +662,8 @@ module OpenAI previous_response_id: T.nilable(String), prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash), prompt_cache_key: String, + prompt_cache_options: T.nilable(OpenAI::Responses::ResponseCreateParams::PromptCacheOptions::OrHash), + prompt_cache_retention: T.nilable(OpenAI::Responses::ResponseCreateParams::PromptCacheRetention::OrSymbol), reasoning: T.nilable(OpenAI::Reasoning::OrHash), response_id: T.nilable(String), safety_identifier: String, @@ -711,7 +713,7 @@ module OpenAI end def stream( # Whether to run the model response in the background. - # [Learn more](https://platform.openai.com/docs/guides/background). + # [Learn more](https://developers.openai.com/api/docs/guides/background). background: nil, # Specify additional output data to include in the model response. Currently # supported values are: @@ -734,11 +736,11 @@ module OpenAI # # Learn more: # - # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) - # - [Image inputs](https://platform.openai.com/docs/guides/images) - # - [File inputs](https://platform.openai.com/docs/guides/pdf-files) - # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state) - # - [Function calling](https://platform.openai.com/docs/guides/function-calling) + # - [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text) + # - [Image inputs](https://developers.openai.com/api/docs/guides/images-vision) + # - [File inputs](https://developers.openai.com/api/docs/guides/file-inputs) + # - [Conversation state](https://developers.openai.com/api/docs/guides/conversation-state) + # - [Function calling](https://developers.openai.com/api/docs/guides/function-calling) input: nil, # A system (or developer) message inserted into the model's context. # @@ -748,7 +750,7 @@ module OpenAI instructions: nil, # An upper bound for the number of tokens that can be generated for a response, # including visible output tokens and - # [reasoning tokens](https://platform.openai.com/docs/guides/reasoning). + # [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning). max_output_tokens: nil, # The maximum number of total calls to built-in tools that can be processed in a # response. This maximum number applies across all built-in tool calls, not per @@ -762,37 +764,65 @@ module OpenAI # Keys are strings with a maximum length of 64 characters. Values are strings with # a maximum length of 512 characters. metadata: nil, - # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a - # wide range of models with different capabilities, performance characteristics, - # and price points. Refer to the - # [model guide](https://platform.openai.com/docs/models) to browse and compare - # available models. + # Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide + # range of models with different capabilities, performance characteristics, and + # price points. Refer to the + # [model guide](https://developers.openai.com/api/docs/models) to browse and + # compare available models. model: nil, # Whether to allow the model to run tool calls in parallel. parallel_tool_calls: nil, # The unique ID of the previous response to the model. Use this to create # multi-turn conversations. Learn more about - # [conversation state](https://platform.openai.com/docs/guides/conversation-state). + # [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). + # Cannot be used in conjunction with `conversation`. previous_response_id: nil, # Reference to a prompt template and its variables. - # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). + # [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). prompt: nil, # Used by OpenAI to cache responses for similar requests to optimize your cache # hit rates. Replaces the `user` field. - # [Learn more](https://platform.openai.com/docs/guides/prompt-caching). + # [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching). prompt_cache_key: nil, - # **o-series models only** + # Options for prompt caching. Supported for `gpt-5.6` and later models. By + # default, OpenAI automatically chooses one implicit cache breakpoint. You can add + # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each + # request can write up to four breakpoints. For cache matching, OpenAI considers + # up to the latest 80 breakpoints in the conversation, without a content-block + # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The + # `ttl` defaults to `30m`, which is currently the only supported value. See the + # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) + # for current details. + prompt_cache_options: nil, + # Deprecated. Use `prompt_cache_options.ttl` instead. + # + # The retention policy for the prompt cache. Set to `24h` to enable extended + # prompt caching, which keeps cached prefixes active for longer, up to a maximum + # of 24 hours. + # [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention). + # This field expresses a maximum retention policy, while + # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields + # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future + # models, only `24h` is supported. # + # For older models that support both `in_memory` and `24h`, the default depends on + # your organization's data retention policy: + # + # - Organizations without ZDR enabled default to `24h`. + # - Organizations with ZDR enabled default to `in_memory` when + # `prompt_cache_retention` is not specified. + prompt_cache_retention: nil, # Configuration options for - # [reasoning models](https://platform.openai.com/docs/guides/reasoning). + # [reasoning models](https://developers.openai.com/api/docs/guides/reasoning). reasoning: nil, # The ID of the response whose stream to resume. response_id: nil, # A stable identifier used to help detect users of your application that may be # violating OpenAI's usage policies. The IDs should be a string that uniquely - # identifies each user. We recommend hashing their username or email address, in - # order to avoid sending us any identifying information. - # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers). + # identifies each user, with a maximum length of 64 characters. We recommend + # hashing their username or email address, in order to avoid sending us any + # identifying information. + # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). safety_identifier: nil, # Specifies the processing type used for serving the request. # @@ -801,10 +831,19 @@ module OpenAI # will use 'default'. # - If set to 'default', then the request will be processed with the standard # pricing and performance for the selected model. - # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or - # 'priority', then the request will be processed with the corresponding service - # tier. [Contact sales](https://openai.com/contact-sales) to learn more about - # Priority processing. + # - If set to + # '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then + # the request will be processed with the Flex Processing service tier. + # - To opt-in to + # [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the + # request level, include the `service_tier=fast` or `service_tier=priority` + # parameter for Responses or Chat Completions. The response will show + # `service_tier=priority` regardless of if you specify `service_tier=fast` or + # `priority` in your request. + # - If set to 'ultrafast', then the request will be processed with the + # access-controlled Ultrafast Processing service tier. This tier is currently + # available for `gpt-5.6-sol`; a response served through it will show + # `service_tier=ultrafast`. # - When not set, the default behavior is 'auto'. # # When the `service_tier` parameter is set, the response body will include the @@ -825,9 +864,8 @@ module OpenAI # Configuration options for a text response from the model. Can be plain text, # structured JSON data, or text that conforms to a custom grammar. Learn more: # - # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) - # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) - # - [Custom grammars](https://platform.openai.com/docs/guides/custom-grammars) + # - [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text) + # - [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs) text: nil, # How the model should select which tool (or tools) to use when generating a # response. See the `tools` parameter to see how to specify which tools the model @@ -840,20 +878,19 @@ module OpenAI # # - **Built-in tools**: Tools that are provided by OpenAI that extend the model's # capabilities, like - # [web search](https://platform.openai.com/docs/guides/tools-web-search) or - # [file search](https://platform.openai.com/docs/guides/tools-file-search). + # [web search](https://developers.openai.com/api/docs/guides/tools-web-search) + # or + # [file search](https://developers.openai.com/api/docs/guides/tools-file-search). # Learn more about - # [built-in tools](https://platform.openai.com/docs/guides/tools). - # - **Custom tools**: Free form tools which the model can call with flexible - # inputs and outputs. Learn more about - # [custom tools](https://platform.openai.com/docs/guides/custom-tools). + # [built-in tools](https://developers.openai.com/api/docs/guides/tools). + # - **MCP Tools**: Integrations with third-party systems via custom MCP servers or + # predefined connectors such as Google Drive and SharePoint. Learn more about + # [MCP Tools](https://developers.openai.com/api/docs/guides/tools-connectors-mcp). # - **Function calls (custom tools)**: Functions that are defined by you, enabling # the model to call your own code with strongly typed arguments and outputs. # Learn more about - # [function calling](https://platform.openai.com/docs/guides/function-calling). - # You can also use - # [custom tools](https://platform.openai.com/docs/guides/custom-tools) to call - # your own code. + # [function calling](https://developers.openai.com/api/docs/guides/function-calling). + # You can also use custom tools to call your own code. tools: nil, # An integer between 0 and 20 specifying the number of most likely tokens to # return at each token position, each with an associated log probability. @@ -876,7 +913,7 @@ module OpenAI # `prompt_cache_key` instead to maintain caching optimizations. A stable # identifier for your end-users. Used to boost cache hit rates by better bucketing # similar requests and to help OpenAI detect and prevent abuse. - # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers). + # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). user: nil, request_options: {} ) diff --git a/rbi/openai/resources/webhooks.rbi b/rbi/openai/resources/webhooks.rbi index 855ba6b0d..519bc19d3 100644 --- a/rbi/openai/resources/webhooks.rbi +++ b/rbi/openai/resources/webhooks.rbi @@ -25,6 +25,7 @@ module OpenAI OpenAI::Webhooks::FineTuningJobFailedWebhookEvent, OpenAI::Webhooks::FineTuningJobSucceededWebhookEvent, OpenAI::Webhooks::LiveCallIncomingWebhookEvent, + OpenAI::Webhooks::LiveTransportIncomingWebhookEvent, OpenAI::Webhooks::RealtimeCallIncomingWebhookEvent, OpenAI::Webhooks::ResponseCancelledWebhookEvent, OpenAI::Webhooks::ResponseCompletedWebhookEvent, diff --git a/sig/openai/client.rbs b/sig/openai/client.rbs index d18317b4d..cc68d4ee5 100644 --- a/sig/openai/client.rbs +++ b/sig/openai/client.rbs @@ -58,6 +58,8 @@ module OpenAI attr_reader responses: OpenAI::Resources::Responses + attr_reader live: OpenAI::Resources::Live + attr_reader realtime: OpenAI::Resources::Realtime attr_reader conversations: OpenAI::Resources::Conversations diff --git a/sig/openai/models.rbs b/sig/openai/models.rbs index 269e4f30f..7866498bc 100644 --- a/sig/openai/models.rbs +++ b/sig/openai/models.rbs @@ -147,6 +147,8 @@ module OpenAI class ImagesResponse = OpenAI::Models::ImagesResponse + module Live = OpenAI::Models::Live + Metadata: OpenAI::Internal::Type::Converter class Model = OpenAI::Models::Model diff --git a/sig/openai/models/beta/beta_response_input_item.rbs b/sig/openai/models/beta/beta_response_input_item.rbs index 654230cb3..5960a68a9 100644 --- a/sig/openai/models/beta/beta_response_input_item.rbs +++ b/sig/openai/models/beta/beta_response_input_item.rbs @@ -860,8 +860,12 @@ module OpenAI result: String?, status: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::size? } @@ -874,18 +878,30 @@ module OpenAI attr_accessor type: :image_generation_call + attr_accessor action: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::action? + attr_accessor agent: OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Agent? + attr_accessor background: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::background? + + attr_accessor output_format: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::output_format? + attr_accessor quality: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::quality? + attr_accessor revised_prompt: String? + attr_accessor size: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::size? def initialize: ( id: String, result: String?, status: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::status, + ?action: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::size?, ?type: :image_generation_call ) -> void @@ -895,8 +911,12 @@ module OpenAI result: String?, status: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseInputItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::size? } @@ -913,6 +933,18 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::status] end + type action = :generate | :edit | :auto + + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE: :generate + EDIT: :edit + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::action] + end + type agent = { agent_name: String } class Agent < OpenAI::Internal::Type::BaseModel @@ -923,6 +955,30 @@ module OpenAI def to_hash: -> { agent_name: String } end + type background = :transparent | :opaque | :auto + + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT: :transparent + OPAQUE: :opaque + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::background] + end + + type output_format = :png | :webp | :jpeg + + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG: :png + WEBP: :webp + JPEG: :jpeg + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseInputItem::ImageGenerationCall::output_format] + end + type quality = :low | :medium | :high | :xhigh | :max | :auto module Quality diff --git a/sig/openai/models/beta/beta_response_item.rbs b/sig/openai/models/beta/beta_response_item.rbs index 311a18225..59bd020ff 100644 --- a/sig/openai/models/beta/beta_response_item.rbs +++ b/sig/openai/models/beta/beta_response_item.rbs @@ -593,8 +593,12 @@ module OpenAI result: String?, status: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::size? } @@ -607,18 +611,30 @@ module OpenAI attr_accessor type: :image_generation_call + attr_accessor action: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::action? + attr_accessor agent: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent? + attr_accessor background: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::background? + + attr_accessor output_format: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::output_format? + attr_accessor quality: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::quality? + attr_accessor revised_prompt: String? + attr_accessor size: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::size? def initialize: ( id: String, result: String?, status: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::status, + ?action: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::size?, ?type: :image_generation_call ) -> void @@ -628,8 +644,12 @@ module OpenAI result: String?, status: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::size? } @@ -646,6 +666,18 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::status] end + type action = :generate | :edit | :auto + + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE: :generate + EDIT: :edit + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::action] + end + type agent = { agent_name: String } class Agent < OpenAI::Internal::Type::BaseModel @@ -656,6 +688,30 @@ module OpenAI def to_hash: -> { agent_name: String } end + type background = :transparent | :opaque | :auto + + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT: :transparent + OPAQUE: :opaque + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::background] + end + + type output_format = :png | :webp | :jpeg + + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG: :png + WEBP: :webp + JPEG: :jpeg + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::output_format] + end + type quality = :low | :medium | :high | :xhigh | :max | :auto module Quality diff --git a/sig/openai/models/beta/beta_response_output_item.rbs b/sig/openai/models/beta/beta_response_output_item.rbs index a7b8022fc..87907121a 100644 --- a/sig/openai/models/beta/beta_response_output_item.rbs +++ b/sig/openai/models/beta/beta_response_output_item.rbs @@ -591,8 +591,12 @@ module OpenAI result: String?, status: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::size? } @@ -605,18 +609,30 @@ module OpenAI attr_accessor type: :image_generation_call + attr_accessor action: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::action? + attr_accessor agent: OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent? + attr_accessor background: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::background? + + attr_accessor output_format: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::output_format? + attr_accessor quality: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::quality? + attr_accessor revised_prompt: String? + attr_accessor size: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::size? def initialize: ( id: String, result: String?, status: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::status, + ?action: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::size?, ?type: :image_generation_call ) -> void @@ -626,8 +642,12 @@ module OpenAI result: String?, status: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::action?, ?agent: OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent?, + ?background: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::size? } @@ -644,6 +664,18 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::status] end + type action = :generate | :edit | :auto + + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE: :generate + EDIT: :edit + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::action] + end + type agent = { agent_name: String } class Agent < OpenAI::Internal::Type::BaseModel @@ -654,6 +686,30 @@ module OpenAI def to_hash: -> { agent_name: String } end + type background = :transparent | :opaque | :auto + + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT: :transparent + OPAQUE: :opaque + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::background] + end + + type output_format = :png | :webp | :jpeg + + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG: :png + WEBP: :webp + JPEG: :jpeg + + def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::output_format] + end + type quality = :low | :medium | :high | :xhigh | :max | :auto module Quality diff --git a/sig/openai/models/conversations/conversation_item.rbs b/sig/openai/models/conversations/conversation_item.rbs index 1f6e0144b..9eefe1d66 100644 --- a/sig/openai/models/conversations/conversation_item.rbs +++ b/sig/openai/models/conversations/conversation_item.rbs @@ -43,7 +43,11 @@ module OpenAI result: String?, status: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::size? } @@ -56,15 +60,27 @@ module OpenAI attr_accessor type: :image_generation_call + attr_accessor action: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::action? + + attr_accessor background: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::background? + + attr_accessor output_format: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::output_format? + attr_accessor quality: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::quality? + attr_accessor revised_prompt: String? + attr_accessor size: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::size? def initialize: ( id: String, result: String?, status: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::status, + ?action: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::size?, ?type: :image_generation_call ) -> void @@ -74,7 +90,11 @@ module OpenAI result: String?, status: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::size? } @@ -91,6 +111,42 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::status] end + type action = :generate | :edit | :auto + + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE: :generate + EDIT: :edit + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::action] + end + + type background = :transparent | :opaque | :auto + + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT: :transparent + OPAQUE: :opaque + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::background] + end + + type output_format = :png | :webp | :jpeg + + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG: :png + WEBP: :webp + JPEG: :jpeg + + def self?.values: -> ::Array[OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::output_format] + end + type quality = :low | :medium | :high | :xhigh | :max | :auto module Quality diff --git a/sig/openai/models/live/audio_format.rbs b/sig/openai/models/live/audio_format.rbs new file mode 100644 index 000000000..ea93b6760 --- /dev/null +++ b/sig/openai/models/live/audio_format.rbs @@ -0,0 +1,73 @@ +module OpenAI + module Models + module Live + type audio_format = + OpenAI::Live::AudioFormat::AudioPCM + | OpenAI::Live::AudioFormat::AudioPCMU + | OpenAI::Live::AudioFormat::AudioPCMA + + module AudioFormat + extend OpenAI::Internal::Type::Union + + type audio_pcm = + { + rate: OpenAI::Models::Live::AudioFormat::AudioPCM::rate, + ?type: :"audio/pcm" + } + + class AudioPCM < OpenAI::Internal::Type::BaseModel + attr_accessor rate: OpenAI::Models::Live::AudioFormat::AudioPCM::rate + + attr_accessor type: :"audio/pcm" + + def initialize: ( + rate: OpenAI::Models::Live::AudioFormat::AudioPCM::rate, + ?type: :"audio/pcm" + ) -> void + + def to_hash: -> { + rate: OpenAI::Models::Live::AudioFormat::AudioPCM::rate, + ?type: :"audio/pcm" + } + + type rate = 16000 | 24000 + + module Rate + extend OpenAI::Internal::Type::Enum + + RATE_16000: 16000 + RATE_24000: 24000 + + def self?.values: -> ::Array[OpenAI::Models::Live::AudioFormat::AudioPCM::rate] + end + end + + type audio_pcmu = { rate: Integer, ?type: :"audio/pcmu" } + + class AudioPCMU < OpenAI::Internal::Type::BaseModel + attr_accessor rate: Integer + + attr_accessor type: :"audio/pcmu" + + def initialize: (rate: Integer, ?type: :"audio/pcmu") -> void + + def to_hash: -> { rate: Integer, ?type: :"audio/pcmu" } + end + + type audio_pcma = { rate: Integer, ?type: :"audio/pcma" } + + class AudioPCMA < OpenAI::Internal::Type::BaseModel + attr_accessor rate: Integer + + attr_accessor type: :"audio/pcma" + + def initialize: (rate: Integer, ?type: :"audio/pcma") -> void + + def to_hash: -> { rate: Integer, ?type: :"audio/pcma" } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::audio_format] + end + end + end +end diff --git a/sig/openai/models/live/built_in_voice.rbs b/sig/openai/models/live/built_in_voice.rbs new file mode 100644 index 000000000..835b6cea6 --- /dev/null +++ b/sig/openai/models/live/built_in_voice.rbs @@ -0,0 +1,58 @@ +module OpenAI + module Models + module Live + type built_in_voice = + :alloy + | :ash + | :ballad + | :beacon + | :bossa + | :cedar + | :cinder + | :coral + | :delta + | :echo + | :gleam + | :marin + | :meridian + | :quartz + | :ripple + | :sage + | :shimmer + | :stone + | :tempo + | :verse + | :vesper + | :willow + + module BuiltInVoice + extend OpenAI::Internal::Type::Enum + + ALLOY: :alloy + ASH: :ash + BALLAD: :ballad + BEACON: :beacon + BOSSA: :bossa + CEDAR: :cedar + CINDER: :cinder + CORAL: :coral + DELTA: :delta + ECHO: :echo + GLEAM: :gleam + MARIN: :marin + MERIDIAN: :meridian + QUARTZ: :quartz + RIPPLE: :ripple + SAGE: :sage + SHIMMER: :shimmer + STONE: :stone + TEMPO: :tempo + VERSE: :verse + VESPER: :vesper + WILLOW: :willow + + def self?.values: -> ::Array[OpenAI::Models::Live::built_in_voice] + end + end + end +end diff --git a/sig/openai/models/live/client_config.rbs b/sig/openai/models/live/client_config.rbs new file mode 100644 index 000000000..af738aee6 --- /dev/null +++ b/sig/openai/models/live/client_config.rbs @@ -0,0 +1,15 @@ +module OpenAI + module Models + module Live + type client_config = { data_channel: OpenAI::Live::DataChannelConfig } + + class ClientConfig < OpenAI::Internal::Type::BaseModel + attr_accessor data_channel: OpenAI::Live::DataChannelConfig + + def initialize: (data_channel: OpenAI::Live::DataChannelConfig) -> void + + def to_hash: -> { data_channel: OpenAI::Live::DataChannelConfig } + end + end + end +end diff --git a/sig/openai/models/live/client_delegation.rbs b/sig/openai/models/live/client_delegation.rbs new file mode 100644 index 000000000..e6eb45e69 --- /dev/null +++ b/sig/openai/models/live/client_delegation.rbs @@ -0,0 +1,15 @@ +module OpenAI + module Models + module Live + type client_delegation = { ?type: :client } + + class ClientDelegation < OpenAI::Internal::Type::BaseModel + attr_accessor type: :client + + def initialize: (?type: :client) -> void + + def to_hash: -> { ?type: :client } + end + end + end +end diff --git a/sig/openai/models/live/client_event.rbs b/sig/openai/models/live/client_event.rbs new file mode 100644 index 000000000..c125c44bd --- /dev/null +++ b/sig/openai/models/live/client_event.rbs @@ -0,0 +1,24 @@ +module OpenAI + module Models + module Live + type client_event = + OpenAI::Live::SessionStartEvent + | OpenAI::Live::SessionUpdateEvent + | OpenAI::Live::InputAudioAppendEvent + | OpenAI::Live::InputAudioMuteEvent + | OpenAI::Live::InputAudioUnmuteEvent + | OpenAI::Live::InstructionsAppendEvent + | OpenAI::Live::ThinkingAppendEvent + | OpenAI::Live::CommentaryAppendEvent + | OpenAI::Live::ResponseItemCreateEvent + | OpenAI::Live::ResponseCreateEvent + | OpenAI::Live::SessionCloseEvent + + module ClientEvent + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::client_event] + end + end + end +end diff --git a/sig/openai/models/live/commentary_append_event.rbs b/sig/openai/models/live/commentary_append_event.rbs new file mode 100644 index 000000000..13bbf632c --- /dev/null +++ b/sig/openai/models/live/commentary_append_event.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Live + type commentary_append_event = + { + content: String, + delegation_id: String?, + ?type: :"session.commentary.append", + ?event_id: String? + } + + class CommentaryAppendEvent < OpenAI::Internal::Type::BaseModel + attr_accessor content: String + + attr_accessor delegation_id: String? + + attr_accessor type: :"session.commentary.append" + + attr_accessor event_id: String? + + def initialize: ( + content: String, + delegation_id: String?, + ?event_id: String?, + ?type: :"session.commentary.append" + ) -> void + + def to_hash: -> { + content: String, + delegation_id: String?, + ?type: :"session.commentary.append", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/commentary_appended_event.rbs b/sig/openai/models/live/commentary_appended_event.rbs new file mode 100644 index 000000000..fcf0a5fc5 --- /dev/null +++ b/sig/openai/models/live/commentary_appended_event.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Live + type commentary_appended_event = + { + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.commentary.appended", + ?client_event_id: String + } + + class CommentaryAppendedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor end_ms: Integer + + attr_accessor event_id: String + + attr_accessor start_ms: Integer + + attr_accessor type: :"session.commentary.appended" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?client_event_id: String, + ?type: :"session.commentary.appended" + ) -> void + + def to_hash: -> { + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.commentary.appended", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/custom_voice.rbs b/sig/openai/models/live/custom_voice.rbs new file mode 100644 index 000000000..4fd825e2a --- /dev/null +++ b/sig/openai/models/live/custom_voice.rbs @@ -0,0 +1,15 @@ +module OpenAI + module Models + module Live + type custom_voice = { id: String } + + class CustomVoice < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + def initialize: (id: String) -> void + + def to_hash: -> { id: String } + end + end + end +end diff --git a/sig/openai/models/live/data_channel_config.rbs b/sig/openai/models/live/data_channel_config.rbs new file mode 100644 index 000000000..a0e4ba256 --- /dev/null +++ b/sig/openai/models/live/data_channel_config.rbs @@ -0,0 +1,56 @@ +module OpenAI + module Models + module Live + type data_channel_config = + { + ?allowed_client_events: OpenAI::Models::Live::DataChannelConfig::allowed_client_events, + ?allowed_server_events: OpenAI::Models::Live::DataChannelConfig::allowed_server_events + } + + class DataChannelConfig < OpenAI::Internal::Type::BaseModel + attr_reader allowed_client_events: OpenAI::Models::Live::DataChannelConfig::allowed_client_events? + + def allowed_client_events=: ( + OpenAI::Models::Live::DataChannelConfig::allowed_client_events + ) -> OpenAI::Models::Live::DataChannelConfig::allowed_client_events + + attr_reader allowed_server_events: OpenAI::Models::Live::DataChannelConfig::allowed_server_events? + + def allowed_server_events=: ( + OpenAI::Models::Live::DataChannelConfig::allowed_server_events + ) -> OpenAI::Models::Live::DataChannelConfig::allowed_server_events + + def initialize: ( + ?allowed_client_events: OpenAI::Models::Live::DataChannelConfig::allowed_client_events, + ?allowed_server_events: OpenAI::Models::Live::DataChannelConfig::allowed_server_events + ) -> void + + def to_hash: -> { + ?allowed_client_events: OpenAI::Models::Live::DataChannelConfig::allowed_client_events, + ?allowed_server_events: OpenAI::Models::Live::DataChannelConfig::allowed_server_events + } + + type allowed_client_events = :all | ::Array[String] + + module AllowedClientEvents + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::DataChannelConfig::allowed_client_events] + + StringArray: OpenAI::Internal::Type::Converter + end + + type allowed_server_events = + :all | ::Array[OpenAI::Live::ServerEventSelector] + + module AllowedServerEvents + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::DataChannelConfig::allowed_server_events] + + ServerEventSelectorArray: OpenAI::Internal::Type::Converter + end + end + end + end +end diff --git a/sig/openai/models/live/delegation_created_event.rbs b/sig/openai/models/live/delegation_created_event.rbs new file mode 100644 index 000000000..f4041dadf --- /dev/null +++ b/sig/openai/models/live/delegation_created_event.rbs @@ -0,0 +1,89 @@ +module OpenAI + module Models + module Live + type delegation_created_event = + { + delegation: OpenAI::Live::DelegationCreatedEvent::Delegation, + event_id: String, + offset_ms: Integer, + ?type: :"session.delegation.created", + ?client_event_id: String + } + + class DelegationCreatedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delegation: OpenAI::Live::DelegationCreatedEvent::Delegation + + attr_accessor event_id: String + + attr_accessor offset_ms: Integer + + attr_accessor type: :"session.delegation.created" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + delegation: OpenAI::Live::DelegationCreatedEvent::Delegation, + event_id: String, + offset_ms: Integer, + ?client_event_id: String, + ?type: :"session.delegation.created" + ) -> void + + def to_hash: -> { + delegation: OpenAI::Live::DelegationCreatedEvent::Delegation, + event_id: String, + offset_ms: Integer, + ?type: :"session.delegation.created", + ?client_event_id: String + } + + type delegation = + { + id: String, + target: OpenAI::Models::Live::DelegationCreatedEvent::Delegation::target, + ?type: :delegation, + ?response_id: String + } + + class Delegation < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor target: OpenAI::Models::Live::DelegationCreatedEvent::Delegation::target + + attr_accessor type: :delegation + + attr_reader response_id: String? + + def response_id=: (String) -> String + + def initialize: ( + id: String, + target: OpenAI::Models::Live::DelegationCreatedEvent::Delegation::target, + ?response_id: String, + ?type: :delegation + ) -> void + + def to_hash: -> { + id: String, + target: OpenAI::Models::Live::DelegationCreatedEvent::Delegation::target, + ?type: :delegation, + ?response_id: String + } + + type target = :client | :responses + + module Target + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::DelegationCreatedEvent::Delegation::target] + + CLIENT: :client + RESPONSES: :responses + end + end + end + end + end +end diff --git a/sig/openai/models/live/error.rbs b/sig/openai/models/live/error.rbs new file mode 100644 index 000000000..ff4700595 --- /dev/null +++ b/sig/openai/models/live/error.rbs @@ -0,0 +1,46 @@ +module OpenAI + module Models + module Live + type error = + { + code: String, + message: String, + type: String, + ?client_event_id: String, + ?param: String + } + + class Error < OpenAI::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor message: String + + attr_accessor type: String + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + attr_reader param: String? + + def param=: (String) -> String + + def initialize: ( + code: String, + message: String, + type: String, + ?client_event_id: String, + ?param: String + ) -> void + + def to_hash: -> { + code: String, + message: String, + type: String, + ?client_event_id: String, + ?param: String + } + end + end + end +end diff --git a/sig/openai/models/live/error_event.rbs b/sig/openai/models/live/error_event.rbs new file mode 100644 index 000000000..3bcc7ed26 --- /dev/null +++ b/sig/openai/models/live/error_event.rbs @@ -0,0 +1,39 @@ +module OpenAI + module Models + module Live + type error_event = + { + error: OpenAI::Live::Error, + event_id: String, + ?type: :error, + ?client_event_id: String + } + + class ErrorEvent < OpenAI::Internal::Type::BaseModel + attr_accessor error: OpenAI::Live::Error + + attr_accessor event_id: String + + attr_accessor type: :error + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + error: OpenAI::Live::Error, + event_id: String, + ?client_event_id: String, + ?type: :error + ) -> void + + def to_hash: -> { + error: OpenAI::Live::Error, + event_id: String, + ?type: :error, + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/fork_client_event.rbs b/sig/openai/models/live/fork_client_event.rbs new file mode 100644 index 000000000..c619aa3cb --- /dev/null +++ b/sig/openai/models/live/fork_client_event.rbs @@ -0,0 +1,24 @@ +module OpenAI + module Models + module Live + type fork_client_event = + OpenAI::Live::ForkSessionStartEvent + | OpenAI::Live::SessionUpdateEvent + | OpenAI::Live::InputAudioAppendEvent + | OpenAI::Live::InputAudioMuteEvent + | OpenAI::Live::InputAudioUnmuteEvent + | OpenAI::Live::InstructionsAppendEvent + | OpenAI::Live::ThinkingAppendEvent + | OpenAI::Live::CommentaryAppendEvent + | OpenAI::Live::ResponseItemCreateEvent + | OpenAI::Live::ResponseCreateEvent + | OpenAI::Live::SessionCloseEvent + + module ForkClientEvent + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::fork_client_event] + end + end + end +end diff --git a/sig/openai/models/live/fork_server_event.rbs b/sig/openai/models/live/fork_server_event.rbs new file mode 100644 index 000000000..65242d6c6 --- /dev/null +++ b/sig/openai/models/live/fork_server_event.rbs @@ -0,0 +1,212 @@ +module OpenAI + module Models + module Live + type fork_server_event = + OpenAI::Live::SessionStartedEvent + | OpenAI::Live::SessionUpdatedEvent + | OpenAI::Live::InputAudioMutedEvent + | OpenAI::Live::InputAudioUnmutedEvent + | OpenAI::Live::InstructionsAppendedEvent + | OpenAI::Live::ThinkingAppendedEvent + | OpenAI::Live::CommentaryAppendedEvent + | OpenAI::Live::ForkServerEvent::SessionInputAudioAppend + | OpenAI::Live::OutputAudioDeltaEvent + | OpenAI::Live::InputTranscriptDeltaEvent + | OpenAI::Live::OutputTranscriptDeltaEvent + | OpenAI::Live::DelegationCreatedEvent + | OpenAI::Live::ResponseEvent + | OpenAI::Live::SessionUsageUpdatedEvent + | OpenAI::Live::SessionClosedEvent + | OpenAI::Live::ErrorEvent + | OpenAI::Live::InfoEvent + | OpenAI::Live::ForkServerEvent::TransportDtmfReceived + | OpenAI::Live::ForkServerEvent::TransportDtmfSend + | OpenAI::Live::ForkServerEvent::TransportRinging + | OpenAI::Live::ForkServerEvent::TransportAnswered + | OpenAI::Live::ForkServerEvent::TransportFailed + + module ForkServerEvent + extend OpenAI::Internal::Type::Union + + type session_input_audio_append = + { audio: String, ?type: :"session.input_audio.append" } + + class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel + attr_accessor audio: String + + attr_accessor type: :"session.input_audio.append" + + def initialize: ( + audio: String, + ?type: :"session.input_audio.append" + ) -> void + + def to_hash: -> { + audio: String, + ?type: :"session.input_audio.append" + } + end + + type transport_dtmf_received = + { event: String, event_id: String, ?type: :"transport.dtmf.received" } + + class TransportDtmfReceived < OpenAI::Internal::Type::BaseModel + attr_accessor event: String + + attr_accessor event_id: String + + attr_accessor type: :"transport.dtmf.received" + + def initialize: ( + event: String, + event_id: String, + ?type: :"transport.dtmf.received" + ) -> void + + def to_hash: -> { + event: String, + event_id: String, + ?type: :"transport.dtmf.received" + } + end + + type transport_dtmf_send = + { event: String, event_id: String, ?type: :"transport.dtmf.send" } + + class TransportDtmfSend < OpenAI::Internal::Type::BaseModel + attr_accessor event: String + + attr_accessor event_id: String + + attr_accessor type: :"transport.dtmf.send" + + def initialize: ( + event: String, + event_id: String, + ?type: :"transport.dtmf.send" + ) -> void + + def to_hash: -> { + event: String, + event_id: String, + ?type: :"transport.dtmf.send" + } + end + + type transport_ringing = + { event_id: String, session_id: String, ?type: :"transport.ringing" } + + class TransportRinging < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor type: :"transport.ringing" + + def initialize: ( + event_id: String, + session_id: String, + ?type: :"transport.ringing" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + ?type: :"transport.ringing" + } + end + + type transport_answered = + { event_id: String, session_id: String, ?type: :"transport.answered" } + + class TransportAnswered < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor type: :"transport.answered" + + def initialize: ( + event_id: String, + session_id: String, + ?type: :"transport.answered" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + ?type: :"transport.answered" + } + end + + type transport_failed = + { + error: OpenAI::Live::ForkServerEvent::TransportFailed::Error, + event_id: String, + session_id: String, + ?type: :"transport.failed" + } + + class TransportFailed < OpenAI::Internal::Type::BaseModel + attr_accessor error: OpenAI::Live::ForkServerEvent::TransportFailed::Error + + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor type: :"transport.failed" + + def initialize: ( + error: OpenAI::Live::ForkServerEvent::TransportFailed::Error, + event_id: String, + session_id: String, + ?type: :"transport.failed" + ) -> void + + def to_hash: -> { + error: OpenAI::Live::ForkServerEvent::TransportFailed::Error, + event_id: String, + session_id: String, + ?type: :"transport.failed" + } + + type error = + { + code: String, + message: String, + ?type: :call_error, + ?param: String + } + + class Error < OpenAI::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor message: String + + attr_accessor type: :call_error + + attr_reader param: String? + + def param=: (String) -> String + + def initialize: ( + code: String, + message: String, + ?param: String, + ?type: :call_error + ) -> void + + def to_hash: -> { + code: String, + message: String, + ?type: :call_error, + ?param: String + } + end + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::fork_server_event] + end + end + end +end diff --git a/sig/openai/models/live/fork_session_config.rbs b/sig/openai/models/live/fork_session_config.rbs new file mode 100644 index 000000000..bf2cea94b --- /dev/null +++ b/sig/openai/models/live/fork_session_config.rbs @@ -0,0 +1,89 @@ +module OpenAI + module Models + module Live + type fork_session_config = + { + ?audio: OpenAI::Live::ForkSessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Live::ForkSessionConfig::Delegation, + ?store: bool + } + + class ForkSessionConfig < OpenAI::Internal::Type::BaseModel + attr_reader audio: OpenAI::Live::ForkSessionConfig::Audio? + + def audio=: ( + OpenAI::Live::ForkSessionConfig::Audio + ) -> OpenAI::Live::ForkSessionConfig::Audio + + attr_reader client: OpenAI::Live::ClientConfig? + + def client=: (OpenAI::Live::ClientConfig) -> OpenAI::Live::ClientConfig + + attr_reader delegation: OpenAI::Live::ForkSessionConfig::Delegation? + + def delegation=: ( + OpenAI::Live::ForkSessionConfig::Delegation + ) -> OpenAI::Live::ForkSessionConfig::Delegation + + attr_reader store: bool? + + def store=: (bool) -> bool + + def initialize: ( + ?audio: OpenAI::Live::ForkSessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Live::ForkSessionConfig::Delegation, + ?store: bool + ) -> void + + def to_hash: -> { + ?audio: OpenAI::Live::ForkSessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Live::ForkSessionConfig::Delegation, + ?store: bool + } + + type audio = { ?format_: OpenAI::Models::Live::audio_format } + + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader format_: OpenAI::Models::Live::audio_format? + + def format_=: ( + OpenAI::Models::Live::audio_format + ) -> OpenAI::Models::Live::audio_format + + def initialize: (?format_: OpenAI::Models::Live::audio_format) -> void + + def to_hash: -> { ?format_: OpenAI::Models::Live::audio_format } + end + + type delegation = + { + ?type: :responses, + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig + } + + class Delegation < OpenAI::Internal::Type::BaseModel + attr_accessor type: :responses + + attr_reader responses: OpenAI::Live::ResponsesDelegationUpdateConfig? + + def responses=: ( + OpenAI::Live::ResponsesDelegationUpdateConfig + ) -> OpenAI::Live::ResponsesDelegationUpdateConfig + + def initialize: ( + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig, + ?type: :responses + ) -> void + + def to_hash: -> { + ?type: :responses, + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig + } + end + end + end + end +end diff --git a/sig/openai/models/live/fork_session_start_event.rbs b/sig/openai/models/live/fork_session_start_event.rbs new file mode 100644 index 000000000..79d2c6968 --- /dev/null +++ b/sig/openai/models/live/fork_session_start_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Live + type fork_session_start_event = + { + session: OpenAI::Live::ForkSessionConfig, + ?type: :"session.start", + ?event_id: String? + } + + class ForkSessionStartEvent < OpenAI::Internal::Type::BaseModel + attr_accessor session: OpenAI::Live::ForkSessionConfig + + attr_accessor type: :"session.start" + + attr_accessor event_id: String? + + def initialize: ( + session: OpenAI::Live::ForkSessionConfig, + ?event_id: String?, + ?type: :"session.start" + ) -> void + + def to_hash: -> { + session: OpenAI::Live::ForkSessionConfig, + ?type: :"session.start", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/function_tool.rbs b/sig/openai/models/live/function_tool.rbs new file mode 100644 index 000000000..47a6d9a66 --- /dev/null +++ b/sig/openai/models/live/function_tool.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Live + type function_tool = + { + name: String, + ?type: :function, + ?description: String?, + ?parameters: ::Hash[Symbol, top]?, + ?strict: bool? + } + + class FunctionTool < OpenAI::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor type: :function + + attr_accessor description: String? + + attr_accessor parameters: ::Hash[Symbol, top]? + + attr_accessor strict: bool? + + def initialize: ( + name: String, + ?description: String?, + ?parameters: ::Hash[Symbol, top]?, + ?strict: bool?, + ?type: :function + ) -> void + + def to_hash: -> { + name: String, + ?type: :function, + ?description: String?, + ?parameters: ::Hash[Symbol, top]?, + ?strict: bool? + } + end + end + end +end diff --git a/sig/openai/models/live/info_event.rbs b/sig/openai/models/live/info_event.rbs new file mode 100644 index 000000000..81a0a0ca6 --- /dev/null +++ b/sig/openai/models/live/info_event.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Live + type info_event = + { + code: String, + event_id: String, + message: String, + ?type: :info, + ?client_event_id: String + } + + class InfoEvent < OpenAI::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor event_id: String + + attr_accessor message: String + + attr_accessor type: :info + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + code: String, + event_id: String, + message: String, + ?client_event_id: String, + ?type: :info + ) -> void + + def to_hash: -> { + code: String, + event_id: String, + message: String, + ?type: :info, + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/initial_item.rbs b/sig/openai/models/live/initial_item.rbs new file mode 100644 index 000000000..c0d99bde8 --- /dev/null +++ b/sig/openai/models/live/initial_item.rbs @@ -0,0 +1,332 @@ +module OpenAI + module Models + module Live + type initial_item = + OpenAI::Live::InitialItem::Developer + | OpenAI::Live::InitialItem::User + | OpenAI::Live::InitialItem::Assistant + + module InitialItem + extend OpenAI::Internal::Type::Union + + type developer = + { + content: ::Array[OpenAI::Live::InitialItem::Developer::Content], + ?role: :developer, + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::Developer::status?, + ?type: OpenAI::Models::Live::InitialItem::Developer::type_ + } + + class Developer < OpenAI::Internal::Type::BaseModel + attr_accessor content: ::Array[OpenAI::Live::InitialItem::Developer::Content] + + attr_accessor role: :developer + + attr_accessor id: String? + + attr_accessor status: OpenAI::Models::Live::InitialItem::Developer::status? + + attr_reader type: OpenAI::Models::Live::InitialItem::Developer::type_? + + def type=: ( + OpenAI::Models::Live::InitialItem::Developer::type_ + ) -> OpenAI::Models::Live::InitialItem::Developer::type_ + + def initialize: ( + content: ::Array[OpenAI::Live::InitialItem::Developer::Content], + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::Developer::status?, + ?type: OpenAI::Models::Live::InitialItem::Developer::type_, + ?role: :developer + ) -> void + + def to_hash: -> { + content: ::Array[OpenAI::Live::InitialItem::Developer::Content], + ?role: :developer, + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::Developer::status?, + ?type: OpenAI::Models::Live::InitialItem::Developer::type_ + } + + type content = + { + text: String, + ?type: OpenAI::Models::Live::InitialItem::Developer::Content::type_ + } + + class Content < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_reader type: OpenAI::Models::Live::InitialItem::Developer::Content::type_? + + def type=: ( + OpenAI::Models::Live::InitialItem::Developer::Content::type_ + ) -> OpenAI::Models::Live::InitialItem::Developer::Content::type_ + + def initialize: ( + text: String, + ?type: OpenAI::Models::Live::InitialItem::Developer::Content::type_ + ) -> void + + def to_hash: -> { + text: String, + ?type: OpenAI::Models::Live::InitialItem::Developer::Content::type_ + } + + type type_ = :input_text + + module Type + extend OpenAI::Internal::Type::Enum + + INPUT_TEXT: :input_text + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::Developer::Content::type_] + end + end + + type status = :incomplete | :completed + + module Status + extend OpenAI::Internal::Type::Enum + + INCOMPLETE: :incomplete + COMPLETED: :completed + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::Developer::status] + end + + type type_ = :message + + module Type + extend OpenAI::Internal::Type::Enum + + MESSAGE: :message + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::Developer::type_] + end + end + + type user = + { + content: ::Array[OpenAI::Live::InitialItem::User::Content], + ?role: :user, + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::User::status?, + ?type: OpenAI::Models::Live::InitialItem::User::type_ + } + + class User < OpenAI::Internal::Type::BaseModel + attr_accessor content: ::Array[OpenAI::Live::InitialItem::User::Content] + + attr_accessor role: :user + + attr_accessor id: String? + + attr_accessor status: OpenAI::Models::Live::InitialItem::User::status? + + attr_reader type: OpenAI::Models::Live::InitialItem::User::type_? + + def type=: ( + OpenAI::Models::Live::InitialItem::User::type_ + ) -> OpenAI::Models::Live::InitialItem::User::type_ + + def initialize: ( + content: ::Array[OpenAI::Live::InitialItem::User::Content], + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::User::status?, + ?type: OpenAI::Models::Live::InitialItem::User::type_, + ?role: :user + ) -> void + + def to_hash: -> { + content: ::Array[OpenAI::Live::InitialItem::User::Content], + ?role: :user, + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::User::status?, + ?type: OpenAI::Models::Live::InitialItem::User::type_ + } + + type content = + { + text: String, + ?type: OpenAI::Models::Live::InitialItem::User::Content::type_ + } + + class Content < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_reader type: OpenAI::Models::Live::InitialItem::User::Content::type_? + + def type=: ( + OpenAI::Models::Live::InitialItem::User::Content::type_ + ) -> OpenAI::Models::Live::InitialItem::User::Content::type_ + + def initialize: ( + text: String, + ?type: OpenAI::Models::Live::InitialItem::User::Content::type_ + ) -> void + + def to_hash: -> { + text: String, + ?type: OpenAI::Models::Live::InitialItem::User::Content::type_ + } + + type type_ = :input_text + + module Type + extend OpenAI::Internal::Type::Enum + + INPUT_TEXT: :input_text + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::User::Content::type_] + end + end + + type status = :incomplete | :completed + + module Status + extend OpenAI::Internal::Type::Enum + + INCOMPLETE: :incomplete + COMPLETED: :completed + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::User::status] + end + + type type_ = :message + + module Type + extend OpenAI::Internal::Type::Enum + + MESSAGE: :message + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::User::type_] + end + end + + type assistant = + { + content: ::Array[OpenAI::Models::Live::InitialItem::Assistant::content], + ?role: :assistant, + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::Assistant::status?, + ?type: OpenAI::Models::Live::InitialItem::Assistant::type_ + } + + class Assistant < OpenAI::Internal::Type::BaseModel + attr_accessor content: ::Array[OpenAI::Models::Live::InitialItem::Assistant::content] + + attr_accessor role: :assistant + + attr_accessor id: String? + + attr_accessor status: OpenAI::Models::Live::InitialItem::Assistant::status? + + attr_reader type: OpenAI::Models::Live::InitialItem::Assistant::type_? + + def type=: ( + OpenAI::Models::Live::InitialItem::Assistant::type_ + ) -> OpenAI::Models::Live::InitialItem::Assistant::type_ + + def initialize: ( + content: ::Array[OpenAI::Models::Live::InitialItem::Assistant::content], + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::Assistant::status?, + ?type: OpenAI::Models::Live::InitialItem::Assistant::type_, + ?role: :assistant + ) -> void + + def to_hash: -> { + content: ::Array[OpenAI::Models::Live::InitialItem::Assistant::content], + ?role: :assistant, + ?id: String?, + ?status: OpenAI::Models::Live::InitialItem::Assistant::status?, + ?type: OpenAI::Models::Live::InitialItem::Assistant::type_ + } + + type content = + OpenAI::Live::InitialItem::Assistant::Content::Text + | OpenAI::Live::InitialItem::Assistant::Content::OutputText + + module Content + extend OpenAI::Internal::Type::Union + + type text = + { + text: String, + ?type: OpenAI::Models::Live::InitialItem::Assistant::Content::Text::type_ + } + + class Text < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_reader type: OpenAI::Models::Live::InitialItem::Assistant::Content::Text::type_? + + def type=: ( + OpenAI::Models::Live::InitialItem::Assistant::Content::Text::type_ + ) -> OpenAI::Models::Live::InitialItem::Assistant::Content::Text::type_ + + def initialize: ( + text: String, + ?type: OpenAI::Models::Live::InitialItem::Assistant::Content::Text::type_ + ) -> void + + def to_hash: -> { + text: String, + ?type: OpenAI::Models::Live::InitialItem::Assistant::Content::Text::type_ + } + + type type_ = :text + + module Type + extend OpenAI::Internal::Type::Enum + + TEXT: :text + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::Assistant::Content::Text::type_] + end + end + + type output_text = { text: String, ?type: :output_text } + + class OutputText < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_accessor type: :output_text + + def initialize: (text: String, ?type: :output_text) -> void + + def to_hash: -> { text: String, ?type: :output_text } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::InitialItem::Assistant::content] + end + + type status = :incomplete | :completed + + module Status + extend OpenAI::Internal::Type::Enum + + INCOMPLETE: :incomplete + COMPLETED: :completed + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::Assistant::status] + end + + type type_ = :message + + module Type + extend OpenAI::Internal::Type::Enum + + MESSAGE: :message + + def self?.values: -> ::Array[OpenAI::Models::Live::InitialItem::Assistant::type_] + end + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::initial_item] + end + end + end +end diff --git a/sig/openai/models/live/input_audio_append_event.rbs b/sig/openai/models/live/input_audio_append_event.rbs new file mode 100644 index 000000000..305dab12c --- /dev/null +++ b/sig/openai/models/live/input_audio_append_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Live + type input_audio_append_event = + { + audio: String, + ?type: :"session.input_audio.append", + ?event_id: String? + } + + class InputAudioAppendEvent < OpenAI::Internal::Type::BaseModel + attr_accessor audio: String + + attr_accessor type: :"session.input_audio.append" + + attr_accessor event_id: String? + + def initialize: ( + audio: String, + ?event_id: String?, + ?type: :"session.input_audio.append" + ) -> void + + def to_hash: -> { + audio: String, + ?type: :"session.input_audio.append", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/input_audio_mute_event.rbs b/sig/openai/models/live/input_audio_mute_event.rbs new file mode 100644 index 000000000..876ab939a --- /dev/null +++ b/sig/openai/models/live/input_audio_mute_event.rbs @@ -0,0 +1,24 @@ +module OpenAI + module Models + module Live + type input_audio_mute_event = + { ?type: :"session.input_audio.mute", ?event_id: String? } + + class InputAudioMuteEvent < OpenAI::Internal::Type::BaseModel + attr_accessor type: :"session.input_audio.mute" + + attr_accessor event_id: String? + + def initialize: ( + ?event_id: String?, + ?type: :"session.input_audio.mute" + ) -> void + + def to_hash: -> { + ?type: :"session.input_audio.mute", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/input_audio_muted_event.rbs b/sig/openai/models/live/input_audio_muted_event.rbs new file mode 100644 index 000000000..1940aa1b0 --- /dev/null +++ b/sig/openai/models/live/input_audio_muted_event.rbs @@ -0,0 +1,34 @@ +module OpenAI + module Models + module Live + type input_audio_muted_event = + { + event_id: String, + ?type: :"session.input_audio.muted", + ?client_event_id: String + } + + class InputAudioMutedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor type: :"session.input_audio.muted" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + event_id: String, + ?client_event_id: String, + ?type: :"session.input_audio.muted" + ) -> void + + def to_hash: -> { + event_id: String, + ?type: :"session.input_audio.muted", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/input_audio_unmute_event.rbs b/sig/openai/models/live/input_audio_unmute_event.rbs new file mode 100644 index 000000000..b2314a2ec --- /dev/null +++ b/sig/openai/models/live/input_audio_unmute_event.rbs @@ -0,0 +1,24 @@ +module OpenAI + module Models + module Live + type input_audio_unmute_event = + { ?type: :"session.input_audio.unmute", ?event_id: String? } + + class InputAudioUnmuteEvent < OpenAI::Internal::Type::BaseModel + attr_accessor type: :"session.input_audio.unmute" + + attr_accessor event_id: String? + + def initialize: ( + ?event_id: String?, + ?type: :"session.input_audio.unmute" + ) -> void + + def to_hash: -> { + ?type: :"session.input_audio.unmute", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/input_audio_unmuted_event.rbs b/sig/openai/models/live/input_audio_unmuted_event.rbs new file mode 100644 index 000000000..16b216891 --- /dev/null +++ b/sig/openai/models/live/input_audio_unmuted_event.rbs @@ -0,0 +1,34 @@ +module OpenAI + module Models + module Live + type input_audio_unmuted_event = + { + event_id: String, + ?type: :"session.input_audio.unmuted", + ?client_event_id: String + } + + class InputAudioUnmutedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor type: :"session.input_audio.unmuted" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + event_id: String, + ?client_event_id: String, + ?type: :"session.input_audio.unmuted" + ) -> void + + def to_hash: -> { + event_id: String, + ?type: :"session.input_audio.unmuted", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/input_transcript_delta_event.rbs b/sig/openai/models/live/input_transcript_delta_event.rbs new file mode 100644 index 000000000..25c76010a --- /dev/null +++ b/sig/openai/models/live/input_transcript_delta_event.rbs @@ -0,0 +1,49 @@ +module OpenAI + module Models + module Live + type input_transcript_delta_event = + { + delta: String, + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.input_transcript.delta", + ?client_event_id: String + } + + class InputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delta: String + + attr_accessor end_ms: Integer + + attr_accessor event_id: String + + attr_accessor start_ms: Integer + + attr_accessor type: :"session.input_transcript.delta" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + delta: String, + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?client_event_id: String, + ?type: :"session.input_transcript.delta" + ) -> void + + def to_hash: -> { + delta: String, + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.input_transcript.delta", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/instructions_append_event.rbs b/sig/openai/models/live/instructions_append_event.rbs new file mode 100644 index 000000000..3020701e5 --- /dev/null +++ b/sig/openai/models/live/instructions_append_event.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Live + type instructions_append_event = + { + content: String, + delegation_id: String?, + ?type: :"session.instructions.append", + ?event_id: String? + } + + class InstructionsAppendEvent < OpenAI::Internal::Type::BaseModel + attr_accessor content: String + + attr_accessor delegation_id: String? + + attr_accessor type: :"session.instructions.append" + + attr_accessor event_id: String? + + def initialize: ( + content: String, + delegation_id: String?, + ?event_id: String?, + ?type: :"session.instructions.append" + ) -> void + + def to_hash: -> { + content: String, + delegation_id: String?, + ?type: :"session.instructions.append", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/instructions_appended_event.rbs b/sig/openai/models/live/instructions_appended_event.rbs new file mode 100644 index 000000000..3ae9c7e3e --- /dev/null +++ b/sig/openai/models/live/instructions_appended_event.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Live + type instructions_appended_event = + { + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.instructions.appended", + ?client_event_id: String + } + + class InstructionsAppendedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor end_ms: Integer + + attr_accessor event_id: String + + attr_accessor start_ms: Integer + + attr_accessor type: :"session.instructions.appended" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?client_event_id: String, + ?type: :"session.instructions.appended" + ) -> void + + def to_hash: -> { + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.instructions.appended", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/live_create_params.rbs b/sig/openai/models/live/live_create_params.rbs new file mode 100644 index 000000000..25a5cc1ac --- /dev/null +++ b/sig/openai/models/live/live_create_params.rbs @@ -0,0 +1,45 @@ +module OpenAI + module Models + module Live + type live_create_params = + { + session: OpenAI::Live::MediaSessionConfig, + transport: OpenAI::Live::LiveCreateParams::Transport, + ?request_options: OpenAI::request_opts + } + + class LiveCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session: OpenAI::Live::MediaSessionConfig + + attr_accessor transport: OpenAI::Live::LiveCreateParams::Transport + + def initialize: ( + session: OpenAI::Live::MediaSessionConfig, + transport: OpenAI::Live::LiveCreateParams::Transport, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session: OpenAI::Live::MediaSessionConfig, + transport: OpenAI::Live::LiveCreateParams::Transport, + ?request_options: OpenAI::RequestOptions + } + + type transport = { sdp: String, ?type: :webrtc } + + class Transport < OpenAI::Internal::Type::BaseModel + attr_accessor sdp: String + + attr_accessor type: :webrtc + + def initialize: (sdp: String, ?type: :webrtc) -> void + + def to_hash: -> { sdp: String, ?type: :webrtc } + end + end + end + end +end diff --git a/sig/openai/models/live/live_create_response.rbs b/sig/openai/models/live/live_create_response.rbs new file mode 100644 index 000000000..86596a005 --- /dev/null +++ b/sig/openai/models/live/live_create_response.rbs @@ -0,0 +1,49 @@ +module OpenAI + module Models + module Live + type live_create_response = + { + session: OpenAI::Models::Live::LiveCreateResponse::Session, + transport: OpenAI::Models::Live::LiveCreateResponse::Transport + } + + class LiveCreateResponse < OpenAI::Internal::Type::BaseModel + attr_accessor session: OpenAI::Models::Live::LiveCreateResponse::Session + + attr_accessor transport: OpenAI::Models::Live::LiveCreateResponse::Transport + + def initialize: ( + session: OpenAI::Models::Live::LiveCreateResponse::Session, + transport: OpenAI::Models::Live::LiveCreateResponse::Transport + ) -> void + + def to_hash: -> { + session: OpenAI::Models::Live::LiveCreateResponse::Session, + transport: OpenAI::Models::Live::LiveCreateResponse::Transport + } + + type session = { id: String } + + class Session < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + def initialize: (id: String) -> void + + def to_hash: -> { id: String } + end + + type transport = { sdp: String, ?type: :webrtc } + + class Transport < OpenAI::Internal::Type::BaseModel + attr_accessor sdp: String + + attr_accessor type: :webrtc + + def initialize: (sdp: String, ?type: :webrtc) -> void + + def to_hash: -> { sdp: String, ?type: :webrtc } + end + end + end + end +end diff --git a/sig/openai/models/live/media_session_config.rbs b/sig/openai/models/live/media_session_config.rbs new file mode 100644 index 000000000..e415376f4 --- /dev/null +++ b/sig/openai/models/live/media_session_config.rbs @@ -0,0 +1,157 @@ +module OpenAI + module Models + module Live + type media_session_config = + { + model: OpenAI::Models::Live::MediaSessionConfig::model, + ?audio: OpenAI::Live::MediaSessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::MediaSessionConfig::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + } + + class MediaSessionConfig < OpenAI::Internal::Type::BaseModel + attr_accessor model: OpenAI::Models::Live::MediaSessionConfig::model + + attr_reader audio: OpenAI::Live::MediaSessionConfig::Audio? + + def audio=: ( + OpenAI::Live::MediaSessionConfig::Audio + ) -> OpenAI::Live::MediaSessionConfig::Audio + + attr_reader client: OpenAI::Live::ClientConfig? + + def client=: (OpenAI::Live::ClientConfig) -> OpenAI::Live::ClientConfig + + attr_accessor delegation: OpenAI::Models::Live::MediaSessionConfig::delegation? + + attr_reader input: ::Array[OpenAI::Models::Live::initial_item]? + + def input=: ( + ::Array[OpenAI::Models::Live::initial_item] + ) -> ::Array[OpenAI::Models::Live::initial_item] + + attr_accessor instructions: String? + + attr_reader store: bool? + + def store=: (bool) -> bool + + def initialize: ( + model: OpenAI::Models::Live::MediaSessionConfig::model, + ?audio: OpenAI::Live::MediaSessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::MediaSessionConfig::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + ) -> void + + def to_hash: -> { + model: OpenAI::Models::Live::MediaSessionConfig::model, + ?audio: OpenAI::Live::MediaSessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::MediaSessionConfig::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + } + + type model = String | :"gpt-live-1" + + module Model + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::MediaSessionConfig::model] + + GPT_LIVE_1: :"gpt-live-1" + end + + type audio = + { ?output: OpenAI::Live::MediaSessionConfig::Audio::Output } + + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader output: OpenAI::Live::MediaSessionConfig::Audio::Output? + + def output=: ( + OpenAI::Live::MediaSessionConfig::Audio::Output + ) -> OpenAI::Live::MediaSessionConfig::Audio::Output + + def initialize: ( + ?output: OpenAI::Live::MediaSessionConfig::Audio::Output + ) -> void + + def to_hash: -> { + ?output: OpenAI::Live::MediaSessionConfig::Audio::Output + } + + type output = + { + ?voice: OpenAI::Models::Live::MediaSessionConfig::Audio::Output::voice + } + + class Output < OpenAI::Internal::Type::BaseModel + attr_reader voice: OpenAI::Models::Live::MediaSessionConfig::Audio::Output::voice? + + def voice=: ( + OpenAI::Models::Live::MediaSessionConfig::Audio::Output::voice + ) -> OpenAI::Models::Live::MediaSessionConfig::Audio::Output::voice + + def initialize: ( + ?voice: OpenAI::Models::Live::MediaSessionConfig::Audio::Output::voice + ) -> void + + def to_hash: -> { + ?voice: OpenAI::Models::Live::MediaSessionConfig::Audio::Output::voice + } + + type voice = + String + | OpenAI::Models::Live::built_in_voice + | OpenAI::Live::CustomVoice + + module Voice + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::MediaSessionConfig::Audio::Output::voice] + end + end + end + + type delegation = + OpenAI::Live::ClientDelegation + | OpenAI::Live::MediaSessionConfig::Delegation::Responses + + module Delegation + extend OpenAI::Internal::Type::Union + + type responses = + { + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + } + + class Responses < OpenAI::Internal::Type::BaseModel + attr_accessor responses: OpenAI::Live::ResponsesDelegationConfig + + attr_accessor type: :responses + + def initialize: ( + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + ) -> void + + def to_hash: -> { + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::MediaSessionConfig::delegation] + end + end + end + end +end diff --git a/sig/openai/models/live/media_session_fork_config.rbs b/sig/openai/models/live/media_session_fork_config.rbs new file mode 100644 index 000000000..0a17162da --- /dev/null +++ b/sig/openai/models/live/media_session_fork_config.rbs @@ -0,0 +1,66 @@ +module OpenAI + module Models + module Live + type media_session_fork_config = + { + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Live::MediaSessionForkConfig::Delegation, + ?store: bool + } + + class MediaSessionForkConfig < OpenAI::Internal::Type::BaseModel + attr_reader client: OpenAI::Live::ClientConfig? + + def client=: (OpenAI::Live::ClientConfig) -> OpenAI::Live::ClientConfig + + attr_reader delegation: OpenAI::Live::MediaSessionForkConfig::Delegation? + + def delegation=: ( + OpenAI::Live::MediaSessionForkConfig::Delegation + ) -> OpenAI::Live::MediaSessionForkConfig::Delegation + + attr_reader store: bool? + + def store=: (bool) -> bool + + def initialize: ( + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Live::MediaSessionForkConfig::Delegation, + ?store: bool + ) -> void + + def to_hash: -> { + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Live::MediaSessionForkConfig::Delegation, + ?store: bool + } + + type delegation = + { + ?type: :responses, + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig + } + + class Delegation < OpenAI::Internal::Type::BaseModel + attr_accessor type: :responses + + attr_reader responses: OpenAI::Live::ResponsesDelegationUpdateConfig? + + def responses=: ( + OpenAI::Live::ResponsesDelegationUpdateConfig + ) -> OpenAI::Live::ResponsesDelegationUpdateConfig + + def initialize: ( + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig, + ?type: :responses + ) -> void + + def to_hash: -> { + ?type: :responses, + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig + } + end + end + end + end +end diff --git a/sig/openai/models/live/output_audio_delta_event.rbs b/sig/openai/models/live/output_audio_delta_event.rbs new file mode 100644 index 000000000..1e1f6908b --- /dev/null +++ b/sig/openai/models/live/output_audio_delta_event.rbs @@ -0,0 +1,41 @@ +module OpenAI + module Models + module Live + type output_audio_delta_event = + { + delta: String, + ?type: :"session.output_audio.delta", + ?end_ms: Integer, + ?start_ms: Integer + } + + class OutputAudioDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delta: String + + attr_accessor type: :"session.output_audio.delta" + + attr_reader end_ms: Integer? + + def end_ms=: (Integer) -> Integer + + attr_reader start_ms: Integer? + + def start_ms=: (Integer) -> Integer + + def initialize: ( + delta: String, + ?end_ms: Integer, + ?start_ms: Integer, + ?type: :"session.output_audio.delta" + ) -> void + + def to_hash: -> { + delta: String, + ?type: :"session.output_audio.delta", + ?end_ms: Integer, + ?start_ms: Integer + } + end + end + end +end diff --git a/sig/openai/models/live/output_transcript_delta_event.rbs b/sig/openai/models/live/output_transcript_delta_event.rbs new file mode 100644 index 000000000..b96379ecc --- /dev/null +++ b/sig/openai/models/live/output_transcript_delta_event.rbs @@ -0,0 +1,49 @@ +module OpenAI + module Models + module Live + type output_transcript_delta_event = + { + delta: String, + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.output_transcript.delta", + ?client_event_id: String + } + + class OutputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delta: String + + attr_accessor end_ms: Integer + + attr_accessor event_id: String + + attr_accessor start_ms: Integer + + attr_accessor type: :"session.output_transcript.delta" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + delta: String, + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?client_event_id: String, + ?type: :"session.output_transcript.delta" + ) -> void + + def to_hash: -> { + delta: String, + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.output_transcript.delta", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/response_create_event.rbs b/sig/openai/models/live/response_create_event.rbs new file mode 100644 index 000000000..7f3ff927d --- /dev/null +++ b/sig/openai/models/live/response_create_event.rbs @@ -0,0 +1,18 @@ +module OpenAI + module Models + module Live + type response_create_event = + { ?type: :"response.create", ?event_id: String? } + + class ResponseCreateEvent < OpenAI::Internal::Type::BaseModel + attr_accessor type: :"response.create" + + attr_accessor event_id: String? + + def initialize: (?event_id: String?, ?type: :"response.create") -> void + + def to_hash: -> { ?type: :"response.create", ?event_id: String? } + end + end + end +end diff --git a/sig/openai/models/live/response_event.rbs b/sig/openai/models/live/response_event.rbs new file mode 100644 index 000000000..2b87f733f --- /dev/null +++ b/sig/openai/models/live/response_event.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Live + type response_event = + { + event: ::Hash[Symbol, top], + event_id: String, + ?type: :"response.event", + ?client_event_id: String, + ?delegation_id: String? + } + + class ResponseEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event: ::Hash[Symbol, top] + + attr_accessor event_id: String + + attr_accessor type: :"response.event" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + attr_accessor delegation_id: String? + + def initialize: ( + event: ::Hash[Symbol, top], + event_id: String, + ?client_event_id: String, + ?delegation_id: String?, + ?type: :"response.event" + ) -> void + + def to_hash: -> { + event: ::Hash[Symbol, top], + event_id: String, + ?type: :"response.event", + ?client_event_id: String, + ?delegation_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/response_item_create_event.rbs b/sig/openai/models/live/response_item_create_event.rbs new file mode 100644 index 000000000..3dbb57b30 --- /dev/null +++ b/sig/openai/models/live/response_item_create_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Live + type response_item_create_event = + { + item: OpenAI::Models::Responses::response_input_item, + ?type: :"response.item.create", + ?event_id: String? + } + + class ResponseItemCreateEvent < OpenAI::Internal::Type::BaseModel + attr_accessor item: OpenAI::Models::Responses::response_input_item + + attr_accessor type: :"response.item.create" + + attr_accessor event_id: String? + + def initialize: ( + item: OpenAI::Models::Responses::response_input_item, + ?event_id: String?, + ?type: :"response.item.create" + ) -> void + + def to_hash: -> { + item: OpenAI::Models::Responses::response_input_item, + ?type: :"response.item.create", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/responses_delegation_config.rbs b/sig/openai/models/live/responses_delegation_config.rbs new file mode 100644 index 000000000..699d55f81 --- /dev/null +++ b/sig/openai/models/live/responses_delegation_config.rbs @@ -0,0 +1,244 @@ +module OpenAI + module Models + module Live + type responses_delegation_config = + { + model: String, + ?instructions: String?, + ?max_output_tokens: Integer?, + ?parallel_tool_calls: bool?, + ?reasoning: OpenAI::Live::ResponsesDelegationConfig::Reasoning?, + ?service_tier: OpenAI::Models::Live::ResponsesDelegationConfig::service_tier?, + ?text: OpenAI::Live::ResponsesDelegationConfig::Text?, + ?tool_choice: OpenAI::Models::Live::ResponsesDelegationConfig::tool_choice, + ?tools: ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::tool] + } + + class ResponsesDelegationConfig < OpenAI::Internal::Type::BaseModel + attr_accessor model: String + + attr_accessor instructions: String? + + attr_accessor max_output_tokens: Integer? + + attr_accessor parallel_tool_calls: bool? + + attr_accessor reasoning: OpenAI::Live::ResponsesDelegationConfig::Reasoning? + + attr_accessor service_tier: OpenAI::Models::Live::ResponsesDelegationConfig::service_tier? + + attr_accessor text: OpenAI::Live::ResponsesDelegationConfig::Text? + + attr_reader tool_choice: OpenAI::Models::Live::ResponsesDelegationConfig::tool_choice? + + def tool_choice=: ( + OpenAI::Models::Live::ResponsesDelegationConfig::tool_choice + ) -> OpenAI::Models::Live::ResponsesDelegationConfig::tool_choice + + attr_reader tools: ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::tool]? + + def tools=: ( + ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::tool] + ) -> ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::tool] + + def initialize: ( + model: String, + ?instructions: String?, + ?max_output_tokens: Integer?, + ?parallel_tool_calls: bool?, + ?reasoning: OpenAI::Live::ResponsesDelegationConfig::Reasoning?, + ?service_tier: OpenAI::Models::Live::ResponsesDelegationConfig::service_tier?, + ?text: OpenAI::Live::ResponsesDelegationConfig::Text?, + ?tool_choice: OpenAI::Models::Live::ResponsesDelegationConfig::tool_choice, + ?tools: ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::tool] + ) -> void + + def to_hash: -> { + model: String, + ?instructions: String?, + ?max_output_tokens: Integer?, + ?parallel_tool_calls: bool?, + ?reasoning: OpenAI::Live::ResponsesDelegationConfig::Reasoning?, + ?service_tier: OpenAI::Models::Live::ResponsesDelegationConfig::service_tier?, + ?text: OpenAI::Live::ResponsesDelegationConfig::Text?, + ?tool_choice: OpenAI::Models::Live::ResponsesDelegationConfig::tool_choice, + ?tools: ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::tool] + } + + type reasoning = + { + ?effort: OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::effort?, + ?summary: OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::summary? + } + + class Reasoning < OpenAI::Internal::Type::BaseModel + attr_accessor effort: OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::effort? + + attr_accessor summary: OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::summary? + + def initialize: ( + ?effort: OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::effort?, + ?summary: OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::summary? + ) -> void + + def to_hash: -> { + ?effort: OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::effort?, + ?summary: OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::summary? + } + + type effort = :none | :minimal | :low | :medium | :high | :xhigh + + module Effort + extend OpenAI::Internal::Type::Enum + + NONE: :none + MINIMAL: :minimal + LOW: :low + MEDIUM: :medium + HIGH: :high + XHIGH: :xhigh + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::effort] + end + + type summary = :concise | :detailed | :auto + + module Summary + extend OpenAI::Internal::Type::Enum + + CONCISE: :concise + DETAILED: :detailed + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::Reasoning::summary] + end + end + + type service_tier = + :auto + | :default + | :fast_tier_temp_pilot + | :flex + | :priority + | :ultrafast + + module ServiceTier + extend OpenAI::Internal::Type::Enum + + AUTO: :auto + DEFAULT: :default + FAST_TIER_TEMP_PILOT: :fast_tier_temp_pilot + FLEX: :flex + PRIORITY: :priority + ULTRAFAST: :ultrafast + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::service_tier] + end + + type text = + { + ?verbosity: OpenAI::Models::Live::ResponsesDelegationConfig::Text::verbosity? + } + + class Text < OpenAI::Internal::Type::BaseModel + attr_accessor verbosity: OpenAI::Models::Live::ResponsesDelegationConfig::Text::verbosity? + + def initialize: ( + ?verbosity: OpenAI::Models::Live::ResponsesDelegationConfig::Text::verbosity? + ) -> void + + def to_hash: -> { + ?verbosity: OpenAI::Models::Live::ResponsesDelegationConfig::Text::verbosity? + } + + type verbosity = :low | :medium | :high + + module Verbosity + extend OpenAI::Internal::Type::Enum + + LOW: :low + MEDIUM: :medium + HIGH: :high + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::Text::verbosity] + end + end + + type tool_choice = + OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::live_tool_choice_enum + | OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveFunctionToolChoiceParam + | OpenAI::Live::ResponsesDelegationConfig::ToolChoice::LiveMCPToolChoiceParam + + module ToolChoice + extend OpenAI::Internal::Type::Union + + type live_tool_choice_enum = :auto | :none | :required + + module LiveToolChoiceEnum + extend OpenAI::Internal::Type::Enum + + AUTO: :auto + NONE: :none + REQUIRED: :required + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::ToolChoice::live_tool_choice_enum] + end + + type live_function_tool_choice_param = + { name: String, ?type: :function } + + class LiveFunctionToolChoiceParam < OpenAI::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor type: :function + + def initialize: (name: String, ?type: :function) -> void + + def to_hash: -> { name: String, ?type: :function } + end + + type live_mcp_tool_choice_param = + { name: String, server_label: String, ?type: :mcp } + + class LiveMCPToolChoiceParam < OpenAI::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor server_label: String + + attr_accessor type: :mcp + + def initialize: ( + name: String, + server_label: String, + ?type: :mcp + ) -> void + + def to_hash: -> { name: String, server_label: String, ?type: :mcp } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::tool_choice] + end + + type tool = + OpenAI::Live::FunctionTool + | OpenAI::Live::ResponsesDelegationConfig::Tool::WebSearch + + module Tool + extend OpenAI::Internal::Type::Union + + type web_search = { ?type: :web_search } + + class WebSearch < OpenAI::Internal::Type::BaseModel + attr_accessor type: :web_search + + def initialize: (?type: :web_search) -> void + + def to_hash: -> { ?type: :web_search } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::ResponsesDelegationConfig::tool] + end + end + end + end +end diff --git a/sig/openai/models/live/responses_delegation_update_config.rbs b/sig/openai/models/live/responses_delegation_update_config.rbs new file mode 100644 index 000000000..d97f309ec --- /dev/null +++ b/sig/openai/models/live/responses_delegation_update_config.rbs @@ -0,0 +1,246 @@ +module OpenAI + module Models + module Live + type responses_delegation_update_config = + { + ?instructions: String?, + ?max_output_tokens: Integer?, + ?model: String, + ?parallel_tool_calls: bool?, + ?reasoning: OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning?, + ?service_tier: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::service_tier?, + ?text: OpenAI::Live::ResponsesDelegationUpdateConfig::Text?, + ?tool_choice: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool_choice, + ?tools: ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool] + } + + class ResponsesDelegationUpdateConfig < OpenAI::Internal::Type::BaseModel + attr_accessor instructions: String? + + attr_accessor max_output_tokens: Integer? + + attr_reader model: String? + + def model=: (String) -> String + + attr_accessor parallel_tool_calls: bool? + + attr_accessor reasoning: OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning? + + attr_accessor service_tier: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::service_tier? + + attr_accessor text: OpenAI::Live::ResponsesDelegationUpdateConfig::Text? + + attr_reader tool_choice: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool_choice? + + def tool_choice=: ( + OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool_choice + ) -> OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool_choice + + attr_reader tools: ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool]? + + def tools=: ( + ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool] + ) -> ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool] + + def initialize: ( + ?instructions: String?, + ?max_output_tokens: Integer?, + ?model: String, + ?parallel_tool_calls: bool?, + ?reasoning: OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning?, + ?service_tier: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::service_tier?, + ?text: OpenAI::Live::ResponsesDelegationUpdateConfig::Text?, + ?tool_choice: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool_choice, + ?tools: ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool] + ) -> void + + def to_hash: -> { + ?instructions: String?, + ?max_output_tokens: Integer?, + ?model: String, + ?parallel_tool_calls: bool?, + ?reasoning: OpenAI::Live::ResponsesDelegationUpdateConfig::Reasoning?, + ?service_tier: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::service_tier?, + ?text: OpenAI::Live::ResponsesDelegationUpdateConfig::Text?, + ?tool_choice: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool_choice, + ?tools: ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool] + } + + type reasoning = + { + ?effort: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::effort?, + ?summary: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::summary? + } + + class Reasoning < OpenAI::Internal::Type::BaseModel + attr_accessor effort: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::effort? + + attr_accessor summary: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::summary? + + def initialize: ( + ?effort: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::effort?, + ?summary: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::summary? + ) -> void + + def to_hash: -> { + ?effort: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::effort?, + ?summary: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::summary? + } + + type effort = :none | :minimal | :low | :medium | :high | :xhigh + + module Effort + extend OpenAI::Internal::Type::Enum + + NONE: :none + MINIMAL: :minimal + LOW: :low + MEDIUM: :medium + HIGH: :high + XHIGH: :xhigh + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::effort] + end + + type summary = :concise | :detailed | :auto + + module Summary + extend OpenAI::Internal::Type::Enum + + CONCISE: :concise + DETAILED: :detailed + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Reasoning::summary] + end + end + + type service_tier = + :auto + | :default + | :fast_tier_temp_pilot + | :flex + | :priority + | :ultrafast + + module ServiceTier + extend OpenAI::Internal::Type::Enum + + AUTO: :auto + DEFAULT: :default + FAST_TIER_TEMP_PILOT: :fast_tier_temp_pilot + FLEX: :flex + PRIORITY: :priority + ULTRAFAST: :ultrafast + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::service_tier] + end + + type text = + { + ?verbosity: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text::verbosity? + } + + class Text < OpenAI::Internal::Type::BaseModel + attr_accessor verbosity: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text::verbosity? + + def initialize: ( + ?verbosity: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text::verbosity? + ) -> void + + def to_hash: -> { + ?verbosity: OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text::verbosity? + } + + type verbosity = :low | :medium | :high + + module Verbosity + extend OpenAI::Internal::Type::Enum + + LOW: :low + MEDIUM: :medium + HIGH: :high + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::Text::verbosity] + end + end + + type tool_choice = + OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::live_tool_choice_enum + | OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveFunctionToolChoiceParam + | OpenAI::Live::ResponsesDelegationUpdateConfig::ToolChoice::LiveMCPToolChoiceParam + + module ToolChoice + extend OpenAI::Internal::Type::Union + + type live_tool_choice_enum = :auto | :none | :required + + module LiveToolChoiceEnum + extend OpenAI::Internal::Type::Enum + + AUTO: :auto + NONE: :none + REQUIRED: :required + + def self?.values: -> ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::ToolChoice::live_tool_choice_enum] + end + + type live_function_tool_choice_param = + { name: String, ?type: :function } + + class LiveFunctionToolChoiceParam < OpenAI::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor type: :function + + def initialize: (name: String, ?type: :function) -> void + + def to_hash: -> { name: String, ?type: :function } + end + + type live_mcp_tool_choice_param = + { name: String, server_label: String, ?type: :mcp } + + class LiveMCPToolChoiceParam < OpenAI::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor server_label: String + + attr_accessor type: :mcp + + def initialize: ( + name: String, + server_label: String, + ?type: :mcp + ) -> void + + def to_hash: -> { name: String, server_label: String, ?type: :mcp } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool_choice] + end + + type tool = + OpenAI::Live::FunctionTool + | OpenAI::Live::ResponsesDelegationUpdateConfig::Tool::WebSearch + + module Tool + extend OpenAI::Internal::Type::Union + + type web_search = { ?type: :web_search } + + class WebSearch < OpenAI::Internal::Type::BaseModel + attr_accessor type: :web_search + + def initialize: (?type: :web_search) -> void + + def to_hash: -> { ?type: :web_search } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::ResponsesDelegationUpdateConfig::tool] + end + end + end + end +end diff --git a/sig/openai/models/live/server_event.rbs b/sig/openai/models/live/server_event.rbs new file mode 100644 index 000000000..8f97e13d2 --- /dev/null +++ b/sig/openai/models/live/server_event.rbs @@ -0,0 +1,212 @@ +module OpenAI + module Models + module Live + type server_event = + OpenAI::Live::SessionStartedEvent + | OpenAI::Live::SessionUpdatedEvent + | OpenAI::Live::InputAudioMutedEvent + | OpenAI::Live::InputAudioUnmutedEvent + | OpenAI::Live::InstructionsAppendedEvent + | OpenAI::Live::ThinkingAppendedEvent + | OpenAI::Live::CommentaryAppendedEvent + | OpenAI::Live::ServerEvent::SessionInputAudioAppend + | OpenAI::Live::OutputAudioDeltaEvent + | OpenAI::Live::InputTranscriptDeltaEvent + | OpenAI::Live::OutputTranscriptDeltaEvent + | OpenAI::Live::DelegationCreatedEvent + | OpenAI::Live::ResponseEvent + | OpenAI::Live::SessionUsageUpdatedEvent + | OpenAI::Live::SessionClosedEvent + | OpenAI::Live::ErrorEvent + | OpenAI::Live::InfoEvent + | OpenAI::Live::ServerEvent::TransportDtmfReceived + | OpenAI::Live::ServerEvent::TransportDtmfSend + | OpenAI::Live::ServerEvent::TransportRinging + | OpenAI::Live::ServerEvent::TransportAnswered + | OpenAI::Live::ServerEvent::TransportFailed + + module ServerEvent + extend OpenAI::Internal::Type::Union + + type session_input_audio_append = + { audio: String, ?type: :"session.input_audio.append" } + + class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel + attr_accessor audio: String + + attr_accessor type: :"session.input_audio.append" + + def initialize: ( + audio: String, + ?type: :"session.input_audio.append" + ) -> void + + def to_hash: -> { + audio: String, + ?type: :"session.input_audio.append" + } + end + + type transport_dtmf_received = + { event: String, event_id: String, ?type: :"transport.dtmf.received" } + + class TransportDtmfReceived < OpenAI::Internal::Type::BaseModel + attr_accessor event: String + + attr_accessor event_id: String + + attr_accessor type: :"transport.dtmf.received" + + def initialize: ( + event: String, + event_id: String, + ?type: :"transport.dtmf.received" + ) -> void + + def to_hash: -> { + event: String, + event_id: String, + ?type: :"transport.dtmf.received" + } + end + + type transport_dtmf_send = + { event: String, event_id: String, ?type: :"transport.dtmf.send" } + + class TransportDtmfSend < OpenAI::Internal::Type::BaseModel + attr_accessor event: String + + attr_accessor event_id: String + + attr_accessor type: :"transport.dtmf.send" + + def initialize: ( + event: String, + event_id: String, + ?type: :"transport.dtmf.send" + ) -> void + + def to_hash: -> { + event: String, + event_id: String, + ?type: :"transport.dtmf.send" + } + end + + type transport_ringing = + { event_id: String, session_id: String, ?type: :"transport.ringing" } + + class TransportRinging < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor type: :"transport.ringing" + + def initialize: ( + event_id: String, + session_id: String, + ?type: :"transport.ringing" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + ?type: :"transport.ringing" + } + end + + type transport_answered = + { event_id: String, session_id: String, ?type: :"transport.answered" } + + class TransportAnswered < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor type: :"transport.answered" + + def initialize: ( + event_id: String, + session_id: String, + ?type: :"transport.answered" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + ?type: :"transport.answered" + } + end + + type transport_failed = + { + error: OpenAI::Live::ServerEvent::TransportFailed::Error, + event_id: String, + session_id: String, + ?type: :"transport.failed" + } + + class TransportFailed < OpenAI::Internal::Type::BaseModel + attr_accessor error: OpenAI::Live::ServerEvent::TransportFailed::Error + + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor type: :"transport.failed" + + def initialize: ( + error: OpenAI::Live::ServerEvent::TransportFailed::Error, + event_id: String, + session_id: String, + ?type: :"transport.failed" + ) -> void + + def to_hash: -> { + error: OpenAI::Live::ServerEvent::TransportFailed::Error, + event_id: String, + session_id: String, + ?type: :"transport.failed" + } + + type error = + { + code: String, + message: String, + ?type: :call_error, + ?param: String + } + + class Error < OpenAI::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor message: String + + attr_accessor type: :call_error + + attr_reader param: String? + + def param=: (String) -> String + + def initialize: ( + code: String, + message: String, + ?param: String, + ?type: :call_error + ) -> void + + def to_hash: -> { + code: String, + message: String, + ?type: :call_error, + ?param: String + } + end + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::server_event] + end + end + end +end diff --git a/sig/openai/models/live/server_event_selector.rbs b/sig/openai/models/live/server_event_selector.rbs new file mode 100644 index 000000000..ddda684a7 --- /dev/null +++ b/sig/openai/models/live/server_event_selector.rbs @@ -0,0 +1,19 @@ +module OpenAI + module Models + module Live + type server_event_selector = { type: String, ?response_event: String } + + class ServerEventSelector < OpenAI::Internal::Type::BaseModel + attr_accessor type: String + + attr_reader response_event: String? + + def response_event=: (String) -> String + + def initialize: (type: String, ?response_event: String) -> void + + def to_hash: -> { type: String, ?response_event: String } + end + end + end +end diff --git a/sig/openai/models/live/session_accept_params.rbs b/sig/openai/models/live/session_accept_params.rbs new file mode 100644 index 000000000..e2925b383 --- /dev/null +++ b/sig/openai/models/live/session_accept_params.rbs @@ -0,0 +1,185 @@ +module OpenAI + module Models + module Live + type session_accept_params = + { + session_id: String, + session: OpenAI::Live::SessionAcceptParams::Session, + ?request_options: OpenAI::request_opts + } + + class SessionAcceptParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor session: OpenAI::Live::SessionAcceptParams::Session + + def initialize: ( + session_id: String, + session: OpenAI::Live::SessionAcceptParams::Session, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + session: OpenAI::Live::SessionAcceptParams::Session, + ?request_options: OpenAI::RequestOptions + } + + type session = + { + model: OpenAI::Models::Live::SessionAcceptParams::Session::model, + ?type: :live, + ?audio: OpenAI::Live::SessionAcceptParams::Session::Audio, + ?delegation: OpenAI::Models::Live::SessionAcceptParams::Session::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + } + + class Session < OpenAI::Internal::Type::BaseModel + attr_accessor model: OpenAI::Models::Live::SessionAcceptParams::Session::model + + attr_accessor type: :live + + attr_reader audio: OpenAI::Live::SessionAcceptParams::Session::Audio? + + def audio=: ( + OpenAI::Live::SessionAcceptParams::Session::Audio + ) -> OpenAI::Live::SessionAcceptParams::Session::Audio + + attr_accessor delegation: OpenAI::Models::Live::SessionAcceptParams::Session::delegation? + + attr_reader input: ::Array[OpenAI::Models::Live::initial_item]? + + def input=: ( + ::Array[OpenAI::Models::Live::initial_item] + ) -> ::Array[OpenAI::Models::Live::initial_item] + + attr_accessor instructions: String? + + attr_reader store: bool? + + def store=: (bool) -> bool + + def initialize: ( + model: OpenAI::Models::Live::SessionAcceptParams::Session::model, + ?audio: OpenAI::Live::SessionAcceptParams::Session::Audio, + ?delegation: OpenAI::Models::Live::SessionAcceptParams::Session::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool, + ?type: :live + ) -> void + + def to_hash: -> { + model: OpenAI::Models::Live::SessionAcceptParams::Session::model, + ?type: :live, + ?audio: OpenAI::Live::SessionAcceptParams::Session::Audio, + ?delegation: OpenAI::Models::Live::SessionAcceptParams::Session::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + } + + type model = String | :"gpt-live-1" + + module Model + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionAcceptParams::Session::model] + + GPT_LIVE_1: :"gpt-live-1" + end + + type audio = + { + ?output: OpenAI::Live::SessionAcceptParams::Session::Audio::Output + } + + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader output: OpenAI::Live::SessionAcceptParams::Session::Audio::Output? + + def output=: ( + OpenAI::Live::SessionAcceptParams::Session::Audio::Output + ) -> OpenAI::Live::SessionAcceptParams::Session::Audio::Output + + def initialize: ( + ?output: OpenAI::Live::SessionAcceptParams::Session::Audio::Output + ) -> void + + def to_hash: -> { + ?output: OpenAI::Live::SessionAcceptParams::Session::Audio::Output + } + + type output = + { + ?voice: OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output::voice + } + + class Output < OpenAI::Internal::Type::BaseModel + attr_reader voice: OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output::voice? + + def voice=: ( + OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output::voice + ) -> OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output::voice + + def initialize: ( + ?voice: OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output::voice + ) -> void + + def to_hash: -> { + ?voice: OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output::voice + } + + type voice = + String + | OpenAI::Models::Live::built_in_voice + | OpenAI::Live::CustomVoice + + module Voice + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output::voice] + end + end + end + + type delegation = + OpenAI::Live::ClientDelegation + | OpenAI::Live::SessionAcceptParams::Session::Delegation::Responses + + module Delegation + extend OpenAI::Internal::Type::Union + + type responses = + { + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + } + + class Responses < OpenAI::Internal::Type::BaseModel + attr_accessor responses: OpenAI::Live::ResponsesDelegationConfig + + attr_accessor type: :responses + + def initialize: ( + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + ) -> void + + def to_hash: -> { + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionAcceptParams::Session::delegation] + end + end + end + end + end +end diff --git a/sig/openai/models/live/session_close_event.rbs b/sig/openai/models/live/session_close_event.rbs new file mode 100644 index 000000000..a7c076889 --- /dev/null +++ b/sig/openai/models/live/session_close_event.rbs @@ -0,0 +1,17 @@ +module OpenAI + module Models + module Live + type session_close_event = { ?type: :"session.close", ?event_id: String? } + + class SessionCloseEvent < OpenAI::Internal::Type::BaseModel + attr_accessor type: :"session.close" + + attr_accessor event_id: String? + + def initialize: (?event_id: String?, ?type: :"session.close") -> void + + def to_hash: -> { ?type: :"session.close", ?event_id: String? } + end + end + end +end diff --git a/sig/openai/models/live/session_closed_event.rbs b/sig/openai/models/live/session_closed_event.rbs new file mode 100644 index 000000000..130f9c226 --- /dev/null +++ b/sig/openai/models/live/session_closed_event.rbs @@ -0,0 +1,68 @@ +module OpenAI + module Models + module Live + type session_closed_event = + { + event_id: String, + reason: OpenAI::Models::Live::SessionClosedEvent::reason, + session: OpenAI::Live::SessionResource, + ?type: :"session.closed", + usage: OpenAI::Live::SessionUsage, + ?client_event_id: String + } + + class SessionClosedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor reason: OpenAI::Models::Live::SessionClosedEvent::reason + + attr_accessor session: OpenAI::Live::SessionResource + + attr_accessor type: :"session.closed" + + attr_accessor usage: OpenAI::Live::SessionUsage + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + event_id: String, + reason: OpenAI::Models::Live::SessionClosedEvent::reason, + session: OpenAI::Live::SessionResource, + usage: OpenAI::Live::SessionUsage, + ?client_event_id: String, + ?type: :"session.closed" + ) -> void + + def to_hash: -> { + event_id: String, + reason: OpenAI::Models::Live::SessionClosedEvent::reason, + session: OpenAI::Live::SessionResource, + ?type: :"session.closed", + usage: OpenAI::Live::SessionUsage, + ?client_event_id: String + } + + type reason = + :close_requested + | :expired + | :content + | :remote_hangup + | :connection_lost + + module Reason + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionClosedEvent::reason] + + CLOSE_REQUESTED: :close_requested + EXPIRED: :expired + CONTENT: :content + REMOTE_HANGUP: :remote_hangup + CONNECTION_LOST: :connection_lost + end + end + end + end +end diff --git a/sig/openai/models/live/session_config.rbs b/sig/openai/models/live/session_config.rbs new file mode 100644 index 000000000..bb14952da --- /dev/null +++ b/sig/openai/models/live/session_config.rbs @@ -0,0 +1,168 @@ +module OpenAI + module Models + module Live + type session_config = + { + model: OpenAI::Models::Live::SessionConfig::model, + ?audio: OpenAI::Live::SessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::SessionConfig::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + } + + class SessionConfig < OpenAI::Internal::Type::BaseModel + attr_accessor model: OpenAI::Models::Live::SessionConfig::model + + attr_reader audio: OpenAI::Live::SessionConfig::Audio? + + def audio=: ( + OpenAI::Live::SessionConfig::Audio + ) -> OpenAI::Live::SessionConfig::Audio + + attr_reader client: OpenAI::Live::ClientConfig? + + def client=: (OpenAI::Live::ClientConfig) -> OpenAI::Live::ClientConfig + + attr_accessor delegation: OpenAI::Models::Live::SessionConfig::delegation? + + attr_reader input: ::Array[OpenAI::Models::Live::initial_item]? + + def input=: ( + ::Array[OpenAI::Models::Live::initial_item] + ) -> ::Array[OpenAI::Models::Live::initial_item] + + attr_accessor instructions: String? + + attr_reader store: bool? + + def store=: (bool) -> bool + + def initialize: ( + model: OpenAI::Models::Live::SessionConfig::model, + ?audio: OpenAI::Live::SessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::SessionConfig::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + ) -> void + + def to_hash: -> { + model: OpenAI::Models::Live::SessionConfig::model, + ?audio: OpenAI::Live::SessionConfig::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::SessionConfig::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + } + + type model = String | :"gpt-live-1" + + module Model + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionConfig::model] + + GPT_LIVE_1: :"gpt-live-1" + end + + type audio = + { + ?format_: OpenAI::Models::Live::audio_format, + ?output: OpenAI::Live::SessionConfig::Audio::Output + } + + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader format_: OpenAI::Models::Live::audio_format? + + def format_=: ( + OpenAI::Models::Live::audio_format + ) -> OpenAI::Models::Live::audio_format + + attr_reader output: OpenAI::Live::SessionConfig::Audio::Output? + + def output=: ( + OpenAI::Live::SessionConfig::Audio::Output + ) -> OpenAI::Live::SessionConfig::Audio::Output + + def initialize: ( + ?format_: OpenAI::Models::Live::audio_format, + ?output: OpenAI::Live::SessionConfig::Audio::Output + ) -> void + + def to_hash: -> { + ?format_: OpenAI::Models::Live::audio_format, + ?output: OpenAI::Live::SessionConfig::Audio::Output + } + + type output = + { + ?voice: OpenAI::Models::Live::SessionConfig::Audio::Output::voice + } + + class Output < OpenAI::Internal::Type::BaseModel + attr_reader voice: OpenAI::Models::Live::SessionConfig::Audio::Output::voice? + + def voice=: ( + OpenAI::Models::Live::SessionConfig::Audio::Output::voice + ) -> OpenAI::Models::Live::SessionConfig::Audio::Output::voice + + def initialize: ( + ?voice: OpenAI::Models::Live::SessionConfig::Audio::Output::voice + ) -> void + + def to_hash: -> { + ?voice: OpenAI::Models::Live::SessionConfig::Audio::Output::voice + } + + type voice = + String + | OpenAI::Models::Live::built_in_voice + | OpenAI::Live::CustomVoice + + module Voice + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionConfig::Audio::Output::voice] + end + end + end + + type delegation = + OpenAI::Live::ClientDelegation + | OpenAI::Live::SessionConfig::Delegation::Responses + + module Delegation + extend OpenAI::Internal::Type::Union + + type responses = + { + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + } + + class Responses < OpenAI::Internal::Type::BaseModel + attr_accessor responses: OpenAI::Live::ResponsesDelegationConfig + + attr_accessor type: :responses + + def initialize: ( + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + ) -> void + + def to_hash: -> { + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionConfig::delegation] + end + end + end + end +end diff --git a/sig/openai/models/live/session_download_recording_params.rbs b/sig/openai/models/live/session_download_recording_params.rbs new file mode 100644 index 000000000..59a5e9716 --- /dev/null +++ b/sig/openai/models/live/session_download_recording_params.rbs @@ -0,0 +1,25 @@ +module OpenAI + module Models + module Live + type session_download_recording_params = + { session_id: String, ?request_options: OpenAI::request_opts } + + class SessionDownloadRecordingParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + def initialize: ( + session_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end +end diff --git a/sig/openai/models/live/session_fork_params.rbs b/sig/openai/models/live/session_fork_params.rbs new file mode 100644 index 000000000..ab7211d6f --- /dev/null +++ b/sig/openai/models/live/session_fork_params.rbs @@ -0,0 +1,54 @@ +module OpenAI + module Models + module Live + type session_fork_params = + { + session_id: String, + transport: OpenAI::Live::SessionForkParams::Transport, + ?session: OpenAI::Live::MediaSessionForkConfig, + ?request_options: OpenAI::request_opts + } + + class SessionForkParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor transport: OpenAI::Live::SessionForkParams::Transport + + attr_reader session: OpenAI::Live::MediaSessionForkConfig? + + def session=: ( + OpenAI::Live::MediaSessionForkConfig + ) -> OpenAI::Live::MediaSessionForkConfig + + def initialize: ( + session_id: String, + transport: OpenAI::Live::SessionForkParams::Transport, + ?session: OpenAI::Live::MediaSessionForkConfig, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + transport: OpenAI::Live::SessionForkParams::Transport, + ?session: OpenAI::Live::MediaSessionForkConfig, + ?request_options: OpenAI::RequestOptions + } + + type transport = { sdp: String, ?type: :webrtc } + + class Transport < OpenAI::Internal::Type::BaseModel + attr_accessor sdp: String + + attr_accessor type: :webrtc + + def initialize: (sdp: String, ?type: :webrtc) -> void + + def to_hash: -> { sdp: String, ?type: :webrtc } + end + end + end + end +end diff --git a/sig/openai/models/live/session_fork_response.rbs b/sig/openai/models/live/session_fork_response.rbs new file mode 100644 index 000000000..d5d8658b0 --- /dev/null +++ b/sig/openai/models/live/session_fork_response.rbs @@ -0,0 +1,49 @@ +module OpenAI + module Models + module Live + type session_fork_response = + { + session: OpenAI::Models::Live::SessionForkResponse::Session, + transport: OpenAI::Models::Live::SessionForkResponse::Transport + } + + class SessionForkResponse < OpenAI::Internal::Type::BaseModel + attr_accessor session: OpenAI::Models::Live::SessionForkResponse::Session + + attr_accessor transport: OpenAI::Models::Live::SessionForkResponse::Transport + + def initialize: ( + session: OpenAI::Models::Live::SessionForkResponse::Session, + transport: OpenAI::Models::Live::SessionForkResponse::Transport + ) -> void + + def to_hash: -> { + session: OpenAI::Models::Live::SessionForkResponse::Session, + transport: OpenAI::Models::Live::SessionForkResponse::Transport + } + + type session = { id: String } + + class Session < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + def initialize: (id: String) -> void + + def to_hash: -> { id: String } + end + + type transport = { sdp: String, ?type: :webrtc } + + class Transport < OpenAI::Internal::Type::BaseModel + attr_accessor sdp: String + + attr_accessor type: :webrtc + + def initialize: (sdp: String, ?type: :webrtc) -> void + + def to_hash: -> { sdp: String, ?type: :webrtc } + end + end + end + end +end diff --git a/sig/openai/models/live/session_hangup_params.rbs b/sig/openai/models/live/session_hangup_params.rbs new file mode 100644 index 000000000..096ac71ff --- /dev/null +++ b/sig/openai/models/live/session_hangup_params.rbs @@ -0,0 +1,25 @@ +module OpenAI + module Models + module Live + type session_hangup_params = + { session_id: String, ?request_options: OpenAI::request_opts } + + class SessionHangupParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + def initialize: ( + session_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end +end diff --git a/sig/openai/models/live/session_refer_params.rbs b/sig/openai/models/live/session_refer_params.rbs new file mode 100644 index 000000000..5f0f960ec --- /dev/null +++ b/sig/openai/models/live/session_refer_params.rbs @@ -0,0 +1,33 @@ +module OpenAI + module Models + module Live + type session_refer_params = + { + session_id: String, + target_uri: String, + ?request_options: OpenAI::request_opts + } + + class SessionReferParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor target_uri: String + + def initialize: ( + session_id: String, + target_uri: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + target_uri: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end +end diff --git a/sig/openai/models/live/session_reject_params.rbs b/sig/openai/models/live/session_reject_params.rbs new file mode 100644 index 000000000..585e2a7fb --- /dev/null +++ b/sig/openai/models/live/session_reject_params.rbs @@ -0,0 +1,33 @@ +module OpenAI + module Models + module Live + type session_reject_params = + { + session_id: String, + status_code: Integer, + ?request_options: OpenAI::request_opts + } + + class SessionRejectParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor status_code: Integer + + def initialize: ( + session_id: String, + status_code: Integer, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + status_code: Integer, + ?request_options: OpenAI::RequestOptions + } + end + end + end +end diff --git a/sig/openai/models/live/session_resource.rbs b/sig/openai/models/live/session_resource.rbs new file mode 100644 index 000000000..fb4bfda90 --- /dev/null +++ b/sig/openai/models/live/session_resource.rbs @@ -0,0 +1,183 @@ +module OpenAI + module Models + module Live + type session_resource = + { + id: String, + expires_at: Integer, + model: OpenAI::Models::Live::SessionResource::model, + ?status: :active, + ?audio: OpenAI::Live::SessionResource::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::SessionResource::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + } + + class SessionResource < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor expires_at: Integer + + attr_accessor model: OpenAI::Models::Live::SessionResource::model + + attr_accessor status: :active + + attr_reader audio: OpenAI::Live::SessionResource::Audio? + + def audio=: ( + OpenAI::Live::SessionResource::Audio + ) -> OpenAI::Live::SessionResource::Audio + + attr_reader client: OpenAI::Live::ClientConfig? + + def client=: (OpenAI::Live::ClientConfig) -> OpenAI::Live::ClientConfig + + attr_accessor delegation: OpenAI::Models::Live::SessionResource::delegation? + + attr_reader input: ::Array[OpenAI::Models::Live::initial_item]? + + def input=: ( + ::Array[OpenAI::Models::Live::initial_item] + ) -> ::Array[OpenAI::Models::Live::initial_item] + + attr_accessor instructions: String? + + attr_reader store: bool? + + def store=: (bool) -> bool + + def initialize: ( + id: String, + expires_at: Integer, + model: OpenAI::Models::Live::SessionResource::model, + ?audio: OpenAI::Live::SessionResource::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::SessionResource::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool, + ?status: :active + ) -> void + + def to_hash: -> { + id: String, + expires_at: Integer, + model: OpenAI::Models::Live::SessionResource::model, + ?status: :active, + ?audio: OpenAI::Live::SessionResource::Audio, + ?client: OpenAI::Live::ClientConfig, + ?delegation: OpenAI::Models::Live::SessionResource::delegation?, + ?input: ::Array[OpenAI::Models::Live::initial_item], + ?instructions: String?, + ?store: bool + } + + type model = String | :"gpt-live-1" + + module Model + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionResource::model] + + GPT_LIVE_1: :"gpt-live-1" + end + + type audio = + { + ?format_: OpenAI::Models::Live::audio_format, + ?output: OpenAI::Live::SessionResource::Audio::Output + } + + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader format_: OpenAI::Models::Live::audio_format? + + def format_=: ( + OpenAI::Models::Live::audio_format + ) -> OpenAI::Models::Live::audio_format + + attr_reader output: OpenAI::Live::SessionResource::Audio::Output? + + def output=: ( + OpenAI::Live::SessionResource::Audio::Output + ) -> OpenAI::Live::SessionResource::Audio::Output + + def initialize: ( + ?format_: OpenAI::Models::Live::audio_format, + ?output: OpenAI::Live::SessionResource::Audio::Output + ) -> void + + def to_hash: -> { + ?format_: OpenAI::Models::Live::audio_format, + ?output: OpenAI::Live::SessionResource::Audio::Output + } + + type output = + { + ?voice: OpenAI::Models::Live::SessionResource::Audio::Output::voice + } + + class Output < OpenAI::Internal::Type::BaseModel + attr_reader voice: OpenAI::Models::Live::SessionResource::Audio::Output::voice? + + def voice=: ( + OpenAI::Models::Live::SessionResource::Audio::Output::voice + ) -> OpenAI::Models::Live::SessionResource::Audio::Output::voice + + def initialize: ( + ?voice: OpenAI::Models::Live::SessionResource::Audio::Output::voice + ) -> void + + def to_hash: -> { + ?voice: OpenAI::Models::Live::SessionResource::Audio::Output::voice + } + + type voice = + String + | OpenAI::Models::Live::built_in_voice + | OpenAI::Live::CustomVoice + + module Voice + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionResource::Audio::Output::voice] + end + end + end + + type delegation = + OpenAI::Live::ClientDelegation + | OpenAI::Live::SessionResource::Delegation::Responses + + module Delegation + extend OpenAI::Internal::Type::Union + + type responses = + { + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + } + + class Responses < OpenAI::Internal::Type::BaseModel + attr_accessor responses: OpenAI::Live::ResponsesDelegationConfig + + attr_accessor type: :responses + + def initialize: ( + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + ) -> void + + def to_hash: -> { + responses: OpenAI::Live::ResponsesDelegationConfig, + ?type: :responses + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionResource::delegation] + end + end + end + end +end diff --git a/sig/openai/models/live/session_start_event.rbs b/sig/openai/models/live/session_start_event.rbs new file mode 100644 index 000000000..004978a58 --- /dev/null +++ b/sig/openai/models/live/session_start_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Live + type session_start_event = + { + session: OpenAI::Live::SessionConfig, + ?type: :"session.start", + ?event_id: String? + } + + class SessionStartEvent < OpenAI::Internal::Type::BaseModel + attr_accessor session: OpenAI::Live::SessionConfig + + attr_accessor type: :"session.start" + + attr_accessor event_id: String? + + def initialize: ( + session: OpenAI::Live::SessionConfig, + ?event_id: String?, + ?type: :"session.start" + ) -> void + + def to_hash: -> { + session: OpenAI::Live::SessionConfig, + ?type: :"session.start", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/session_started_event.rbs b/sig/openai/models/live/session_started_event.rbs new file mode 100644 index 000000000..b376477d8 --- /dev/null +++ b/sig/openai/models/live/session_started_event.rbs @@ -0,0 +1,39 @@ +module OpenAI + module Models + module Live + type session_started_event = + { + event_id: String, + session: OpenAI::Live::SessionResource, + ?type: :"session.started", + ?client_event_id: String + } + + class SessionStartedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Live::SessionResource + + attr_accessor type: :"session.started" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + event_id: String, + session: OpenAI::Live::SessionResource, + ?client_event_id: String, + ?type: :"session.started" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Live::SessionResource, + ?type: :"session.started", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/session_update_config.rbs b/sig/openai/models/live/session_update_config.rbs new file mode 100644 index 000000000..9c5e68fe7 --- /dev/null +++ b/sig/openai/models/live/session_update_config.rbs @@ -0,0 +1,56 @@ +module OpenAI + module Models + module Live + type session_update_config = + { ?delegation: OpenAI::Models::Live::SessionUpdateConfig::delegation? } + + class SessionUpdateConfig < OpenAI::Internal::Type::BaseModel + attr_accessor delegation: OpenAI::Models::Live::SessionUpdateConfig::delegation? + + def initialize: ( + ?delegation: OpenAI::Models::Live::SessionUpdateConfig::delegation? + ) -> void + + def to_hash: -> { + ?delegation: OpenAI::Models::Live::SessionUpdateConfig::delegation? + } + + type delegation = + OpenAI::Live::ClientDelegation + | OpenAI::Live::SessionUpdateConfig::Delegation::Responses + + module Delegation + extend OpenAI::Internal::Type::Union + + type responses = + { + ?type: :responses, + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig + } + + class Responses < OpenAI::Internal::Type::BaseModel + attr_accessor type: :responses + + attr_reader responses: OpenAI::Live::ResponsesDelegationUpdateConfig? + + def responses=: ( + OpenAI::Live::ResponsesDelegationUpdateConfig + ) -> OpenAI::Live::ResponsesDelegationUpdateConfig + + def initialize: ( + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig, + ?type: :responses + ) -> void + + def to_hash: -> { + ?type: :responses, + ?responses: OpenAI::Live::ResponsesDelegationUpdateConfig + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Live::SessionUpdateConfig::delegation] + end + end + end + end +end diff --git a/sig/openai/models/live/session_update_event.rbs b/sig/openai/models/live/session_update_event.rbs new file mode 100644 index 000000000..3f0359cd8 --- /dev/null +++ b/sig/openai/models/live/session_update_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Live + type session_update_event = + { + session: OpenAI::Live::SessionUpdateConfig, + ?type: :"session.update", + ?event_id: String? + } + + class SessionUpdateEvent < OpenAI::Internal::Type::BaseModel + attr_accessor session: OpenAI::Live::SessionUpdateConfig + + attr_accessor type: :"session.update" + + attr_accessor event_id: String? + + def initialize: ( + session: OpenAI::Live::SessionUpdateConfig, + ?event_id: String?, + ?type: :"session.update" + ) -> void + + def to_hash: -> { + session: OpenAI::Live::SessionUpdateConfig, + ?type: :"session.update", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/session_updated_event.rbs b/sig/openai/models/live/session_updated_event.rbs new file mode 100644 index 000000000..f9427aa15 --- /dev/null +++ b/sig/openai/models/live/session_updated_event.rbs @@ -0,0 +1,39 @@ +module OpenAI + module Models + module Live + type session_updated_event = + { + event_id: String, + session: OpenAI::Live::SessionResource, + ?type: :"session.updated", + ?client_event_id: String + } + + class SessionUpdatedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Live::SessionResource + + attr_accessor type: :"session.updated" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + event_id: String, + session: OpenAI::Live::SessionResource, + ?client_event_id: String, + ?type: :"session.updated" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Live::SessionResource, + ?type: :"session.updated", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/live/session_usage.rbs b/sig/openai/models/live/session_usage.rbs new file mode 100644 index 000000000..ea72a4af7 --- /dev/null +++ b/sig/openai/models/live/session_usage.rbs @@ -0,0 +1,15 @@ +module OpenAI + module Models + module Live + type session_usage = { seconds: Float } + + class SessionUsage < OpenAI::Internal::Type::BaseModel + attr_accessor seconds: Float + + def initialize: (seconds: Float) -> void + + def to_hash: -> { seconds: Float } + end + end + end +end diff --git a/sig/openai/models/live/session_usage_updated_event.rbs b/sig/openai/models/live/session_usage_updated_event.rbs new file mode 100644 index 000000000..ba6c745b7 --- /dev/null +++ b/sig/openai/models/live/session_usage_updated_event.rbs @@ -0,0 +1,58 @@ +module OpenAI + module Models + module Live + type session_usage_updated_event = + { + event_id: String, + ?type: :"session.usage.updated", + usage: OpenAI::Live::SessionUsage, + ?client_event_id: String, + ?context_window: OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow + } + + class SessionUsageUpdatedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor type: :"session.usage.updated" + + attr_accessor usage: OpenAI::Live::SessionUsage + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + attr_reader context_window: OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow? + + def context_window=: ( + OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow + ) -> OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow + + def initialize: ( + event_id: String, + usage: OpenAI::Live::SessionUsage, + ?client_event_id: String, + ?context_window: OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow, + ?type: :"session.usage.updated" + ) -> void + + def to_hash: -> { + event_id: String, + ?type: :"session.usage.updated", + usage: OpenAI::Live::SessionUsage, + ?client_event_id: String, + ?context_window: OpenAI::Live::SessionUsageUpdatedEvent::ContextWindow + } + + type context_window = { usage_ratio: Float } + + class ContextWindow < OpenAI::Internal::Type::BaseModel + attr_accessor usage_ratio: Float + + def initialize: (usage_ratio: Float) -> void + + def to_hash: -> { usage_ratio: Float } + end + end + end + end +end diff --git a/sig/openai/models/live/thinking_append_event.rbs b/sig/openai/models/live/thinking_append_event.rbs new file mode 100644 index 000000000..cec54be5c --- /dev/null +++ b/sig/openai/models/live/thinking_append_event.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Live + type thinking_append_event = + { + content: String, + delegation_id: String?, + ?type: :"session.thinking.append", + ?event_id: String? + } + + class ThinkingAppendEvent < OpenAI::Internal::Type::BaseModel + attr_accessor content: String + + attr_accessor delegation_id: String? + + attr_accessor type: :"session.thinking.append" + + attr_accessor event_id: String? + + def initialize: ( + content: String, + delegation_id: String?, + ?event_id: String?, + ?type: :"session.thinking.append" + ) -> void + + def to_hash: -> { + content: String, + delegation_id: String?, + ?type: :"session.thinking.append", + ?event_id: String? + } + end + end + end +end diff --git a/sig/openai/models/live/thinking_appended_event.rbs b/sig/openai/models/live/thinking_appended_event.rbs new file mode 100644 index 000000000..20f3735f3 --- /dev/null +++ b/sig/openai/models/live/thinking_appended_event.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Live + type thinking_appended_event = + { + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.thinking.appended", + ?client_event_id: String + } + + class ThinkingAppendedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor end_ms: Integer + + attr_accessor event_id: String + + attr_accessor start_ms: Integer + + attr_accessor type: :"session.thinking.appended" + + attr_reader client_event_id: String? + + def client_event_id=: (String) -> String + + def initialize: ( + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?client_event_id: String, + ?type: :"session.thinking.appended" + ) -> void + + def to_hash: -> { + end_ms: Integer, + event_id: String, + start_ms: Integer, + ?type: :"session.thinking.appended", + ?client_event_id: String + } + end + end + end +end diff --git a/sig/openai/models/responses/response_input_item.rbs b/sig/openai/models/responses/response_input_item.rbs index d94dc97c2..90c2275ed 100644 --- a/sig/openai/models/responses/response_input_item.rbs +++ b/sig/openai/models/responses/response_input_item.rbs @@ -399,7 +399,11 @@ module OpenAI result: String?, status: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::size? } @@ -412,15 +416,27 @@ module OpenAI attr_accessor type: :image_generation_call + attr_accessor action: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::action? + + attr_accessor background: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::background? + + attr_accessor output_format: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::output_format? + attr_accessor quality: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::quality? + attr_accessor revised_prompt: String? + attr_accessor size: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::size? def initialize: ( id: String, result: String?, status: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::status, + ?action: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::size?, ?type: :image_generation_call ) -> void @@ -430,7 +446,11 @@ module OpenAI result: String?, status: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::size? } @@ -447,6 +467,42 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::status] end + type action = :generate | :edit | :auto + + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE: :generate + EDIT: :edit + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::action] + end + + type background = :transparent | :opaque | :auto + + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT: :transparent + OPAQUE: :opaque + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::background] + end + + type output_format = :png | :webp | :jpeg + + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG: :png + WEBP: :webp + JPEG: :jpeg + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall::output_format] + end + type quality = :low | :medium | :high | :xhigh | :max | :auto module Quality diff --git a/sig/openai/models/responses/response_item.rbs b/sig/openai/models/responses/response_item.rbs index b3367e3b2..9c17e3112 100644 --- a/sig/openai/models/responses/response_item.rbs +++ b/sig/openai/models/responses/response_item.rbs @@ -184,7 +184,11 @@ module OpenAI result: String?, status: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::size? } @@ -197,15 +201,27 @@ module OpenAI attr_accessor type: :image_generation_call + attr_accessor action: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::action? + + attr_accessor background: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::background? + + attr_accessor output_format: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::output_format? + attr_accessor quality: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::quality? + attr_accessor revised_prompt: String? + attr_accessor size: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::size? def initialize: ( id: String, result: String?, status: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::status, + ?action: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::size?, ?type: :image_generation_call ) -> void @@ -215,7 +231,11 @@ module OpenAI result: String?, status: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::size? } @@ -232,6 +252,42 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::status] end + type action = :generate | :edit | :auto + + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE: :generate + EDIT: :edit + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::action] + end + + type background = :transparent | :opaque | :auto + + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT: :transparent + OPAQUE: :opaque + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::background] + end + + type output_format = :png | :webp | :jpeg + + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG: :png + WEBP: :webp + JPEG: :jpeg + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseItem::ImageGenerationCall::output_format] + end + type quality = :low | :medium | :high | :xhigh | :max | :auto module Quality diff --git a/sig/openai/models/responses/response_output_item.rbs b/sig/openai/models/responses/response_output_item.rbs index c63809991..d5ae8f281 100644 --- a/sig/openai/models/responses/response_output_item.rbs +++ b/sig/openai/models/responses/response_output_item.rbs @@ -182,7 +182,11 @@ module OpenAI result: String?, status: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::size? } @@ -195,15 +199,27 @@ module OpenAI attr_accessor type: :image_generation_call + attr_accessor action: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::action? + + attr_accessor background: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::background? + + attr_accessor output_format: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::output_format? + attr_accessor quality: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::quality? + attr_accessor revised_prompt: String? + attr_accessor size: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::size? def initialize: ( id: String, result: String?, status: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::status, + ?action: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::size?, ?type: :image_generation_call ) -> void @@ -213,7 +229,11 @@ module OpenAI result: String?, status: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::status, ?type: :image_generation_call, + ?action: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::action?, + ?background: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::background?, + ?output_format: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::output_format?, ?quality: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::quality?, + ?revised_prompt: String?, ?size: OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::size? } @@ -230,6 +250,42 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::status] end + type action = :generate | :edit | :auto + + module Action + extend OpenAI::Internal::Type::Enum + + GENERATE: :generate + EDIT: :edit + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::action] + end + + type background = :transparent | :opaque | :auto + + module Background + extend OpenAI::Internal::Type::Enum + + TRANSPARENT: :transparent + OPAQUE: :opaque + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::background] + end + + type output_format = :png | :webp | :jpeg + + module OutputFormat + extend OpenAI::Internal::Type::Enum + + PNG: :png + WEBP: :webp + JPEG: :jpeg + + def self?.values: -> ::Array[OpenAI::Models::Responses::ResponseOutputItem::ImageGenerationCall::output_format] + end + type quality = :low | :medium | :high | :xhigh | :max | :auto module Quality diff --git a/sig/openai/models/webhooks/live_transport_incoming_webhook_event.rbs b/sig/openai/models/webhooks/live_transport_incoming_webhook_event.rbs new file mode 100644 index 000000000..9c0b1b534 --- /dev/null +++ b/sig/openai/models/webhooks/live_transport_incoming_webhook_event.rbs @@ -0,0 +1,95 @@ +module OpenAI + module Models + module Webhooks + type live_transport_incoming_webhook_event = + { + id: String, + created_at: Integer, + data: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data, + ?type: :"live.transport.incoming", + ?object: OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::object + } + + class LiveTransportIncomingWebhookEvent < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Integer + + attr_accessor data: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data + + attr_accessor type: :"live.transport.incoming" + + attr_reader object: OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::object? + + def object=: ( + OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::object + ) -> OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::object + + def initialize: ( + id: String, + created_at: Integer, + data: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data, + ?object: OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::object, + ?type: :"live.transport.incoming" + ) -> void + + def to_hash: -> { + id: String, + created_at: Integer, + data: OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data, + ?type: :"live.transport.incoming", + ?object: OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::object + } + + type data = + { + session_id: String, + sip_headers: ::Array[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader], + ?type: :sip + } + + class Data < OpenAI::Internal::Type::BaseModel + attr_accessor session_id: String + + attr_accessor sip_headers: ::Array[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader] + + attr_accessor type: :sip + + def initialize: ( + session_id: String, + sip_headers: ::Array[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader], + ?type: :sip + ) -> void + + def to_hash: -> { + session_id: String, + sip_headers: ::Array[OpenAI::Webhooks::LiveTransportIncomingWebhookEvent::Data::SipHeader], + ?type: :sip + } + + type sip_header = { name: String, value: String } + + class SipHeader < OpenAI::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor value: String + + def initialize: (name: String, value: String) -> void + + def to_hash: -> { name: String, value: String } + end + end + + type object = :event + + module Object + extend OpenAI::Internal::Type::Enum + + EVENT: :event + + def self?.values: -> ::Array[OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent::object] + end + end + end + end +end diff --git a/sig/openai/models/webhooks/unwrap_webhook_event.rbs b/sig/openai/models/webhooks/unwrap_webhook_event.rbs index aad433365..39f19595e 100644 --- a/sig/openai/models/webhooks/unwrap_webhook_event.rbs +++ b/sig/openai/models/webhooks/unwrap_webhook_event.rbs @@ -13,6 +13,7 @@ module OpenAI | OpenAI::Webhooks::FineTuningJobFailedWebhookEvent | OpenAI::Webhooks::FineTuningJobSucceededWebhookEvent | OpenAI::Webhooks::LiveCallIncomingWebhookEvent + | OpenAI::Webhooks::LiveTransportIncomingWebhookEvent | OpenAI::Webhooks::RealtimeCallIncomingWebhookEvent | OpenAI::Webhooks::ResponseCancelledWebhookEvent | OpenAI::Webhooks::ResponseCompletedWebhookEvent diff --git a/sig/openai/resources/live.rbs b/sig/openai/resources/live.rbs new file mode 100644 index 000000000..0d92d17d2 --- /dev/null +++ b/sig/openai/resources/live.rbs @@ -0,0 +1,19 @@ +module OpenAI + module Resources + class Live + attr_reader sideband: OpenAI::Resources::Live::Sideband + + attr_reader forks: OpenAI::Resources::Live::Forks + + attr_reader sessions: OpenAI::Resources::Live::Sessions + + def create: ( + session: OpenAI::Live::MediaSessionConfig, + transport: OpenAI::Live::LiveCreateParams::Transport, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Models::Live::LiveCreateResponse + + def initialize: (client: OpenAI::Client) -> void + end + end +end diff --git a/sig/openai/resources/live/forks.rbs b/sig/openai/resources/live/forks.rbs new file mode 100644 index 000000000..19f469596 --- /dev/null +++ b/sig/openai/resources/live/forks.rbs @@ -0,0 +1,9 @@ +module OpenAI + module Resources + class Live + class Forks + def initialize: (client: OpenAI::Client) -> void + end + end + end +end diff --git a/sig/openai/resources/live/sessions.rbs b/sig/openai/resources/live/sessions.rbs new file mode 100644 index 000000000..7962c9923 --- /dev/null +++ b/sig/openai/resources/live/sessions.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Resources + class Live + class Sessions + def accept: ( + String session_id, + session: OpenAI::Live::SessionAcceptParams::Session, + ?request_options: OpenAI::request_opts + ) -> nil + + def download_recording: ( + String session_id, + ?request_options: OpenAI::request_opts + ) -> (StringIO & OpenAI::ResponseCarrier) + + def fork: ( + String session_id, + transport: OpenAI::Live::SessionForkParams::Transport, + ?session: OpenAI::Live::MediaSessionForkConfig, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Models::Live::SessionForkResponse + + def hangup: ( + String session_id, + ?request_options: OpenAI::request_opts + ) -> nil + + def refer: ( + String session_id, + target_uri: String, + ?request_options: OpenAI::request_opts + ) -> nil + + def reject: ( + String session_id, + status_code: Integer, + ?request_options: OpenAI::request_opts + ) -> nil + + def initialize: (client: OpenAI::Client) -> void + end + end + end +end diff --git a/sig/openai/resources/live/sideband.rbs b/sig/openai/resources/live/sideband.rbs new file mode 100644 index 000000000..ab0c255fa --- /dev/null +++ b/sig/openai/resources/live/sideband.rbs @@ -0,0 +1,9 @@ +module OpenAI + module Resources + class Live + class Sideband + def initialize: (client: OpenAI::Client) -> void + end + end + end +end diff --git a/sig/openai/resources/webhooks.rbs b/sig/openai/resources/webhooks.rbs index 37ec51b91..1c6077d19 100644 --- a/sig/openai/resources/webhooks.rbs +++ b/sig/openai/resources/webhooks.rbs @@ -16,6 +16,7 @@ module OpenAI | OpenAI::Webhooks::FineTuningJobFailedWebhookEvent | OpenAI::Webhooks::FineTuningJobSucceededWebhookEvent | OpenAI::Webhooks::LiveCallIncomingWebhookEvent + | OpenAI::Webhooks::LiveTransportIncomingWebhookEvent | OpenAI::Webhooks::RealtimeCallIncomingWebhookEvent | OpenAI::Webhooks::ResponseCancelledWebhookEvent | OpenAI::Webhooks::ResponseCompletedWebhookEvent diff --git a/test/openai/live/webrtc_example_test.rb b/test/openai/live/webrtc_example_test.rb new file mode 100644 index 000000000..b25582757 --- /dev/null +++ b/test/openai/live/webrtc_example_test.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +require_relative "../test_helper" +require_relative "../../../examples/live/webrtc" + +class OpenAI::Test::LiveWebRTCExampleTest < Minitest::Test + class RecordingClient + attr_reader :request_params + + def live = OpenAI::Resources::Live.new(client: self) + + def request(**params) + @request_params = params + OpenAI::Internal::Type::Converter.coerce( + OpenAI::Live::LiveCreateResponse, + {session: {id: "live_session_example"}, transport: {type: :webrtc, sdp: "answer"}} + ) + end + end + + def test_backend_sdp_handoff + client = RecordingClient.new + result = OpenAI::Examples::Live::WebRTC.create(client: client, offer_sdp: "offer") + + assert_equal(:post, client.request_params[:method]) + assert_equal("live/sessions", client.request_params[:path]) + assert_equal( + {session: {model: "gpt-live-1"}, transport: {type: :webrtc, sdp: "offer"}}, + client.request_params[:body] + ) + assert_equal("live_session_example", result.session.id) + assert_equal("answer", result.transport.sdp) + assert_empty(client.request_params[:options]) + end + + def test_model_inputs_preserve_explicit_null + client = RecordingClient.new + client.live.create( + session: OpenAI::Live::MediaSessionConfig.new(model: "gpt-live-1", instructions: nil), + transport: OpenAI::Live::LiveCreateParams::Transport.new(sdp: "offer") + ) + + assert_equal( + {session: {model: "gpt-live-1", instructions: nil}, transport: {sdp: "offer", type: :webrtc}}, + client.request_params[:body] + ) + end + + def test_response_selectors_survive_nested_hash_conversion + selectors = [{type: "session.*"}, {type: "response.event", response_event: "response.output_text.delta"}] + client = RecordingClient.new + client.live.create( + session: {model: "gpt-live-1", client: {data_channel: {allowed_server_events: selectors}}}, + transport: {type: :webrtc, sdp: "offer"} + ) + + assert_equal(selectors, client.request_params[:body].dig(:session, :client, :data_channel, :allowed_server_events)) + refute(client.request_params[:body][:session].key?(:instructions)) + end + + def test_transcript_event_decodes_to_typed_payload + event = OpenAI::Internal::Type::Converter.coerce( + OpenAI::Live::ServerEvent, + {type: "session.input_transcript.delta", event_id: "event_example", delta: "Hello", start_ms: 0, end_ms: 500} + ) + + assert_instance_of(OpenAI::Live::InputTranscriptDeltaEvent, event) + assert_equal("Hello", event.delta) + assert_equal(0, event.start_ms) + assert_equal(500, event.end_ms) + end +end diff --git a/test/openai/resource_namespaces.rb b/test/openai/resource_namespaces.rb index 0c5b59605..1a0f83885 100644 --- a/test/openai/resource_namespaces.rb +++ b/test/openai/resource_namespaces.rb @@ -93,6 +93,9 @@ module Groups module Jobs end + module Live + end + module Organization module Groups end diff --git a/test/openai/resources/beta/responses/input_items_test.rb b/test/openai/resources/beta/responses/input_items_test.rb index 6a762faa4..5b8e0dfd9 100644 --- a/test/openai/resources/beta/responses/input_items_test.rb +++ b/test/openai/resources/beta/responses/input_items_test.rb @@ -173,8 +173,12 @@ def test_list id: String, result: String | nil, status: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Status, + action: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Action | nil, agent: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent | nil, + background: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Background | nil, + output_format: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::OutputFormat | nil, quality: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Quality | nil, + revised_prompt: String | nil, size: OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Size | nil } | { type: :code_interpreter_call, diff --git a/test/openai/resources/conversations/items_test.rb b/test/openai/resources/conversations/items_test.rb index 40bae525d..ca28fb557 100644 --- a/test/openai/resources/conversations/items_test.rb +++ b/test/openai/resources/conversations/items_test.rb @@ -76,7 +76,11 @@ def test_retrieve_required_params id: String, result: String | nil, status: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status, + action: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action | nil, + background: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background | nil, + output_format: OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat | nil, quality: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Quality | nil, + revised_prompt: String | nil, size: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size | nil } | { type: :computer_call, @@ -293,7 +297,11 @@ def test_list id: String, result: String | nil, status: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status, + action: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Action | nil, + background: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Background | nil, + output_format: OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat | nil, quality: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Quality | nil, + revised_prompt: String | nil, size: OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size | nil } | { type: :computer_call, diff --git a/test/openai/resources/live/forks_test.rb b/test/openai/resources/live/forks_test.rb new file mode 100644 index 000000000..676678d40 --- /dev/null +++ b/test/openai/resources/live/forks_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class OpenAI::Test::Resources::Live::ForksTest < OpenAI::Test::ResourceTest +end diff --git a/test/openai/resources/live/sessions_test.rb b/test/openai/resources/live/sessions_test.rb new file mode 100644 index 000000000..978a857a1 --- /dev/null +++ b/test/openai/resources/live/sessions_test.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class OpenAI::Test::Resources::Live::SessionsTest < OpenAI::Test::ResourceTest + def test_accept_required_params + response = @openai.live.sessions.accept("session_id", session: {model: "gpt-live-1", type: :live}) + + assert_pattern do + response => nil + end + end + + def test_download_recording + response = @openai.live.sessions.download_recording("live_SQ") + + assert_pattern do + response => StringIO + end + end + + def test_fork_required_params + response = @openai.live.sessions.fork("session_id", transport: {sdp: "x", type: :webrtc}) + + assert_pattern do + response => OpenAI::Models::Live::SessionForkResponse + end + + assert_pattern do + response => { + session: OpenAI::Models::Live::SessionForkResponse::Session, + transport: OpenAI::Models::Live::SessionForkResponse::Transport + } + end + end + + def test_hangup + response = @openai.live.sessions.hangup("session_id") + + assert_pattern do + response => nil + end + end + + def test_refer_required_params + response = @openai.live.sessions.refer("session_id", target_uri: "tel:+14155550123") + + assert_pattern do + response => nil + end + end + + def test_reject_required_params + response = @openai.live.sessions.reject("session_id", status_code: 486) + + assert_pattern do + response => nil + end + end +end diff --git a/test/openai/resources/live/sideband_test.rb b/test/openai/resources/live/sideband_test.rb new file mode 100644 index 000000000..ffa31b11b --- /dev/null +++ b/test/openai/resources/live/sideband_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class OpenAI::Test::Resources::Live::SidebandTest < OpenAI::Test::ResourceTest +end diff --git a/test/openai/resources/live_test.rb b/test/openai/resources/live_test.rb new file mode 100644 index 000000000..df42423bd --- /dev/null +++ b/test/openai/resources/live_test.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class OpenAI::Test::Resources::LiveTest < OpenAI::Test::ResourceTest + def test_create_required_params + response = @openai.live.create(session: {model: :"gpt-live-1"}, transport: {sdp: "x", type: :webrtc}) + + assert_pattern do + response => OpenAI::Models::Live::LiveCreateResponse + end + + assert_pattern do + response => { + session: OpenAI::Models::Live::LiveCreateResponse::Session, + transport: OpenAI::Models::Live::LiveCreateResponse::Transport + } + end + end +end diff --git a/test/openai/resources/responses/input_items_test.rb b/test/openai/resources/responses/input_items_test.rb index 0d7a597e9..a5a1deaba 100644 --- a/test/openai/resources/responses/input_items_test.rb +++ b/test/openai/resources/responses/input_items_test.rb @@ -126,7 +126,11 @@ def test_list id: String, result: String | nil, status: OpenAI::Responses::ResponseItem::ImageGenerationCall::Status, + action: OpenAI::Responses::ResponseItem::ImageGenerationCall::Action | nil, + background: OpenAI::Responses::ResponseItem::ImageGenerationCall::Background | nil, + output_format: OpenAI::Responses::ResponseItem::ImageGenerationCall::OutputFormat | nil, quality: OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality | nil, + revised_prompt: String | nil, size: OpenAI::Responses::ResponseItem::ImageGenerationCall::Size | nil } | { type: :code_interpreter_call,