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,446 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Realtime
|
6
|
+
class RealtimeAudioConfig < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute input
|
8
|
+
#
|
9
|
+
# @return [OpenAI::Models::Realtime::RealtimeAudioConfig::Input, nil]
|
10
|
+
optional :input, -> { OpenAI::Realtime::RealtimeAudioConfig::Input }
|
11
|
+
|
12
|
+
# @!attribute output
|
13
|
+
#
|
14
|
+
# @return [OpenAI::Models::Realtime::RealtimeAudioConfig::Output, nil]
|
15
|
+
optional :output, -> { OpenAI::Realtime::RealtimeAudioConfig::Output }
|
16
|
+
|
17
|
+
# @!method initialize(input: nil, output: nil)
|
18
|
+
# Configuration for input and output audio.
|
19
|
+
#
|
20
|
+
# @param input [OpenAI::Models::Realtime::RealtimeAudioConfig::Input]
|
21
|
+
# @param output [OpenAI::Models::Realtime::RealtimeAudioConfig::Output]
|
22
|
+
|
23
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig#input
|
24
|
+
class Input < OpenAI::Internal::Type::BaseModel
|
25
|
+
# @!attribute format_
|
26
|
+
# The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
|
27
|
+
# `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
|
28
|
+
# (mono), and little-endian byte order.
|
29
|
+
#
|
30
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::Format, nil]
|
31
|
+
optional :format_,
|
32
|
+
enum: -> {
|
33
|
+
OpenAI::Realtime::RealtimeAudioConfig::Input::Format
|
34
|
+
},
|
35
|
+
api_name: :format
|
36
|
+
|
37
|
+
# @!attribute noise_reduction
|
38
|
+
# Configuration for input audio noise reduction. This can be set to `null` to turn
|
39
|
+
# off. Noise reduction filters audio added to the input audio buffer before it is
|
40
|
+
# sent to VAD and the model. Filtering the audio can improve VAD and turn
|
41
|
+
# detection accuracy (reducing false positives) and model performance by improving
|
42
|
+
# perception of the input audio.
|
43
|
+
#
|
44
|
+
# @return [OpenAI::Models::Realtime::RealtimeAudioConfig::Input::NoiseReduction, nil]
|
45
|
+
optional :noise_reduction, -> { OpenAI::Realtime::RealtimeAudioConfig::Input::NoiseReduction }
|
46
|
+
|
47
|
+
# @!attribute transcription
|
48
|
+
# Configuration for input audio transcription, defaults to off and can be set to
|
49
|
+
# `null` to turn off once on. Input audio transcription is not native to the
|
50
|
+
# model, since the model consumes audio directly. Transcription runs
|
51
|
+
# asynchronously through
|
52
|
+
# [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
|
53
|
+
# and should be treated as guidance of input audio content rather than precisely
|
54
|
+
# what the model heard. The client can optionally set the language and prompt for
|
55
|
+
# transcription, these offer additional guidance to the transcription service.
|
56
|
+
#
|
57
|
+
# @return [OpenAI::Models::Realtime::RealtimeAudioConfig::Input::Transcription, nil]
|
58
|
+
optional :transcription, -> { OpenAI::Realtime::RealtimeAudioConfig::Input::Transcription }
|
59
|
+
|
60
|
+
# @!attribute turn_detection
|
61
|
+
# Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
|
62
|
+
# set to `null` to turn off, in which case the client must manually trigger model
|
63
|
+
# response. Server VAD means that the model will detect the start and end of
|
64
|
+
# speech based on audio volume and respond at the end of user speech. Semantic VAD
|
65
|
+
# is more advanced and uses a turn detection model (in conjunction with VAD) to
|
66
|
+
# semantically estimate whether the user has finished speaking, then dynamically
|
67
|
+
# sets a timeout based on this probability. For example, if user audio trails off
|
68
|
+
# with "uhhm", the model will score a low probability of turn end and wait longer
|
69
|
+
# for the user to continue speaking. This can be useful for more natural
|
70
|
+
# conversations, but may have a higher latency.
|
71
|
+
#
|
72
|
+
# @return [OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection, nil]
|
73
|
+
optional :turn_detection, -> { OpenAI::Realtime::RealtimeAudioConfig::Input::TurnDetection }
|
74
|
+
|
75
|
+
# @!method initialize(format_: nil, noise_reduction: nil, transcription: nil, turn_detection: nil)
|
76
|
+
# Some parameter documentations has been truncated, see
|
77
|
+
# {OpenAI::Models::Realtime::RealtimeAudioConfig::Input} for more details.
|
78
|
+
#
|
79
|
+
# @param format_ [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::Format] The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
80
|
+
#
|
81
|
+
# @param noise_reduction [OpenAI::Models::Realtime::RealtimeAudioConfig::Input::NoiseReduction] Configuration for input audio noise reduction. This can be set to `null` to turn
|
82
|
+
#
|
83
|
+
# @param transcription [OpenAI::Models::Realtime::RealtimeAudioConfig::Input::Transcription] Configuration for input audio transcription, defaults to off and can be set to `
|
84
|
+
#
|
85
|
+
# @param turn_detection [OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection] Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
|
86
|
+
|
87
|
+
# The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
|
88
|
+
# `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
|
89
|
+
# (mono), and little-endian byte order.
|
90
|
+
#
|
91
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Input#format_
|
92
|
+
module Format
|
93
|
+
extend OpenAI::Internal::Type::Enum
|
94
|
+
|
95
|
+
PCM16 = :pcm16
|
96
|
+
G711_ULAW = :g711_ulaw
|
97
|
+
G711_ALAW = :g711_alaw
|
98
|
+
|
99
|
+
# @!method self.values
|
100
|
+
# @return [Array<Symbol>]
|
101
|
+
end
|
102
|
+
|
103
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Input#noise_reduction
|
104
|
+
class NoiseReduction < OpenAI::Internal::Type::BaseModel
|
105
|
+
# @!attribute type
|
106
|
+
# Type of noise reduction. `near_field` is for close-talking microphones such as
|
107
|
+
# headphones, `far_field` is for far-field microphones such as laptop or
|
108
|
+
# conference room microphones.
|
109
|
+
#
|
110
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::NoiseReduction::Type, nil]
|
111
|
+
optional :type, enum: -> { OpenAI::Realtime::RealtimeAudioConfig::Input::NoiseReduction::Type }
|
112
|
+
|
113
|
+
# @!method initialize(type: nil)
|
114
|
+
# Some parameter documentations has been truncated, see
|
115
|
+
# {OpenAI::Models::Realtime::RealtimeAudioConfig::Input::NoiseReduction} for more
|
116
|
+
# details.
|
117
|
+
#
|
118
|
+
# Configuration for input audio noise reduction. This can be set to `null` to turn
|
119
|
+
# off. Noise reduction filters audio added to the input audio buffer before it is
|
120
|
+
# sent to VAD and the model. Filtering the audio can improve VAD and turn
|
121
|
+
# detection accuracy (reducing false positives) and model performance by improving
|
122
|
+
# perception of the input audio.
|
123
|
+
#
|
124
|
+
# @param type [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::NoiseReduction::Type] Type of noise reduction. `near_field` is for close-talking microphones such as h
|
125
|
+
|
126
|
+
# Type of noise reduction. `near_field` is for close-talking microphones such as
|
127
|
+
# headphones, `far_field` is for far-field microphones such as laptop or
|
128
|
+
# conference room microphones.
|
129
|
+
#
|
130
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Input::NoiseReduction#type
|
131
|
+
module Type
|
132
|
+
extend OpenAI::Internal::Type::Enum
|
133
|
+
|
134
|
+
NEAR_FIELD = :near_field
|
135
|
+
FAR_FIELD = :far_field
|
136
|
+
|
137
|
+
# @!method self.values
|
138
|
+
# @return [Array<Symbol>]
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Input#transcription
|
143
|
+
class Transcription < OpenAI::Internal::Type::BaseModel
|
144
|
+
# @!attribute language
|
145
|
+
# The language of the input audio. Supplying the input language in
|
146
|
+
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
|
147
|
+
# format will improve accuracy and latency.
|
148
|
+
#
|
149
|
+
# @return [String, nil]
|
150
|
+
optional :language, String
|
151
|
+
|
152
|
+
# @!attribute model
|
153
|
+
# The model to use for transcription. Current options are `whisper-1`,
|
154
|
+
# `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, and
|
155
|
+
# `gpt-4o-transcribe-diarize`.
|
156
|
+
#
|
157
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::Transcription::Model, nil]
|
158
|
+
optional :model, enum: -> { OpenAI::Realtime::RealtimeAudioConfig::Input::Transcription::Model }
|
159
|
+
|
160
|
+
# @!attribute prompt
|
161
|
+
# An optional text to guide the model's style or continue a previous audio
|
162
|
+
# segment. For `whisper-1`, the
|
163
|
+
# [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
|
164
|
+
# For `gpt-4o-transcribe` models, the prompt is a free text string, for example
|
165
|
+
# "expect words related to technology".
|
166
|
+
#
|
167
|
+
# @return [String, nil]
|
168
|
+
optional :prompt, String
|
169
|
+
|
170
|
+
# @!method initialize(language: nil, model: nil, prompt: nil)
|
171
|
+
# Some parameter documentations has been truncated, see
|
172
|
+
# {OpenAI::Models::Realtime::RealtimeAudioConfig::Input::Transcription} for more
|
173
|
+
# details.
|
174
|
+
#
|
175
|
+
# Configuration for input audio transcription, defaults to off and can be set to
|
176
|
+
# `null` to turn off once on. Input audio transcription is not native to the
|
177
|
+
# model, since the model consumes audio directly. Transcription runs
|
178
|
+
# asynchronously through
|
179
|
+
# [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
|
180
|
+
# and should be treated as guidance of input audio content rather than precisely
|
181
|
+
# what the model heard. The client can optionally set the language and prompt for
|
182
|
+
# transcription, these offer additional guidance to the transcription service.
|
183
|
+
#
|
184
|
+
# @param language [String] The language of the input audio. Supplying the input language in
|
185
|
+
#
|
186
|
+
# @param model [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::Transcription::Model] The model to use for transcription. Current options are
|
187
|
+
#
|
188
|
+
# @param prompt [String] An optional text to guide the model's style or continue a previous audio
|
189
|
+
|
190
|
+
# The model to use for transcription. Current options are `whisper-1`,
|
191
|
+
# `gpt-4o-transcribe-latest`, `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, and
|
192
|
+
# `gpt-4o-transcribe-diarize`.
|
193
|
+
#
|
194
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Input::Transcription#model
|
195
|
+
module Model
|
196
|
+
extend OpenAI::Internal::Type::Enum
|
197
|
+
|
198
|
+
WHISPER_1 = :"whisper-1"
|
199
|
+
GPT_4O_TRANSCRIBE_LATEST = :"gpt-4o-transcribe-latest"
|
200
|
+
GPT_4O_MINI_TRANSCRIBE = :"gpt-4o-mini-transcribe"
|
201
|
+
GPT_4O_TRANSCRIBE = :"gpt-4o-transcribe"
|
202
|
+
GPT_4O_TRANSCRIBE_DIARIZE = :"gpt-4o-transcribe-diarize"
|
203
|
+
|
204
|
+
# @!method self.values
|
205
|
+
# @return [Array<Symbol>]
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Input#turn_detection
|
210
|
+
class TurnDetection < OpenAI::Internal::Type::BaseModel
|
211
|
+
# @!attribute create_response
|
212
|
+
# Whether or not to automatically generate a response when a VAD stop event
|
213
|
+
# occurs.
|
214
|
+
#
|
215
|
+
# @return [Boolean, nil]
|
216
|
+
optional :create_response, OpenAI::Internal::Type::Boolean
|
217
|
+
|
218
|
+
# @!attribute eagerness
|
219
|
+
# Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
|
220
|
+
# will wait longer for the user to continue speaking, `high` will respond more
|
221
|
+
# quickly. `auto` is the default and is equivalent to `medium`.
|
222
|
+
#
|
223
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection::Eagerness, nil]
|
224
|
+
optional :eagerness, enum: -> { OpenAI::Realtime::RealtimeAudioConfig::Input::TurnDetection::Eagerness }
|
225
|
+
|
226
|
+
# @!attribute idle_timeout_ms
|
227
|
+
# Optional idle timeout after which turn detection will auto-timeout when no
|
228
|
+
# additional audio is received.
|
229
|
+
#
|
230
|
+
# @return [Integer, nil]
|
231
|
+
optional :idle_timeout_ms, Integer, nil?: true
|
232
|
+
|
233
|
+
# @!attribute interrupt_response
|
234
|
+
# Whether or not to automatically interrupt any ongoing response with output to
|
235
|
+
# the default conversation (i.e. `conversation` of `auto`) when a VAD start event
|
236
|
+
# occurs.
|
237
|
+
#
|
238
|
+
# @return [Boolean, nil]
|
239
|
+
optional :interrupt_response, OpenAI::Internal::Type::Boolean
|
240
|
+
|
241
|
+
# @!attribute prefix_padding_ms
|
242
|
+
# Used only for `server_vad` mode. Amount of audio to include before the VAD
|
243
|
+
# detected speech (in milliseconds). Defaults to 300ms.
|
244
|
+
#
|
245
|
+
# @return [Integer, nil]
|
246
|
+
optional :prefix_padding_ms, Integer
|
247
|
+
|
248
|
+
# @!attribute silence_duration_ms
|
249
|
+
# Used only for `server_vad` mode. Duration of silence to detect speech stop (in
|
250
|
+
# milliseconds). Defaults to 500ms. With shorter values the model will respond
|
251
|
+
# more quickly, but may jump in on short pauses from the user.
|
252
|
+
#
|
253
|
+
# @return [Integer, nil]
|
254
|
+
optional :silence_duration_ms, Integer
|
255
|
+
|
256
|
+
# @!attribute threshold
|
257
|
+
# Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
|
258
|
+
# defaults to 0.5. A higher threshold will require louder audio to activate the
|
259
|
+
# model, and thus might perform better in noisy environments.
|
260
|
+
#
|
261
|
+
# @return [Float, nil]
|
262
|
+
optional :threshold, Float
|
263
|
+
|
264
|
+
# @!attribute type
|
265
|
+
# Type of turn detection.
|
266
|
+
#
|
267
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection::Type, nil]
|
268
|
+
optional :type, enum: -> { OpenAI::Realtime::RealtimeAudioConfig::Input::TurnDetection::Type }
|
269
|
+
|
270
|
+
# @!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)
|
271
|
+
# Some parameter documentations has been truncated, see
|
272
|
+
# {OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection} for more
|
273
|
+
# details.
|
274
|
+
#
|
275
|
+
# Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
|
276
|
+
# set to `null` to turn off, in which case the client must manually trigger model
|
277
|
+
# response. Server VAD means that the model will detect the start and end of
|
278
|
+
# speech based on audio volume and respond at the end of user speech. Semantic VAD
|
279
|
+
# is more advanced and uses a turn detection model (in conjunction with VAD) to
|
280
|
+
# semantically estimate whether the user has finished speaking, then dynamically
|
281
|
+
# sets a timeout based on this probability. For example, if user audio trails off
|
282
|
+
# with "uhhm", the model will score a low probability of turn end and wait longer
|
283
|
+
# for the user to continue speaking. This can be useful for more natural
|
284
|
+
# conversations, but may have a higher latency.
|
285
|
+
#
|
286
|
+
# @param create_response [Boolean] Whether or not to automatically generate a response when a VAD stop event occurs
|
287
|
+
#
|
288
|
+
# @param eagerness [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection::Eagerness] Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
|
289
|
+
#
|
290
|
+
# @param idle_timeout_ms [Integer, nil] Optional idle timeout after which turn detection will auto-timeout when
|
291
|
+
#
|
292
|
+
# @param interrupt_response [Boolean] Whether or not to automatically interrupt any ongoing response with output to th
|
293
|
+
#
|
294
|
+
# @param prefix_padding_ms [Integer] Used only for `server_vad` mode. Amount of audio to include before the VAD detec
|
295
|
+
#
|
296
|
+
# @param silence_duration_ms [Integer] Used only for `server_vad` mode. Duration of silence to detect speech stop (in m
|
297
|
+
#
|
298
|
+
# @param threshold [Float] Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
|
299
|
+
#
|
300
|
+
# @param type [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection::Type] Type of turn detection.
|
301
|
+
|
302
|
+
# Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
|
303
|
+
# will wait longer for the user to continue speaking, `high` will respond more
|
304
|
+
# quickly. `auto` is the default and is equivalent to `medium`.
|
305
|
+
#
|
306
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection#eagerness
|
307
|
+
module Eagerness
|
308
|
+
extend OpenAI::Internal::Type::Enum
|
309
|
+
|
310
|
+
LOW = :low
|
311
|
+
MEDIUM = :medium
|
312
|
+
HIGH = :high
|
313
|
+
AUTO = :auto
|
314
|
+
|
315
|
+
# @!method self.values
|
316
|
+
# @return [Array<Symbol>]
|
317
|
+
end
|
318
|
+
|
319
|
+
# Type of turn detection.
|
320
|
+
#
|
321
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Input::TurnDetection#type
|
322
|
+
module Type
|
323
|
+
extend OpenAI::Internal::Type::Enum
|
324
|
+
|
325
|
+
SERVER_VAD = :server_vad
|
326
|
+
SEMANTIC_VAD = :semantic_vad
|
327
|
+
|
328
|
+
# @!method self.values
|
329
|
+
# @return [Array<Symbol>]
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig#output
|
335
|
+
class Output < OpenAI::Internal::Type::BaseModel
|
336
|
+
# @!attribute format_
|
337
|
+
# The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
338
|
+
# For `pcm16`, output audio is sampled at a rate of 24kHz.
|
339
|
+
#
|
340
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Format, nil]
|
341
|
+
optional :format_,
|
342
|
+
enum: -> {
|
343
|
+
OpenAI::Realtime::RealtimeAudioConfig::Output::Format
|
344
|
+
},
|
345
|
+
api_name: :format
|
346
|
+
|
347
|
+
# @!attribute speed
|
348
|
+
# The speed of the model's spoken response. 1.0 is the default speed. 0.25 is the
|
349
|
+
# minimum speed. 1.5 is the maximum speed. This value can only be changed in
|
350
|
+
# between model turns, not while a response is in progress.
|
351
|
+
#
|
352
|
+
# @return [Float, nil]
|
353
|
+
optional :speed, Float
|
354
|
+
|
355
|
+
# @!attribute voice
|
356
|
+
# The voice the model uses to respond. Voice cannot be changed during the session
|
357
|
+
# once the model has responded with audio at least once. Current voice options are
|
358
|
+
# `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`,
|
359
|
+
# and `cedar`.
|
360
|
+
#
|
361
|
+
# @return [String, Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice, nil]
|
362
|
+
optional :voice, union: -> { OpenAI::Realtime::RealtimeAudioConfig::Output::Voice }
|
363
|
+
|
364
|
+
# @!method initialize(format_: nil, speed: nil, voice: nil)
|
365
|
+
# Some parameter documentations has been truncated, see
|
366
|
+
# {OpenAI::Models::Realtime::RealtimeAudioConfig::Output} for more details.
|
367
|
+
#
|
368
|
+
# @param format_ [Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Format] The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
369
|
+
#
|
370
|
+
# @param speed [Float] The speed of the model's spoken response. 1.0 is the default speed. 0.25 is
|
371
|
+
#
|
372
|
+
# @param voice [String, Symbol, OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice] The voice the model uses to respond. Voice cannot be changed during the
|
373
|
+
|
374
|
+
# The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
375
|
+
# For `pcm16`, output audio is sampled at a rate of 24kHz.
|
376
|
+
#
|
377
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Output#format_
|
378
|
+
module Format
|
379
|
+
extend OpenAI::Internal::Type::Enum
|
380
|
+
|
381
|
+
PCM16 = :pcm16
|
382
|
+
G711_ULAW = :g711_ulaw
|
383
|
+
G711_ALAW = :g711_alaw
|
384
|
+
|
385
|
+
# @!method self.values
|
386
|
+
# @return [Array<Symbol>]
|
387
|
+
end
|
388
|
+
|
389
|
+
# The voice the model uses to respond. Voice cannot be changed during the session
|
390
|
+
# once the model has responded with audio at least once. Current voice options are
|
391
|
+
# `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`,
|
392
|
+
# and `cedar`.
|
393
|
+
#
|
394
|
+
# @see OpenAI::Models::Realtime::RealtimeAudioConfig::Output#voice
|
395
|
+
module Voice
|
396
|
+
extend OpenAI::Internal::Type::Union
|
397
|
+
|
398
|
+
variant String
|
399
|
+
|
400
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::ALLOY }
|
401
|
+
|
402
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::ASH }
|
403
|
+
|
404
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::BALLAD }
|
405
|
+
|
406
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::CORAL }
|
407
|
+
|
408
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::ECHO }
|
409
|
+
|
410
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::SAGE }
|
411
|
+
|
412
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::SHIMMER }
|
413
|
+
|
414
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::VERSE }
|
415
|
+
|
416
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::MARIN }
|
417
|
+
|
418
|
+
variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfig::Output::Voice::CEDAR }
|
419
|
+
|
420
|
+
# @!method self.variants
|
421
|
+
# @return [Array(String, Symbol)]
|
422
|
+
|
423
|
+
define_sorbet_constant!(:Variants) do
|
424
|
+
T.type_alias { T.any(String, OpenAI::Realtime::RealtimeAudioConfig::Output::Voice::TaggedSymbol) }
|
425
|
+
end
|
426
|
+
|
427
|
+
# @!group
|
428
|
+
|
429
|
+
ALLOY = :alloy
|
430
|
+
ASH = :ash
|
431
|
+
BALLAD = :ballad
|
432
|
+
CORAL = :coral
|
433
|
+
ECHO = :echo
|
434
|
+
SAGE = :sage
|
435
|
+
SHIMMER = :shimmer
|
436
|
+
VERSE = :verse
|
437
|
+
MARIN = :marin
|
438
|
+
CEDAR = :cedar
|
439
|
+
|
440
|
+
# @!endgroup
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Realtime
|
6
|
+
# A realtime client event.
|
7
|
+
module RealtimeClientEvent
|
8
|
+
extend OpenAI::Internal::Type::Union
|
9
|
+
|
10
|
+
discriminator :type
|
11
|
+
|
12
|
+
# Add a new Item to the Conversation's context, including messages, function
|
13
|
+
# calls, and function call responses. This event can be used both to populate a
|
14
|
+
# "history" of the conversation and to add new items mid-stream, but has the
|
15
|
+
# current limitation that it cannot populate assistant audio messages.
|
16
|
+
#
|
17
|
+
# If successful, the server will respond with a `conversation.item.created`
|
18
|
+
# event, otherwise an `error` event will be sent.
|
19
|
+
variant :"conversation.item.create", -> { OpenAI::Realtime::ConversationItemCreateEvent }
|
20
|
+
|
21
|
+
# Send this event when you want to remove any item from the conversation
|
22
|
+
# history. The server will respond with a `conversation.item.deleted` event,
|
23
|
+
# unless the item does not exist in the conversation history, in which case the
|
24
|
+
# server will respond with an error.
|
25
|
+
variant :"conversation.item.delete", -> { OpenAI::Realtime::ConversationItemDeleteEvent }
|
26
|
+
|
27
|
+
# Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.
|
28
|
+
# The server will respond with a `conversation.item.retrieved` event,
|
29
|
+
# unless the item does not exist in the conversation history, in which case the
|
30
|
+
# server will respond with an error.
|
31
|
+
variant :"conversation.item.retrieve", -> { OpenAI::Realtime::ConversationItemRetrieveEvent }
|
32
|
+
|
33
|
+
# Send this event to truncate a previous assistant message’s audio. The server
|
34
|
+
# will produce audio faster than realtime, so this event is useful when the user
|
35
|
+
# interrupts to truncate audio that has already been sent to the client but not
|
36
|
+
# yet played. This will synchronize the server's understanding of the audio with
|
37
|
+
# the client's playback.
|
38
|
+
#
|
39
|
+
# Truncating audio will delete the server-side text transcript to ensure there
|
40
|
+
# is not text in the context that hasn't been heard by the user.
|
41
|
+
#
|
42
|
+
# If successful, the server will respond with a `conversation.item.truncated`
|
43
|
+
# event.
|
44
|
+
variant :"conversation.item.truncate", -> { OpenAI::Realtime::ConversationItemTruncateEvent }
|
45
|
+
|
46
|
+
# Send this event to append audio bytes to the input audio buffer. The audio
|
47
|
+
# buffer is temporary storage you can write to and later commit. In Server VAD
|
48
|
+
# mode, the audio buffer is used to detect speech and the server will decide
|
49
|
+
# when to commit. When Server VAD is disabled, you must commit the audio buffer
|
50
|
+
# manually.
|
51
|
+
#
|
52
|
+
# The client may choose how much audio to place in each event up to a maximum
|
53
|
+
# of 15 MiB, for example streaming smaller chunks from the client may allow the
|
54
|
+
# VAD to be more responsive. Unlike made other client events, the server will
|
55
|
+
# not send a confirmation response to this event.
|
56
|
+
variant :"input_audio_buffer.append", -> { OpenAI::Realtime::InputAudioBufferAppendEvent }
|
57
|
+
|
58
|
+
# Send this event to clear the audio bytes in the buffer. The server will
|
59
|
+
# respond with an `input_audio_buffer.cleared` event.
|
60
|
+
variant :"input_audio_buffer.clear", -> { OpenAI::Realtime::InputAudioBufferClearEvent }
|
61
|
+
|
62
|
+
# **WebRTC Only:** Emit to cut off the current audio response. This will trigger the server to
|
63
|
+
# stop generating audio and emit a `output_audio_buffer.cleared` event. This
|
64
|
+
# event should be preceded by a `response.cancel` client event to stop the
|
65
|
+
# generation of the current response.
|
66
|
+
# [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).
|
67
|
+
variant :"output_audio_buffer.clear", -> { OpenAI::Realtime::OutputAudioBufferClearEvent }
|
68
|
+
|
69
|
+
# Send this event to commit the user input audio buffer, which will create a
|
70
|
+
# new user message item in the conversation. This event will produce an error
|
71
|
+
# if the input audio buffer is empty. When in Server VAD mode, the client does
|
72
|
+
# not need to send this event, the server will commit the audio buffer
|
73
|
+
# automatically.
|
74
|
+
#
|
75
|
+
# Committing the input audio buffer will trigger input audio transcription
|
76
|
+
# (if enabled in session configuration), but it will not create a response
|
77
|
+
# from the model. The server will respond with an `input_audio_buffer.committed`
|
78
|
+
# event.
|
79
|
+
variant :"input_audio_buffer.commit", -> { OpenAI::Realtime::InputAudioBufferCommitEvent }
|
80
|
+
|
81
|
+
# Send this event to cancel an in-progress response. The server will respond
|
82
|
+
# with a `response.done` event with a status of `response.status=cancelled`. If
|
83
|
+
# there is no response to cancel, the server will respond with an error.
|
84
|
+
variant :"response.cancel", -> { OpenAI::Realtime::ResponseCancelEvent }
|
85
|
+
|
86
|
+
# This event instructs the server to create a Response, which means triggering
|
87
|
+
# model inference. When in Server VAD mode, the server will create Responses
|
88
|
+
# automatically.
|
89
|
+
#
|
90
|
+
# A Response will include at least one Item, and may have two, in which case
|
91
|
+
# the second will be a function call. These Items will be appended to the
|
92
|
+
# conversation history.
|
93
|
+
#
|
94
|
+
# The server will respond with a `response.created` event, events for Items
|
95
|
+
# and content created, and finally a `response.done` event to indicate the
|
96
|
+
# Response is complete.
|
97
|
+
#
|
98
|
+
# The `response.create` event includes inference configuration like
|
99
|
+
# `instructions`, and `temperature`. These fields will override the Session's
|
100
|
+
# configuration for this Response only.
|
101
|
+
variant :"response.create", -> { OpenAI::Realtime::ResponseCreateEvent }
|
102
|
+
|
103
|
+
# Send this event to update the session’s default configuration.
|
104
|
+
# The client may send this event at any time to update any field,
|
105
|
+
# except for `voice`. However, note that once a session has been
|
106
|
+
# initialized with a particular `model`, it can’t be changed to
|
107
|
+
# another model using `session.update`.
|
108
|
+
#
|
109
|
+
# When the server receives a `session.update`, it will respond
|
110
|
+
# with a `session.updated` event showing the full, effective configuration.
|
111
|
+
# Only the fields that are present are updated. To clear a field like
|
112
|
+
# `instructions`, pass an empty string.
|
113
|
+
variant :"session.update", -> { OpenAI::Realtime::SessionUpdateEvent }
|
114
|
+
|
115
|
+
# Send this event to update a transcription session.
|
116
|
+
variant :"transcription_session.update", -> { OpenAI::Realtime::TranscriptionSessionUpdate }
|
117
|
+
|
118
|
+
# @!method self.variants
|
119
|
+
# @return [Array(OpenAI::Models::Realtime::ConversationItemCreateEvent, OpenAI::Models::Realtime::ConversationItemDeleteEvent, OpenAI::Models::Realtime::ConversationItemRetrieveEvent, OpenAI::Models::Realtime::ConversationItemTruncateEvent, OpenAI::Models::Realtime::InputAudioBufferAppendEvent, OpenAI::Models::Realtime::InputAudioBufferClearEvent, OpenAI::Models::Realtime::OutputAudioBufferClearEvent, OpenAI::Models::Realtime::InputAudioBufferCommitEvent, OpenAI::Models::Realtime::ResponseCancelEvent, OpenAI::Models::Realtime::ResponseCreateEvent, OpenAI::Models::Realtime::SessionUpdateEvent, OpenAI::Models::Realtime::TranscriptionSessionUpdate)]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Realtime
|
6
|
+
class RealtimeClientSecretConfig < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute expires_after
|
8
|
+
# Configuration for the ephemeral token expiration.
|
9
|
+
#
|
10
|
+
# @return [OpenAI::Models::Realtime::RealtimeClientSecretConfig::ExpiresAfter, nil]
|
11
|
+
optional :expires_after, -> { OpenAI::Realtime::RealtimeClientSecretConfig::ExpiresAfter }
|
12
|
+
|
13
|
+
# @!method initialize(expires_after: nil)
|
14
|
+
# Some parameter documentations has been truncated, see
|
15
|
+
# {OpenAI::Models::Realtime::RealtimeClientSecretConfig} for more details.
|
16
|
+
#
|
17
|
+
# Configuration options for the generated client secret.
|
18
|
+
#
|
19
|
+
# @param expires_after [OpenAI::Models::Realtime::RealtimeClientSecretConfig::ExpiresAfter] Configuration for the ephemeral token expiration.
|
20
|
+
|
21
|
+
# @see OpenAI::Models::Realtime::RealtimeClientSecretConfig#expires_after
|
22
|
+
class ExpiresAfter < OpenAI::Internal::Type::BaseModel
|
23
|
+
# @!attribute anchor
|
24
|
+
# The anchor point for the ephemeral token expiration. Only `created_at` is
|
25
|
+
# currently supported.
|
26
|
+
#
|
27
|
+
# @return [Symbol, OpenAI::Models::Realtime::RealtimeClientSecretConfig::ExpiresAfter::Anchor]
|
28
|
+
required :anchor, enum: -> { OpenAI::Realtime::RealtimeClientSecretConfig::ExpiresAfter::Anchor }
|
29
|
+
|
30
|
+
# @!attribute seconds
|
31
|
+
# The number of seconds from the anchor point to the expiration. Select a value
|
32
|
+
# between `10` and `7200`.
|
33
|
+
#
|
34
|
+
# @return [Integer, nil]
|
35
|
+
optional :seconds, Integer
|
36
|
+
|
37
|
+
# @!method initialize(anchor:, seconds: nil)
|
38
|
+
# Some parameter documentations has been truncated, see
|
39
|
+
# {OpenAI::Models::Realtime::RealtimeClientSecretConfig::ExpiresAfter} for more
|
40
|
+
# details.
|
41
|
+
#
|
42
|
+
# Configuration for the ephemeral token expiration.
|
43
|
+
#
|
44
|
+
# @param anchor [Symbol, OpenAI::Models::Realtime::RealtimeClientSecretConfig::ExpiresAfter::Anchor] The anchor point for the ephemeral token expiration. Only `created_at` is curren
|
45
|
+
#
|
46
|
+
# @param seconds [Integer] The number of seconds from the anchor point to the expiration. Select a value be
|
47
|
+
|
48
|
+
# The anchor point for the ephemeral token expiration. Only `created_at` is
|
49
|
+
# currently supported.
|
50
|
+
#
|
51
|
+
# @see OpenAI::Models::Realtime::RealtimeClientSecretConfig::ExpiresAfter#anchor
|
52
|
+
module Anchor
|
53
|
+
extend OpenAI::Internal::Type::Enum
|
54
|
+
|
55
|
+
CREATED_AT = :created_at
|
56
|
+
|
57
|
+
# @!method self.values
|
58
|
+
# @return [Array<Symbol>]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|