openai 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/lib/openai/client.rb +4 -0
- data/lib/openai/internal/stream.rb +3 -2
- data/lib/openai/models/audio/speech_create_params.rb +6 -0
- data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -0
- data/lib/openai/models/evals/run_cancel_response.rb +2 -2
- data/lib/openai/models/evals/run_create_params.rb +2 -2
- data/lib/openai/models/evals/run_create_response.rb +2 -2
- data/lib/openai/models/evals/run_list_response.rb +2 -2
- data/lib/openai/models/evals/run_retrieve_response.rb +2 -2
- data/lib/openai/models/realtime/client_secret_create_params.rb +93 -0
- data/lib/openai/models/realtime/client_secret_create_response.rb +300 -0
- data/lib/openai/models/realtime/conversation_created_event.rb +70 -0
- data/lib/openai/models/realtime/conversation_item.rb +44 -0
- data/lib/openai/models/realtime/conversation_item_added.rb +48 -0
- data/lib/openai/models/realtime/conversation_item_create_event.rb +57 -0
- data/lib/openai/models/realtime/conversation_item_created_event.rb +59 -0
- data/lib/openai/models/realtime/conversation_item_delete_event.rb +39 -0
- data/lib/openai/models/realtime/conversation_item_deleted_event.rb +38 -0
- data/lib/openai/models/realtime/conversation_item_done.rb +48 -0
- data/lib/openai/models/realtime/conversation_item_input_audio_transcription_completed_event.rb +189 -0
- data/lib/openai/models/realtime/conversation_item_input_audio_transcription_delta_event.rb +63 -0
- data/lib/openai/models/realtime/conversation_item_input_audio_transcription_failed_event.rb +96 -0
- data/lib/openai/models/realtime/conversation_item_input_audio_transcription_segment.rb +84 -0
- data/lib/openai/models/realtime/conversation_item_retrieve_event.rb +40 -0
- data/lib/openai/models/realtime/conversation_item_truncate_event.rb +68 -0
- data/lib/openai/models/realtime/conversation_item_truncated_event.rb +60 -0
- data/lib/openai/models/realtime/conversation_item_with_reference.rb +235 -0
- data/lib/openai/models/realtime/input_audio_buffer_append_event.rb +49 -0
- data/lib/openai/models/realtime/input_audio_buffer_clear_event.rb +29 -0
- data/lib/openai/models/realtime/input_audio_buffer_cleared_event.rb +29 -0
- data/lib/openai/models/realtime/input_audio_buffer_commit_event.rb +35 -0
- data/lib/openai/models/realtime/input_audio_buffer_committed_event.rb +51 -0
- data/lib/openai/models/realtime/input_audio_buffer_speech_started_event.rb +59 -0
- data/lib/openai/models/realtime/input_audio_buffer_speech_stopped_event.rb +51 -0
- data/lib/openai/models/realtime/input_audio_buffer_timeout_triggered.rb +52 -0
- data/lib/openai/models/realtime/log_prob_properties.rb +39 -0
- data/lib/openai/models/realtime/mcp_list_tools_completed.rb +36 -0
- data/lib/openai/models/realtime/mcp_list_tools_failed.rb +36 -0
- data/lib/openai/models/realtime/mcp_list_tools_in_progress.rb +36 -0
- data/lib/openai/models/realtime/output_audio_buffer_clear_event.rb +32 -0
- data/lib/openai/models/realtime/rate_limits_updated_event.rb +91 -0
- data/lib/openai/models/realtime/realtime_audio_config.rb +446 -0
- data/lib/openai/models/realtime/realtime_client_event.rb +123 -0
- data/lib/openai/models/realtime/realtime_client_secret_config.rb +64 -0
- data/lib/openai/models/realtime/realtime_conversation_item_assistant_message.rb +118 -0
- data/lib/openai/models/realtime/realtime_conversation_item_function_call.rb +94 -0
- data/lib/openai/models/realtime/realtime_conversation_item_function_call_output.rb +86 -0
- data/lib/openai/models/realtime/realtime_conversation_item_system_message.rb +118 -0
- data/lib/openai/models/realtime/realtime_conversation_item_user_message.rb +135 -0
- data/lib/openai/models/realtime/realtime_error.rb +55 -0
- data/lib/openai/models/realtime/realtime_error_event.rb +38 -0
- data/lib/openai/models/realtime/realtime_mcp_approval_request.rb +52 -0
- data/lib/openai/models/realtime/realtime_mcp_approval_response.rb +52 -0
- data/lib/openai/models/realtime/realtime_mcp_list_tools.rb +84 -0
- data/lib/openai/models/realtime/realtime_mcp_protocol_error.rb +29 -0
- data/lib/openai/models/realtime/realtime_mcp_tool_call.rb +94 -0
- data/lib/openai/models/realtime/realtime_mcp_tool_execution_error.rb +23 -0
- data/lib/openai/models/realtime/realtime_mcphttp_error.rb +29 -0
- data/lib/openai/models/realtime/realtime_response.rb +259 -0
- data/lib/openai/models/realtime/realtime_response_status.rb +103 -0
- data/lib/openai/models/realtime/realtime_response_usage.rb +61 -0
- data/lib/openai/models/realtime/realtime_response_usage_input_token_details.rb +36 -0
- data/lib/openai/models/realtime/realtime_response_usage_output_token_details.rb +28 -0
- data/lib/openai/models/realtime/realtime_server_event.rb +369 -0
- data/lib/openai/models/realtime/realtime_session.rb +696 -0
- data/lib/openai/models/realtime/realtime_session_create_request.rb +234 -0
- data/lib/openai/models/realtime/realtime_session_create_response.rb +579 -0
- data/lib/openai/models/realtime/realtime_tool_choice_config.rb +32 -0
- data/lib/openai/models/realtime/realtime_tools_config.rb +11 -0
- data/lib/openai/models/realtime/realtime_tools_config_union.rb +379 -0
- data/lib/openai/models/realtime/realtime_tracing_config.rb +61 -0
- data/lib/openai/models/realtime/realtime_transcription_session_create_request.rb +312 -0
- data/lib/openai/models/realtime/realtime_truncation.rb +67 -0
- data/lib/openai/models/realtime/response_audio_delta_event.rb +68 -0
- data/lib/openai/models/realtime/response_audio_done_event.rb +61 -0
- data/lib/openai/models/realtime/response_audio_transcript_delta_event.rb +68 -0
- data/lib/openai/models/realtime/response_audio_transcript_done_event.rb +70 -0
- data/lib/openai/models/realtime/response_cancel_event.rb +42 -0
- data/lib/openai/models/realtime/response_content_part_added_event.rb +120 -0
- data/lib/openai/models/realtime/response_content_part_done_event.rb +120 -0
- data/lib/openai/models/realtime/response_create_event.rb +391 -0
- data/lib/openai/models/realtime/response_created_event.rb +37 -0
- data/lib/openai/models/realtime/response_done_event.rb +38 -0
- data/lib/openai/models/realtime/response_function_call_arguments_delta_event.rb +72 -0
- data/lib/openai/models/realtime/response_function_call_arguments_done_event.rb +73 -0
- data/lib/openai/models/realtime/response_mcp_call_arguments_delta.rb +68 -0
- data/lib/openai/models/realtime/response_mcp_call_arguments_done.rb +60 -0
- data/lib/openai/models/realtime/response_mcp_call_completed.rb +44 -0
- data/lib/openai/models/realtime/response_mcp_call_failed.rb +44 -0
- data/lib/openai/models/realtime/response_mcp_call_in_progress.rb +44 -0
- data/lib/openai/models/realtime/response_output_item_added_event.rb +52 -0
- data/lib/openai/models/realtime/response_output_item_done_event.rb +53 -0
- data/lib/openai/models/realtime/response_text_delta_event.rb +68 -0
- data/lib/openai/models/realtime/response_text_done_event.rb +69 -0
- data/lib/openai/models/realtime/session_created_event.rb +38 -0
- data/lib/openai/models/realtime/session_update_event.rb +44 -0
- data/lib/openai/models/realtime/session_updated_event.rb +37 -0
- data/lib/openai/models/realtime/transcription_session_created.rb +278 -0
- data/lib/openai/models/realtime/transcription_session_update.rb +36 -0
- data/lib/openai/models/realtime/transcription_session_updated_event.rb +279 -0
- data/lib/openai/models/responses/response.rb +6 -3
- data/lib/openai/models/responses/response_create_params.rb +6 -3
- data/lib/openai/models/responses/tool.rb +3 -156
- data/lib/openai/models/responses/web_search_preview_tool.rb +124 -0
- data/lib/openai/models/responses/web_search_tool.rb +58 -21
- data/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb +119 -0
- data/lib/openai/models/webhooks/unwrap_webhook_event.rb +4 -1
- data/lib/openai/models.rb +2 -0
- data/lib/openai/resources/realtime/client_secrets.rb +44 -0
- data/lib/openai/resources/realtime.rb +18 -0
- data/lib/openai/resources/responses.rb +2 -2
- data/lib/openai/resources/webhooks.rb +1 -1
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +95 -0
- data/rbi/openai/client.rbi +3 -0
- data/rbi/openai/models/audio/speech_create_params.rbi +10 -0
- data/rbi/openai/models/chat/chat_completion_audio_param.rbi +10 -0
- data/rbi/openai/models/evals/run_cancel_response.rbi +4 -4
- data/rbi/openai/models/evals/run_create_params.rbi +8 -8
- data/rbi/openai/models/evals/run_create_response.rbi +4 -4
- data/rbi/openai/models/evals/run_list_response.rbi +4 -4
- data/rbi/openai/models/evals/run_retrieve_response.rbi +4 -4
- data/rbi/openai/models/realtime/client_secret_create_params.rbi +222 -0
- data/rbi/openai/models/realtime/client_secret_create_response.rbi +676 -0
- data/rbi/openai/models/realtime/conversation_created_event.rbi +164 -0
- data/rbi/openai/models/realtime/conversation_item.rbi +35 -0
- data/rbi/openai/models/realtime/conversation_item_added.rbi +105 -0
- data/rbi/openai/models/realtime/conversation_item_create_event.rbi +123 -0
- data/rbi/openai/models/realtime/conversation_item_created_event.rbi +117 -0
- data/rbi/openai/models/realtime/conversation_item_delete_event.rbi +57 -0
- data/rbi/openai/models/realtime/conversation_item_deleted_event.rbi +53 -0
- data/rbi/openai/models/realtime/conversation_item_done.rbi +105 -0
- data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_completed_event.rbi +305 -0
- data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_delta_event.rbi +93 -0
- data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_failed_event.rbi +158 -0
- data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_segment.rbi +107 -0
- data/rbi/openai/models/realtime/conversation_item_retrieve_event.rbi +58 -0
- data/rbi/openai/models/realtime/conversation_item_truncate_event.rbi +94 -0
- data/rbi/openai/models/realtime/conversation_item_truncated_event.rbi +80 -0
- data/rbi/openai/models/realtime/conversation_item_with_reference.rbi +549 -0
- data/rbi/openai/models/realtime/input_audio_buffer_append_event.rbi +65 -0
- data/rbi/openai/models/realtime/input_audio_buffer_clear_event.rbi +43 -0
- data/rbi/openai/models/realtime/input_audio_buffer_cleared_event.rbi +40 -0
- data/rbi/openai/models/realtime/input_audio_buffer_commit_event.rbi +49 -0
- data/rbi/openai/models/realtime/input_audio_buffer_committed_event.rbi +72 -0
- data/rbi/openai/models/realtime/input_audio_buffer_speech_started_event.rbi +82 -0
- data/rbi/openai/models/realtime/input_audio_buffer_speech_stopped_event.rbi +73 -0
- data/rbi/openai/models/realtime/input_audio_buffer_timeout_triggered.rbi +75 -0
- data/rbi/openai/models/realtime/log_prob_properties.rbi +55 -0
- data/rbi/openai/models/realtime/mcp_list_tools_completed.rbi +51 -0
- data/rbi/openai/models/realtime/mcp_list_tools_failed.rbi +51 -0
- data/rbi/openai/models/realtime/mcp_list_tools_in_progress.rbi +51 -0
- data/rbi/openai/models/realtime/output_audio_buffer_clear_event.rbi +46 -0
- data/rbi/openai/models/realtime/rate_limits_updated_event.rbi +187 -0
- data/rbi/openai/models/realtime/realtime_audio_config.rbi +1004 -0
- data/rbi/openai/models/realtime/realtime_client_event.rbi +38 -0
- data/rbi/openai/models/realtime/realtime_client_secret_config.rbi +147 -0
- data/rbi/openai/models/realtime/realtime_conversation_item_assistant_message.rbi +292 -0
- data/rbi/openai/models/realtime/realtime_conversation_item_function_call.rbi +199 -0
- data/rbi/openai/models/realtime/realtime_conversation_item_function_call_output.rbi +188 -0
- data/rbi/openai/models/realtime/realtime_conversation_item_system_message.rbi +292 -0
- data/rbi/openai/models/realtime/realtime_conversation_item_user_message.rbi +319 -0
- data/rbi/openai/models/realtime/realtime_error.rbi +72 -0
- data/rbi/openai/models/realtime/realtime_error_event.rbi +64 -0
- data/rbi/openai/models/realtime/realtime_mcp_approval_request.rbi +75 -0
- data/rbi/openai/models/realtime/realtime_mcp_approval_response.rbi +75 -0
- data/rbi/openai/models/realtime/realtime_mcp_list_tools.rbi +131 -0
- data/rbi/openai/models/realtime/realtime_mcp_protocol_error.rbi +40 -0
- data/rbi/openai/models/realtime/realtime_mcp_tool_call.rbi +145 -0
- data/rbi/openai/models/realtime/realtime_mcp_tool_execution_error.rbi +31 -0
- data/rbi/openai/models/realtime/realtime_mcphttp_error.rbi +40 -0
- data/rbi/openai/models/realtime/realtime_response.rbi +573 -0
- data/rbi/openai/models/realtime/realtime_response_status.rbi +233 -0
- data/rbi/openai/models/realtime/realtime_response_usage.rbi +121 -0
- data/rbi/openai/models/realtime/realtime_response_usage_input_token_details.rbi +68 -0
- data/rbi/openai/models/realtime/realtime_response_usage_output_token_details.rbi +51 -0
- data/rbi/openai/models/realtime/realtime_server_event.rbi +311 -0
- data/rbi/openai/models/realtime/realtime_session.rbi +1426 -0
- data/rbi/openai/models/realtime/realtime_session_create_request.rbi +560 -0
- data/rbi/openai/models/realtime/realtime_session_create_response.rbi +1249 -0
- data/rbi/openai/models/realtime/realtime_tool_choice_config.rbi +30 -0
- data/rbi/openai/models/realtime/realtime_tools_config.rbi +15 -0
- data/rbi/openai/models/realtime/realtime_tools_config_union.rbi +755 -0
- data/rbi/openai/models/realtime/realtime_tracing_config.rbi +95 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_create_request.rbi +703 -0
- data/rbi/openai/models/realtime/realtime_truncation.rbi +117 -0
- data/rbi/openai/models/realtime/response_audio_delta_event.rbi +91 -0
- data/rbi/openai/models/realtime/response_audio_done_event.rbi +84 -0
- data/rbi/openai/models/realtime/response_audio_transcript_delta_event.rbi +91 -0
- data/rbi/openai/models/realtime/response_audio_transcript_done_event.rbi +93 -0
- data/rbi/openai/models/realtime/response_cancel_event.rbi +63 -0
- data/rbi/openai/models/realtime/response_content_part_added_event.rbi +219 -0
- data/rbi/openai/models/realtime/response_content_part_done_event.rbi +219 -0
- data/rbi/openai/models/realtime/response_create_event.rbi +863 -0
- data/rbi/openai/models/realtime/response_created_event.rbi +65 -0
- data/rbi/openai/models/realtime/response_done_event.rbi +66 -0
- data/rbi/openai/models/realtime/response_function_call_arguments_delta_event.rbi +91 -0
- data/rbi/openai/models/realtime/response_function_call_arguments_done_event.rbi +92 -0
- data/rbi/openai/models/realtime/response_mcp_call_arguments_delta.rbi +91 -0
- data/rbi/openai/models/realtime/response_mcp_call_arguments_done.rbi +83 -0
- data/rbi/openai/models/realtime/response_mcp_call_completed.rbi +67 -0
- data/rbi/openai/models/realtime/response_mcp_call_failed.rbi +67 -0
- data/rbi/openai/models/realtime/response_mcp_call_in_progress.rbi +67 -0
- data/rbi/openai/models/realtime/response_output_item_added_event.rbi +111 -0
- data/rbi/openai/models/realtime/response_output_item_done_event.rbi +112 -0
- data/rbi/openai/models/realtime/response_text_delta_event.rbi +91 -0
- data/rbi/openai/models/realtime/response_text_done_event.rbi +92 -0
- data/rbi/openai/models/realtime/session_created_event.rbi +64 -0
- data/rbi/openai/models/realtime/session_update_event.rbi +77 -0
- data/rbi/openai/models/realtime/session_updated_event.rbi +63 -0
- data/rbi/openai/models/realtime/transcription_session_created.rbi +653 -0
- data/rbi/openai/models/realtime/transcription_session_update.rbi +74 -0
- data/rbi/openai/models/realtime/transcription_session_updated_event.rbi +657 -0
- data/rbi/openai/models/responses/response.rbi +10 -4
- data/rbi/openai/models/responses/response_create_params.rbi +16 -10
- data/rbi/openai/models/responses/tool.rbi +2 -348
- data/rbi/openai/models/responses/web_search_preview_tool.rbi +245 -0
- data/rbi/openai/models/responses/web_search_tool.rbi +120 -23
- data/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi +222 -0
- data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +1 -0
- data/rbi/openai/models.rbi +2 -0
- data/rbi/openai/resources/realtime/client_secrets.rbi +38 -0
- data/rbi/openai/resources/realtime.rbi +15 -0
- data/rbi/openai/resources/responses.rbi +12 -6
- data/rbi/openai/resources/webhooks.rbi +1 -0
- data/sig/openai/client.rbs +2 -0
- data/sig/openai/models/audio/speech_create_params.rbs +4 -0
- data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -0
- data/sig/openai/models/realtime/client_secret_create_params.rbs +89 -0
- data/sig/openai/models/realtime/client_secret_create_response.rbs +292 -0
- data/sig/openai/models/realtime/conversation_created_event.rbs +70 -0
- data/sig/openai/models/realtime/conversation_item.rbs +22 -0
- data/sig/openai/models/realtime/conversation_item_added.rbs +37 -0
- data/sig/openai/models/realtime/conversation_item_create_event.rbs +41 -0
- data/sig/openai/models/realtime/conversation_item_created_event.rbs +37 -0
- data/sig/openai/models/realtime/conversation_item_delete_event.rbs +30 -0
- data/sig/openai/models/realtime/conversation_item_deleted_event.rbs +32 -0
- data/sig/openai/models/realtime/conversation_item_done.rbs +37 -0
- data/sig/openai/models/realtime/conversation_item_input_audio_transcription_completed_event.rbs +136 -0
- data/sig/openai/models/realtime/conversation_item_input_audio_transcription_delta_event.rbs +51 -0
- data/sig/openai/models/realtime/conversation_item_input_audio_transcription_failed_event.rbs +77 -0
- data/sig/openai/models/realtime/conversation_item_input_audio_transcription_segment.rbs +62 -0
- data/sig/openai/models/realtime/conversation_item_retrieve_event.rbs +34 -0
- data/sig/openai/models/realtime/conversation_item_truncate_event.rbs +44 -0
- data/sig/openai/models/realtime/conversation_item_truncated_event.rbs +42 -0
- data/sig/openai/models/realtime/conversation_item_with_reference.rbs +207 -0
- data/sig/openai/models/realtime/input_audio_buffer_append_event.rbs +30 -0
- data/sig/openai/models/realtime/input_audio_buffer_clear_event.rbs +23 -0
- data/sig/openai/models/realtime/input_audio_buffer_cleared_event.rbs +24 -0
- data/sig/openai/models/realtime/input_audio_buffer_commit_event.rbs +23 -0
- data/sig/openai/models/realtime/input_audio_buffer_committed_event.rbs +37 -0
- data/sig/openai/models/realtime/input_audio_buffer_speech_started_event.rbs +37 -0
- data/sig/openai/models/realtime/input_audio_buffer_speech_stopped_event.rbs +37 -0
- data/sig/openai/models/realtime/input_audio_buffer_timeout_triggered.rbs +42 -0
- data/sig/openai/models/realtime/log_prob_properties.rbs +28 -0
- data/sig/openai/models/realtime/mcp_list_tools_completed.rbs +28 -0
- data/sig/openai/models/realtime/mcp_list_tools_failed.rbs +28 -0
- data/sig/openai/models/realtime/mcp_list_tools_in_progress.rbs +32 -0
- data/sig/openai/models/realtime/output_audio_buffer_clear_event.rbs +23 -0
- data/sig/openai/models/realtime/rate_limits_updated_event.rbs +85 -0
- data/sig/openai/models/realtime/realtime_audio_config.rbs +354 -0
- data/sig/openai/models/realtime/realtime_client_event.rbs +25 -0
- data/sig/openai/models/realtime/realtime_client_secret_config.rbs +60 -0
- data/sig/openai/models/realtime/realtime_conversation_item_assistant_message.rbs +117 -0
- data/sig/openai/models/realtime/realtime_conversation_item_function_call.rbs +86 -0
- data/sig/openai/models/realtime/realtime_conversation_item_function_call_output.rbs +79 -0
- data/sig/openai/models/realtime/realtime_conversation_item_system_message.rbs +117 -0
- data/sig/openai/models/realtime/realtime_conversation_item_user_message.rbs +132 -0
- data/sig/openai/models/realtime/realtime_error.rbs +42 -0
- data/sig/openai/models/realtime/realtime_error_event.rbs +32 -0
- data/sig/openai/models/realtime/realtime_mcp_approval_request.rbs +42 -0
- data/sig/openai/models/realtime/realtime_mcp_approval_response.rbs +42 -0
- data/sig/openai/models/realtime/realtime_mcp_list_tools.rbs +71 -0
- data/sig/openai/models/realtime/realtime_mcp_protocol_error.rbs +28 -0
- data/sig/openai/models/realtime/realtime_mcp_tool_call.rbs +68 -0
- data/sig/openai/models/realtime/realtime_mcp_tool_execution_error.rbs +18 -0
- data/sig/openai/models/realtime/realtime_mcphttp_error.rbs +24 -0
- data/sig/openai/models/realtime/realtime_response.rbs +210 -0
- data/sig/openai/models/realtime/realtime_response_status.rbs +90 -0
- data/sig/openai/models/realtime/realtime_response_usage.rbs +56 -0
- data/sig/openai/models/realtime/realtime_response_usage_input_token_details.rbs +34 -0
- data/sig/openai/models/realtime/realtime_response_usage_output_token_details.rbs +22 -0
- data/sig/openai/models/realtime/realtime_server_event.rbs +168 -0
- data/sig/openai/models/realtime/realtime_session.rbs +521 -0
- data/sig/openai/models/realtime/realtime_session_create_request.rbs +178 -0
- data/sig/openai/models/realtime/realtime_session_create_response.rbs +526 -0
- data/sig/openai/models/realtime/realtime_tool_choice_config.rbs +16 -0
- data/sig/openai/models/realtime/realtime_tools_config.rbs +10 -0
- data/sig/openai/models/realtime/realtime_tools_config_union.rbs +280 -0
- data/sig/openai/models/realtime/realtime_tracing_config.rbs +43 -0
- data/sig/openai/models/realtime/realtime_transcription_session_create_request.rbs +242 -0
- data/sig/openai/models/realtime/realtime_truncation.rbs +53 -0
- data/sig/openai/models/realtime/response_audio_delta_event.rbs +52 -0
- data/sig/openai/models/realtime/response_audio_done_event.rbs +47 -0
- data/sig/openai/models/realtime/response_audio_transcript_delta_event.rbs +52 -0
- data/sig/openai/models/realtime/response_audio_transcript_done_event.rbs +52 -0
- data/sig/openai/models/realtime/response_cancel_event.rbs +32 -0
- data/sig/openai/models/realtime/response_content_part_added_event.rbs +105 -0
- data/sig/openai/models/realtime/response_content_part_done_event.rbs +105 -0
- data/sig/openai/models/realtime/response_create_event.rbs +281 -0
- data/sig/openai/models/realtime/response_created_event.rbs +32 -0
- data/sig/openai/models/realtime/response_done_event.rbs +32 -0
- data/sig/openai/models/realtime/response_function_call_arguments_delta_event.rbs +52 -0
- data/sig/openai/models/realtime/response_function_call_arguments_done_event.rbs +52 -0
- data/sig/openai/models/realtime/response_mcp_call_arguments_delta.rbs +52 -0
- data/sig/openai/models/realtime/response_mcp_call_arguments_done.rbs +47 -0
- data/sig/openai/models/realtime/response_mcp_call_completed.rbs +37 -0
- data/sig/openai/models/realtime/response_mcp_call_failed.rbs +37 -0
- data/sig/openai/models/realtime/response_mcp_call_in_progress.rbs +37 -0
- data/sig/openai/models/realtime/response_output_item_added_event.rbs +42 -0
- data/sig/openai/models/realtime/response_output_item_done_event.rbs +42 -0
- data/sig/openai/models/realtime/response_text_delta_event.rbs +52 -0
- data/sig/openai/models/realtime/response_text_done_event.rbs +52 -0
- data/sig/openai/models/realtime/session_created_event.rbs +32 -0
- data/sig/openai/models/realtime/session_update_event.rbs +34 -0
- data/sig/openai/models/realtime/session_updated_event.rbs +32 -0
- data/sig/openai/models/realtime/transcription_session_created.rbs +282 -0
- data/sig/openai/models/realtime/transcription_session_update.rbs +34 -0
- data/sig/openai/models/realtime/transcription_session_updated_event.rbs +282 -0
- data/sig/openai/models/responses/tool.rbs +1 -121
- data/sig/openai/models/responses/web_search_preview_tool.rbs +96 -0
- data/sig/openai/models/responses/web_search_tool.rbs +39 -10
- data/sig/openai/models/webhooks/realtime_call_incoming_webhook_event.rbs +90 -0
- data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +1 -0
- data/sig/openai/models.rbs +2 -0
- data/sig/openai/resources/realtime/client_secrets.rbs +15 -0
- data/sig/openai/resources/realtime.rbs +9 -0
- data/sig/openai/resources/webhooks.rbs +1 -0
- metadata +287 -2
@@ -0,0 +1,696 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Realtime
|
6
|
+
class RealtimeSession < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute id
|
8
|
+
# Unique identifier for the session that looks like `sess_1234567890abcdef`.
|
9
|
+
#
|
10
|
+
# @return [String, nil]
|
11
|
+
optional :id, String
|
12
|
+
|
13
|
+
# @!attribute expires_at
|
14
|
+
# Expiration timestamp for the session, in seconds since epoch.
|
15
|
+
#
|
16
|
+
# @return [Integer, nil]
|
17
|
+
optional :expires_at, Integer
|
18
|
+
|
19
|
+
# @!attribute include
|
20
|
+
# Additional fields to include in server outputs.
|
21
|
+
#
|
22
|
+
# - `item.input_audio_transcription.logprobs`: Include logprobs for input audio
|
23
|
+
# transcription.
|
24
|
+
#
|
25
|
+
# @return [Array<Symbol, OpenAI::Models::Realtime::RealtimeSession::Include>, nil]
|
26
|
+
optional :include,
|
27
|
+
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeSession::Include] },
|
28
|
+
nil?: true
|
29
|
+
|
30
|
+
# @!attribute input_audio_format
|
31
|
+
# The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
|
32
|
+
# `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
|
33
|
+
# (mono), and little-endian byte order.
|
34
|
+
#
|
35
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeSession::InputAudioFormat, nil]
|
36
|
+
optional :input_audio_format, enum: -> { OpenAI::Realtime::RealtimeSession::InputAudioFormat }
|
37
|
+
|
38
|
+
# @!attribute input_audio_noise_reduction
|
39
|
+
# Configuration for input audio noise reduction. This can be set to `null` to turn
|
40
|
+
# off. Noise reduction filters audio added to the input audio buffer before it is
|
41
|
+
# sent to VAD and the model. Filtering the audio can improve VAD and turn
|
42
|
+
# detection accuracy (reducing false positives) and model performance by improving
|
43
|
+
# perception of the input audio.
|
44
|
+
#
|
45
|
+
# @return [OpenAI::Models::Realtime::RealtimeSession::InputAudioNoiseReduction, nil]
|
46
|
+
optional :input_audio_noise_reduction, -> { OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction }
|
47
|
+
|
48
|
+
# @!attribute input_audio_transcription
|
49
|
+
# Configuration for input audio transcription, defaults to off and can be set to
|
50
|
+
# `null` to turn off once on. Input audio transcription is not native to the
|
51
|
+
# model, since the model consumes audio directly. Transcription runs
|
52
|
+
# asynchronously through
|
53
|
+
# [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
|
54
|
+
# and should be treated as guidance of input audio content rather than precisely
|
55
|
+
# what the model heard. The client can optionally set the language and prompt for
|
56
|
+
# transcription, these offer additional guidance to the transcription service.
|
57
|
+
#
|
58
|
+
# @return [OpenAI::Models::Realtime::RealtimeSession::InputAudioTranscription, nil]
|
59
|
+
optional :input_audio_transcription,
|
60
|
+
-> { OpenAI::Realtime::RealtimeSession::InputAudioTranscription },
|
61
|
+
nil?: true
|
62
|
+
|
63
|
+
# @!attribute instructions
|
64
|
+
# The default system instructions (i.e. system message) prepended to model calls.
|
65
|
+
# This field allows the client to guide the model on desired responses. The model
|
66
|
+
# can be instructed on response content and format, (e.g. "be extremely succinct",
|
67
|
+
# "act friendly", "here are examples of good responses") and on audio behavior
|
68
|
+
# (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
|
69
|
+
# instructions are not guaranteed to be followed by the model, but they provide
|
70
|
+
# guidance to the model on the desired behavior.
|
71
|
+
#
|
72
|
+
# Note that the server sets default instructions which will be used if this field
|
73
|
+
# is not set and are visible in the `session.created` event at the start of the
|
74
|
+
# session.
|
75
|
+
#
|
76
|
+
# @return [String, nil]
|
77
|
+
optional :instructions, String
|
78
|
+
|
79
|
+
# @!attribute max_response_output_tokens
|
80
|
+
# Maximum number of output tokens for a single assistant response, inclusive of
|
81
|
+
# tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
|
82
|
+
# `inf` for the maximum available tokens for a given model. Defaults to `inf`.
|
83
|
+
#
|
84
|
+
# @return [Integer, Symbol, :inf, nil]
|
85
|
+
optional :max_response_output_tokens,
|
86
|
+
union: -> { OpenAI::Realtime::RealtimeSession::MaxResponseOutputTokens }
|
87
|
+
|
88
|
+
# @!attribute modalities
|
89
|
+
# The set of modalities the model can respond with. To disable audio, set this to
|
90
|
+
# ["text"].
|
91
|
+
#
|
92
|
+
# @return [Array<Symbol, OpenAI::Models::Realtime::RealtimeSession::Modality>, nil]
|
93
|
+
optional :modalities,
|
94
|
+
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeSession::Modality] }
|
95
|
+
|
96
|
+
# @!attribute model
|
97
|
+
# The Realtime model used for this session.
|
98
|
+
#
|
99
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeSession::Model, nil]
|
100
|
+
optional :model, enum: -> { OpenAI::Realtime::RealtimeSession::Model }
|
101
|
+
|
102
|
+
# @!attribute object
|
103
|
+
# The object type. Always `realtime.session`.
|
104
|
+
#
|
105
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeSession::Object, nil]
|
106
|
+
optional :object, enum: -> { OpenAI::Realtime::RealtimeSession::Object }
|
107
|
+
|
108
|
+
# @!attribute output_audio_format
|
109
|
+
# The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
110
|
+
# For `pcm16`, output audio is sampled at a rate of 24kHz.
|
111
|
+
#
|
112
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeSession::OutputAudioFormat, nil]
|
113
|
+
optional :output_audio_format, enum: -> { OpenAI::Realtime::RealtimeSession::OutputAudioFormat }
|
114
|
+
|
115
|
+
# @!attribute prompt
|
116
|
+
# Reference to a prompt template and its variables.
|
117
|
+
# [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
|
118
|
+
#
|
119
|
+
# @return [OpenAI::Models::Responses::ResponsePrompt, nil]
|
120
|
+
optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true
|
121
|
+
|
122
|
+
# @!attribute speed
|
123
|
+
# The speed of the model's spoken response. 1.0 is the default speed. 0.25 is the
|
124
|
+
# minimum speed. 1.5 is the maximum speed. This value can only be changed in
|
125
|
+
# between model turns, not while a response is in progress.
|
126
|
+
#
|
127
|
+
# @return [Float, nil]
|
128
|
+
optional :speed, Float
|
129
|
+
|
130
|
+
# @!attribute temperature
|
131
|
+
# Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a
|
132
|
+
# temperature of 0.8 is highly recommended for best performance.
|
133
|
+
#
|
134
|
+
# @return [Float, nil]
|
135
|
+
optional :temperature, Float
|
136
|
+
|
137
|
+
# @!attribute tool_choice
|
138
|
+
# How the model chooses tools. Options are `auto`, `none`, `required`, or specify
|
139
|
+
# a function.
|
140
|
+
#
|
141
|
+
# @return [String, nil]
|
142
|
+
optional :tool_choice, String
|
143
|
+
|
144
|
+
# @!attribute tools
|
145
|
+
# Tools (functions) available to the model.
|
146
|
+
#
|
147
|
+
# @return [Array<OpenAI::Models::Realtime::RealtimeSession::Tool>, nil]
|
148
|
+
optional :tools, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Realtime::RealtimeSession::Tool] }
|
149
|
+
|
150
|
+
# @!attribute tracing
|
151
|
+
# Configuration options for tracing. Set to null to disable tracing. Once tracing
|
152
|
+
# is enabled for a session, the configuration cannot be modified.
|
153
|
+
#
|
154
|
+
# `auto` will create a trace for the session with default values for the workflow
|
155
|
+
# name, group id, and metadata.
|
156
|
+
#
|
157
|
+
# @return [Symbol, :auto, OpenAI::Models::Realtime::RealtimeSession::Tracing::TracingConfiguration, nil]
|
158
|
+
optional :tracing, union: -> { OpenAI::Realtime::RealtimeSession::Tracing }, nil?: true
|
159
|
+
|
160
|
+
# @!attribute turn_detection
|
161
|
+
# Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
|
162
|
+
# set to `null` to turn off, in which case the client must manually trigger model
|
163
|
+
# response. Server VAD means that the model will detect the start and end of
|
164
|
+
# speech based on audio volume and respond at the end of user speech. Semantic VAD
|
165
|
+
# is more advanced and uses a turn detection model (in conjunction with VAD) to
|
166
|
+
# semantically estimate whether the user has finished speaking, then dynamically
|
167
|
+
# sets a timeout based on this probability. For example, if user audio trails off
|
168
|
+
# with "uhhm", the model will score a low probability of turn end and wait longer
|
169
|
+
# for the user to continue speaking. This can be useful for more natural
|
170
|
+
# conversations, but may have a higher latency.
|
171
|
+
#
|
172
|
+
# @return [OpenAI::Models::Realtime::RealtimeSession::TurnDetection, nil]
|
173
|
+
optional :turn_detection, -> { OpenAI::Realtime::RealtimeSession::TurnDetection }, nil?: true
|
174
|
+
|
175
|
+
# @!attribute voice
|
176
|
+
# The voice the model uses to respond. Voice cannot be changed during the session
|
177
|
+
# once the model has responded with audio at least once. Current voice options are
|
178
|
+
# `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
|
179
|
+
#
|
180
|
+
# @return [String, Symbol, OpenAI::Models::Realtime::RealtimeSession::Voice, nil]
|
181
|
+
optional :voice, union: -> { OpenAI::Realtime::RealtimeSession::Voice }
|
182
|
+
|
183
|
+
# @!method initialize(id: nil, expires_at: nil, include: nil, input_audio_format: nil, input_audio_noise_reduction: nil, input_audio_transcription: nil, instructions: nil, max_response_output_tokens: nil, modalities: nil, model: nil, object: nil, output_audio_format: nil, prompt: nil, speed: nil, temperature: nil, tool_choice: nil, tools: nil, tracing: nil, turn_detection: nil, voice: nil)
|
184
|
+
# Some parameter documentations has been truncated, see
|
185
|
+
# {OpenAI::Models::Realtime::RealtimeSession} for more details.
|
186
|
+
#
|
187
|
+
# Realtime session object.
|
188
|
+
#
|
189
|
+
# @param id [String] Unique identifier for the session that looks like `sess_1234567890abcdef`.
|
190
|
+
#
|
191
|
+
# @param expires_at [Integer] Expiration timestamp for the session, in seconds since epoch.
|
192
|
+
#
|
193
|
+
# @param include [Array<Symbol, OpenAI::Models::Realtime::RealtimeSession::Include>, nil] Additional fields to include in server outputs.
|
194
|
+
#
|
195
|
+
# @param input_audio_format [Symbol, OpenAI::Models::Realtime::RealtimeSession::InputAudioFormat] The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
196
|
+
#
|
197
|
+
# @param input_audio_noise_reduction [OpenAI::Models::Realtime::RealtimeSession::InputAudioNoiseReduction] Configuration for input audio noise reduction. This can be set to `null` to turn
|
198
|
+
#
|
199
|
+
# @param input_audio_transcription [OpenAI::Models::Realtime::RealtimeSession::InputAudioTranscription, nil] Configuration for input audio transcription, defaults to off and can be set to `
|
200
|
+
#
|
201
|
+
# @param instructions [String] The default system instructions (i.e. system message) prepended to model
|
202
|
+
#
|
203
|
+
# @param max_response_output_tokens [Integer, Symbol, :inf] Maximum number of output tokens for a single assistant response,
|
204
|
+
#
|
205
|
+
# @param modalities [Array<Symbol, OpenAI::Models::Realtime::RealtimeSession::Modality>] The set of modalities the model can respond with. To disable audio,
|
206
|
+
#
|
207
|
+
# @param model [Symbol, OpenAI::Models::Realtime::RealtimeSession::Model] The Realtime model used for this session.
|
208
|
+
#
|
209
|
+
# @param object [Symbol, OpenAI::Models::Realtime::RealtimeSession::Object] The object type. Always `realtime.session`.
|
210
|
+
#
|
211
|
+
# @param output_audio_format [Symbol, OpenAI::Models::Realtime::RealtimeSession::OutputAudioFormat] The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
212
|
+
#
|
213
|
+
# @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables.
|
214
|
+
#
|
215
|
+
# @param speed [Float] The speed of the model's spoken response. 1.0 is the default speed. 0.25 is
|
216
|
+
#
|
217
|
+
# @param temperature [Float] Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a te
|
218
|
+
#
|
219
|
+
# @param tool_choice [String] How the model chooses tools. Options are `auto`, `none`, `required`, or
|
220
|
+
#
|
221
|
+
# @param tools [Array<OpenAI::Models::Realtime::RealtimeSession::Tool>] Tools (functions) available to the model.
|
222
|
+
#
|
223
|
+
# @param tracing [Symbol, :auto, OpenAI::Models::Realtime::RealtimeSession::Tracing::TracingConfiguration, nil] Configuration options for tracing. Set to null to disable tracing. Once
|
224
|
+
#
|
225
|
+
# @param turn_detection [OpenAI::Models::Realtime::RealtimeSession::TurnDetection, nil] Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
|
226
|
+
#
|
227
|
+
# @param voice [String, Symbol, OpenAI::Models::Realtime::RealtimeSession::Voice] The voice the model uses to respond. Voice cannot be changed during the
|
228
|
+
|
229
|
+
module Include
|
230
|
+
extend OpenAI::Internal::Type::Enum
|
231
|
+
|
232
|
+
ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS = :"item.input_audio_transcription.logprobs"
|
233
|
+
|
234
|
+
# @!method self.values
|
235
|
+
# @return [Array<Symbol>]
|
236
|
+
end
|
237
|
+
|
238
|
+
# The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
|
239
|
+
# `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
|
240
|
+
# (mono), and little-endian byte order.
|
241
|
+
#
|
242
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#input_audio_format
|
243
|
+
module InputAudioFormat
|
244
|
+
extend OpenAI::Internal::Type::Enum
|
245
|
+
|
246
|
+
PCM16 = :pcm16
|
247
|
+
G711_ULAW = :g711_ulaw
|
248
|
+
G711_ALAW = :g711_alaw
|
249
|
+
|
250
|
+
# @!method self.values
|
251
|
+
# @return [Array<Symbol>]
|
252
|
+
end
|
253
|
+
|
254
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#input_audio_noise_reduction
|
255
|
+
class InputAudioNoiseReduction < OpenAI::Internal::Type::BaseModel
|
256
|
+
# @!attribute type
|
257
|
+
# Type of noise reduction. `near_field` is for close-talking microphones such as
|
258
|
+
# headphones, `far_field` is for far-field microphones such as laptop or
|
259
|
+
# conference room microphones.
|
260
|
+
#
|
261
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeSession::InputAudioNoiseReduction::Type, nil]
|
262
|
+
optional :type, enum: -> { OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type }
|
263
|
+
|
264
|
+
# @!method initialize(type: nil)
|
265
|
+
# Some parameter documentations has been truncated, see
|
266
|
+
# {OpenAI::Models::Realtime::RealtimeSession::InputAudioNoiseReduction} for more
|
267
|
+
# details.
|
268
|
+
#
|
269
|
+
# Configuration for input audio noise reduction. This can be set to `null` to turn
|
270
|
+
# off. Noise reduction filters audio added to the input audio buffer before it is
|
271
|
+
# sent to VAD and the model. Filtering the audio can improve VAD and turn
|
272
|
+
# detection accuracy (reducing false positives) and model performance by improving
|
273
|
+
# perception of the input audio.
|
274
|
+
#
|
275
|
+
# @param type [Symbol, OpenAI::Models::Realtime::RealtimeSession::InputAudioNoiseReduction::Type] Type of noise reduction. `near_field` is for close-talking microphones such as h
|
276
|
+
|
277
|
+
# Type of noise reduction. `near_field` is for close-talking microphones such as
|
278
|
+
# headphones, `far_field` is for far-field microphones such as laptop or
|
279
|
+
# conference room microphones.
|
280
|
+
#
|
281
|
+
# @see OpenAI::Models::Realtime::RealtimeSession::InputAudioNoiseReduction#type
|
282
|
+
module Type
|
283
|
+
extend OpenAI::Internal::Type::Enum
|
284
|
+
|
285
|
+
NEAR_FIELD = :near_field
|
286
|
+
FAR_FIELD = :far_field
|
287
|
+
|
288
|
+
# @!method self.values
|
289
|
+
# @return [Array<Symbol>]
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#input_audio_transcription
|
294
|
+
class InputAudioTranscription < OpenAI::Internal::Type::BaseModel
|
295
|
+
# @!attribute language
|
296
|
+
# The language of the input audio. Supplying the input language in
|
297
|
+
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
|
298
|
+
# format will improve accuracy and latency.
|
299
|
+
#
|
300
|
+
# @return [String, nil]
|
301
|
+
optional :language, String
|
302
|
+
|
303
|
+
# @!attribute model
|
304
|
+
# The model to use for transcription, current options are `gpt-4o-transcribe`,
|
305
|
+
# `gpt-4o-mini-transcribe`, and `whisper-1`.
|
306
|
+
#
|
307
|
+
# @return [String, nil]
|
308
|
+
optional :model, String
|
309
|
+
|
310
|
+
# @!attribute prompt
|
311
|
+
# An optional text to guide the model's style or continue a previous audio
|
312
|
+
# segment. For `whisper-1`, the
|
313
|
+
# [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
|
314
|
+
# For `gpt-4o-transcribe` models, the prompt is a free text string, for example
|
315
|
+
# "expect words related to technology".
|
316
|
+
#
|
317
|
+
# @return [String, nil]
|
318
|
+
optional :prompt, String
|
319
|
+
|
320
|
+
# @!method initialize(language: nil, model: nil, prompt: nil)
|
321
|
+
# Some parameter documentations has been truncated, see
|
322
|
+
# {OpenAI::Models::Realtime::RealtimeSession::InputAudioTranscription} for more
|
323
|
+
# details.
|
324
|
+
#
|
325
|
+
# Configuration for input audio transcription, defaults to off and can be set to
|
326
|
+
# `null` to turn off once on. Input audio transcription is not native to the
|
327
|
+
# model, since the model consumes audio directly. Transcription runs
|
328
|
+
# asynchronously through
|
329
|
+
# [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
|
330
|
+
# and should be treated as guidance of input audio content rather than precisely
|
331
|
+
# what the model heard. The client can optionally set the language and prompt for
|
332
|
+
# transcription, these offer additional guidance to the transcription service.
|
333
|
+
#
|
334
|
+
# @param language [String] The language of the input audio. Supplying the input language in
|
335
|
+
#
|
336
|
+
# @param model [String] The model to use for transcription, current options are `gpt-4o-transcribe`, `gp
|
337
|
+
#
|
338
|
+
# @param prompt [String] An optional text to guide the model's style or continue a previous audio
|
339
|
+
end
|
340
|
+
|
341
|
+
# Maximum number of output tokens for a single assistant response, inclusive of
|
342
|
+
# tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
|
343
|
+
# `inf` for the maximum available tokens for a given model. Defaults to `inf`.
|
344
|
+
#
|
345
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#max_response_output_tokens
|
346
|
+
module MaxResponseOutputTokens
|
347
|
+
extend OpenAI::Internal::Type::Union
|
348
|
+
|
349
|
+
variant Integer
|
350
|
+
|
351
|
+
variant const: :inf
|
352
|
+
|
353
|
+
# @!method self.variants
|
354
|
+
# @return [Array(Integer, Symbol, :inf)]
|
355
|
+
end
|
356
|
+
|
357
|
+
module Modality
|
358
|
+
extend OpenAI::Internal::Type::Enum
|
359
|
+
|
360
|
+
TEXT = :text
|
361
|
+
AUDIO = :audio
|
362
|
+
|
363
|
+
# @!method self.values
|
364
|
+
# @return [Array<Symbol>]
|
365
|
+
end
|
366
|
+
|
367
|
+
# The Realtime model used for this session.
|
368
|
+
#
|
369
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#model
|
370
|
+
module Model
|
371
|
+
extend OpenAI::Internal::Type::Enum
|
372
|
+
|
373
|
+
GPT_4O_REALTIME_PREVIEW = :"gpt-4o-realtime-preview"
|
374
|
+
GPT_4O_REALTIME_PREVIEW_2024_10_01 = :"gpt-4o-realtime-preview-2024-10-01"
|
375
|
+
GPT_4O_REALTIME_PREVIEW_2024_12_17 = :"gpt-4o-realtime-preview-2024-12-17"
|
376
|
+
GPT_4O_REALTIME_PREVIEW_2025_06_03 = :"gpt-4o-realtime-preview-2025-06-03"
|
377
|
+
GPT_4O_MINI_REALTIME_PREVIEW = :"gpt-4o-mini-realtime-preview"
|
378
|
+
GPT_4O_MINI_REALTIME_PREVIEW_2024_12_17 = :"gpt-4o-mini-realtime-preview-2024-12-17"
|
379
|
+
|
380
|
+
# @!method self.values
|
381
|
+
# @return [Array<Symbol>]
|
382
|
+
end
|
383
|
+
|
384
|
+
# The object type. Always `realtime.session`.
|
385
|
+
#
|
386
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#object
|
387
|
+
module Object
|
388
|
+
extend OpenAI::Internal::Type::Enum
|
389
|
+
|
390
|
+
REALTIME_SESSION = :"realtime.session"
|
391
|
+
|
392
|
+
# @!method self.values
|
393
|
+
# @return [Array<Symbol>]
|
394
|
+
end
|
395
|
+
|
396
|
+
# The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
397
|
+
# For `pcm16`, output audio is sampled at a rate of 24kHz.
|
398
|
+
#
|
399
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#output_audio_format
|
400
|
+
module OutputAudioFormat
|
401
|
+
extend OpenAI::Internal::Type::Enum
|
402
|
+
|
403
|
+
PCM16 = :pcm16
|
404
|
+
G711_ULAW = :g711_ulaw
|
405
|
+
G711_ALAW = :g711_alaw
|
406
|
+
|
407
|
+
# @!method self.values
|
408
|
+
# @return [Array<Symbol>]
|
409
|
+
end
|
410
|
+
|
411
|
+
class Tool < OpenAI::Internal::Type::BaseModel
|
412
|
+
# @!attribute description
|
413
|
+
# The description of the function, including guidance on when and how to call it,
|
414
|
+
# and guidance about what to tell the user when calling (if anything).
|
415
|
+
#
|
416
|
+
# @return [String, nil]
|
417
|
+
optional :description, String
|
418
|
+
|
419
|
+
# @!attribute name
|
420
|
+
# The name of the function.
|
421
|
+
#
|
422
|
+
# @return [String, nil]
|
423
|
+
optional :name, String
|
424
|
+
|
425
|
+
# @!attribute parameters
|
426
|
+
# Parameters of the function in JSON Schema.
|
427
|
+
#
|
428
|
+
# @return [Object, nil]
|
429
|
+
optional :parameters, OpenAI::Internal::Type::Unknown
|
430
|
+
|
431
|
+
# @!attribute type
|
432
|
+
# The type of the tool, i.e. `function`.
|
433
|
+
#
|
434
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeSession::Tool::Type, nil]
|
435
|
+
optional :type, enum: -> { OpenAI::Realtime::RealtimeSession::Tool::Type }
|
436
|
+
|
437
|
+
# @!method initialize(description: nil, name: nil, parameters: nil, type: nil)
|
438
|
+
# Some parameter documentations has been truncated, see
|
439
|
+
# {OpenAI::Models::Realtime::RealtimeSession::Tool} for more details.
|
440
|
+
#
|
441
|
+
# @param description [String] The description of the function, including guidance on when and how
|
442
|
+
#
|
443
|
+
# @param name [String] The name of the function.
|
444
|
+
#
|
445
|
+
# @param parameters [Object] Parameters of the function in JSON Schema.
|
446
|
+
#
|
447
|
+
# @param type [Symbol, OpenAI::Models::Realtime::RealtimeSession::Tool::Type] The type of the tool, i.e. `function`.
|
448
|
+
|
449
|
+
# The type of the tool, i.e. `function`.
|
450
|
+
#
|
451
|
+
# @see OpenAI::Models::Realtime::RealtimeSession::Tool#type
|
452
|
+
module Type
|
453
|
+
extend OpenAI::Internal::Type::Enum
|
454
|
+
|
455
|
+
FUNCTION = :function
|
456
|
+
|
457
|
+
# @!method self.values
|
458
|
+
# @return [Array<Symbol>]
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
# Configuration options for tracing. Set to null to disable tracing. Once tracing
|
463
|
+
# is enabled for a session, the configuration cannot be modified.
|
464
|
+
#
|
465
|
+
# `auto` will create a trace for the session with default values for the workflow
|
466
|
+
# name, group id, and metadata.
|
467
|
+
#
|
468
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#tracing
|
469
|
+
module Tracing
|
470
|
+
extend OpenAI::Internal::Type::Union
|
471
|
+
|
472
|
+
# Default tracing mode for the session.
|
473
|
+
variant const: :auto
|
474
|
+
|
475
|
+
# Granular configuration for tracing.
|
476
|
+
variant -> { OpenAI::Realtime::RealtimeSession::Tracing::TracingConfiguration }
|
477
|
+
|
478
|
+
class TracingConfiguration < OpenAI::Internal::Type::BaseModel
|
479
|
+
# @!attribute group_id
|
480
|
+
# The group id to attach to this trace to enable filtering and grouping in the
|
481
|
+
# traces dashboard.
|
482
|
+
#
|
483
|
+
# @return [String, nil]
|
484
|
+
optional :group_id, String
|
485
|
+
|
486
|
+
# @!attribute metadata
|
487
|
+
# The arbitrary metadata to attach to this trace to enable filtering in the traces
|
488
|
+
# dashboard.
|
489
|
+
#
|
490
|
+
# @return [Object, nil]
|
491
|
+
optional :metadata, OpenAI::Internal::Type::Unknown
|
492
|
+
|
493
|
+
# @!attribute workflow_name
|
494
|
+
# The name of the workflow to attach to this trace. This is used to name the trace
|
495
|
+
# in the traces dashboard.
|
496
|
+
#
|
497
|
+
# @return [String, nil]
|
498
|
+
optional :workflow_name, String
|
499
|
+
|
500
|
+
# @!method initialize(group_id: nil, metadata: nil, workflow_name: nil)
|
501
|
+
# Some parameter documentations has been truncated, see
|
502
|
+
# {OpenAI::Models::Realtime::RealtimeSession::Tracing::TracingConfiguration} for
|
503
|
+
# more details.
|
504
|
+
#
|
505
|
+
# Granular configuration for tracing.
|
506
|
+
#
|
507
|
+
# @param group_id [String] The group id to attach to this trace to enable filtering and
|
508
|
+
#
|
509
|
+
# @param metadata [Object] The arbitrary metadata to attach to this trace to enable
|
510
|
+
#
|
511
|
+
# @param workflow_name [String] The name of the workflow to attach to this trace. This is used to
|
512
|
+
end
|
513
|
+
|
514
|
+
# @!method self.variants
|
515
|
+
# @return [Array(Symbol, :auto, OpenAI::Models::Realtime::RealtimeSession::Tracing::TracingConfiguration)]
|
516
|
+
end
|
517
|
+
|
518
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#turn_detection
|
519
|
+
class TurnDetection < OpenAI::Internal::Type::BaseModel
|
520
|
+
# @!attribute create_response
|
521
|
+
# Whether or not to automatically generate a response when a VAD stop event
|
522
|
+
# occurs.
|
523
|
+
#
|
524
|
+
# @return [Boolean, nil]
|
525
|
+
optional :create_response, OpenAI::Internal::Type::Boolean
|
526
|
+
|
527
|
+
# @!attribute eagerness
|
528
|
+
# Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
|
529
|
+
# will wait longer for the user to continue speaking, `high` will respond more
|
530
|
+
# quickly. `auto` is the default and is equivalent to `medium`.
|
531
|
+
#
|
532
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeSession::TurnDetection::Eagerness, nil]
|
533
|
+
optional :eagerness, enum: -> { OpenAI::Realtime::RealtimeSession::TurnDetection::Eagerness }
|
534
|
+
|
535
|
+
# @!attribute idle_timeout_ms
|
536
|
+
# Optional idle timeout after which turn detection will auto-timeout when no
|
537
|
+
# additional audio is received.
|
538
|
+
#
|
539
|
+
# @return [Integer, nil]
|
540
|
+
optional :idle_timeout_ms, Integer, nil?: true
|
541
|
+
|
542
|
+
# @!attribute interrupt_response
|
543
|
+
# Whether or not to automatically interrupt any ongoing response with output to
|
544
|
+
# the default conversation (i.e. `conversation` of `auto`) when a VAD start event
|
545
|
+
# occurs.
|
546
|
+
#
|
547
|
+
# @return [Boolean, nil]
|
548
|
+
optional :interrupt_response, OpenAI::Internal::Type::Boolean
|
549
|
+
|
550
|
+
# @!attribute prefix_padding_ms
|
551
|
+
# Used only for `server_vad` mode. Amount of audio to include before the VAD
|
552
|
+
# detected speech (in milliseconds). Defaults to 300ms.
|
553
|
+
#
|
554
|
+
# @return [Integer, nil]
|
555
|
+
optional :prefix_padding_ms, Integer
|
556
|
+
|
557
|
+
# @!attribute silence_duration_ms
|
558
|
+
# Used only for `server_vad` mode. Duration of silence to detect speech stop (in
|
559
|
+
# milliseconds). Defaults to 500ms. With shorter values the model will respond
|
560
|
+
# more quickly, but may jump in on short pauses from the user.
|
561
|
+
#
|
562
|
+
# @return [Integer, nil]
|
563
|
+
optional :silence_duration_ms, Integer
|
564
|
+
|
565
|
+
# @!attribute threshold
|
566
|
+
# Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
|
567
|
+
# defaults to 0.5. A higher threshold will require louder audio to activate the
|
568
|
+
# model, and thus might perform better in noisy environments.
|
569
|
+
#
|
570
|
+
# @return [Float, nil]
|
571
|
+
optional :threshold, Float
|
572
|
+
|
573
|
+
# @!attribute type
|
574
|
+
# Type of turn detection.
|
575
|
+
#
|
576
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeSession::TurnDetection::Type, nil]
|
577
|
+
optional :type, enum: -> { OpenAI::Realtime::RealtimeSession::TurnDetection::Type }
|
578
|
+
|
579
|
+
# @!method initialize(create_response: nil, eagerness: nil, idle_timeout_ms: nil, interrupt_response: nil, prefix_padding_ms: nil, silence_duration_ms: nil, threshold: nil, type: nil)
|
580
|
+
# Some parameter documentations has been truncated, see
|
581
|
+
# {OpenAI::Models::Realtime::RealtimeSession::TurnDetection} for more details.
|
582
|
+
#
|
583
|
+
# Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
|
584
|
+
# set to `null` to turn off, in which case the client must manually trigger model
|
585
|
+
# response. Server VAD means that the model will detect the start and end of
|
586
|
+
# speech based on audio volume and respond at the end of user speech. Semantic VAD
|
587
|
+
# is more advanced and uses a turn detection model (in conjunction with VAD) to
|
588
|
+
# semantically estimate whether the user has finished speaking, then dynamically
|
589
|
+
# sets a timeout based on this probability. For example, if user audio trails off
|
590
|
+
# with "uhhm", the model will score a low probability of turn end and wait longer
|
591
|
+
# for the user to continue speaking. This can be useful for more natural
|
592
|
+
# conversations, but may have a higher latency.
|
593
|
+
#
|
594
|
+
# @param create_response [Boolean] Whether or not to automatically generate a response when a VAD stop event occurs
|
595
|
+
#
|
596
|
+
# @param eagerness [Symbol, OpenAI::Models::Realtime::RealtimeSession::TurnDetection::Eagerness] Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
|
597
|
+
#
|
598
|
+
# @param idle_timeout_ms [Integer, nil] Optional idle timeout after which turn detection will auto-timeout when
|
599
|
+
#
|
600
|
+
# @param interrupt_response [Boolean] Whether or not to automatically interrupt any ongoing response with output to th
|
601
|
+
#
|
602
|
+
# @param prefix_padding_ms [Integer] Used only for `server_vad` mode. Amount of audio to include before the VAD detec
|
603
|
+
#
|
604
|
+
# @param silence_duration_ms [Integer] Used only for `server_vad` mode. Duration of silence to detect speech stop (in m
|
605
|
+
#
|
606
|
+
# @param threshold [Float] Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
|
607
|
+
#
|
608
|
+
# @param type [Symbol, OpenAI::Models::Realtime::RealtimeSession::TurnDetection::Type] Type of turn detection.
|
609
|
+
|
610
|
+
# Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
|
611
|
+
# will wait longer for the user to continue speaking, `high` will respond more
|
612
|
+
# quickly. `auto` is the default and is equivalent to `medium`.
|
613
|
+
#
|
614
|
+
# @see OpenAI::Models::Realtime::RealtimeSession::TurnDetection#eagerness
|
615
|
+
module Eagerness
|
616
|
+
extend OpenAI::Internal::Type::Enum
|
617
|
+
|
618
|
+
LOW = :low
|
619
|
+
MEDIUM = :medium
|
620
|
+
HIGH = :high
|
621
|
+
AUTO = :auto
|
622
|
+
|
623
|
+
# @!method self.values
|
624
|
+
# @return [Array<Symbol>]
|
625
|
+
end
|
626
|
+
|
627
|
+
# Type of turn detection.
|
628
|
+
#
|
629
|
+
# @see OpenAI::Models::Realtime::RealtimeSession::TurnDetection#type
|
630
|
+
module Type
|
631
|
+
extend OpenAI::Internal::Type::Enum
|
632
|
+
|
633
|
+
SERVER_VAD = :server_vad
|
634
|
+
SEMANTIC_VAD = :semantic_vad
|
635
|
+
|
636
|
+
# @!method self.values
|
637
|
+
# @return [Array<Symbol>]
|
638
|
+
end
|
639
|
+
end
|
640
|
+
|
641
|
+
# The voice the model uses to respond. Voice cannot be changed during the session
|
642
|
+
# once the model has responded with audio at least once. Current voice options are
|
643
|
+
# `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
|
644
|
+
#
|
645
|
+
# @see OpenAI::Models::Realtime::RealtimeSession#voice
|
646
|
+
module Voice
|
647
|
+
extend OpenAI::Internal::Type::Union
|
648
|
+
|
649
|
+
variant String
|
650
|
+
|
651
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::ALLOY }
|
652
|
+
|
653
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::ASH }
|
654
|
+
|
655
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::BALLAD }
|
656
|
+
|
657
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::CORAL }
|
658
|
+
|
659
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::ECHO }
|
660
|
+
|
661
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::SAGE }
|
662
|
+
|
663
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::SHIMMER }
|
664
|
+
|
665
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::VERSE }
|
666
|
+
|
667
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::MARIN }
|
668
|
+
|
669
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeSession::Voice::CEDAR }
|
670
|
+
|
671
|
+
# @!method self.variants
|
672
|
+
# @return [Array(String, Symbol)]
|
673
|
+
|
674
|
+
define_sorbet_constant!(:Variants) do
|
675
|
+
T.type_alias { T.any(String, OpenAI::Realtime::RealtimeSession::Voice::TaggedSymbol) }
|
676
|
+
end
|
677
|
+
|
678
|
+
# @!group
|
679
|
+
|
680
|
+
ALLOY = :alloy
|
681
|
+
ASH = :ash
|
682
|
+
BALLAD = :ballad
|
683
|
+
CORAL = :coral
|
684
|
+
ECHO = :echo
|
685
|
+
SAGE = :sage
|
686
|
+
SHIMMER = :shimmer
|
687
|
+
VERSE = :verse
|
688
|
+
MARIN = :marin
|
689
|
+
CEDAR = :cedar
|
690
|
+
|
691
|
+
# @!endgroup
|
692
|
+
end
|
693
|
+
end
|
694
|
+
end
|
695
|
+
end
|
696
|
+
end
|