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.
Files changed (332) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +4 -0
  5. data/lib/openai/internal/stream.rb +3 -2
  6. data/lib/openai/models/audio/speech_create_params.rb +6 -0
  7. data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -0
  8. data/lib/openai/models/evals/run_cancel_response.rb +2 -2
  9. data/lib/openai/models/evals/run_create_params.rb +2 -2
  10. data/lib/openai/models/evals/run_create_response.rb +2 -2
  11. data/lib/openai/models/evals/run_list_response.rb +2 -2
  12. data/lib/openai/models/evals/run_retrieve_response.rb +2 -2
  13. data/lib/openai/models/realtime/client_secret_create_params.rb +93 -0
  14. data/lib/openai/models/realtime/client_secret_create_response.rb +300 -0
  15. data/lib/openai/models/realtime/conversation_created_event.rb +70 -0
  16. data/lib/openai/models/realtime/conversation_item.rb +44 -0
  17. data/lib/openai/models/realtime/conversation_item_added.rb +48 -0
  18. data/lib/openai/models/realtime/conversation_item_create_event.rb +57 -0
  19. data/lib/openai/models/realtime/conversation_item_created_event.rb +59 -0
  20. data/lib/openai/models/realtime/conversation_item_delete_event.rb +39 -0
  21. data/lib/openai/models/realtime/conversation_item_deleted_event.rb +38 -0
  22. data/lib/openai/models/realtime/conversation_item_done.rb +48 -0
  23. data/lib/openai/models/realtime/conversation_item_input_audio_transcription_completed_event.rb +189 -0
  24. data/lib/openai/models/realtime/conversation_item_input_audio_transcription_delta_event.rb +63 -0
  25. data/lib/openai/models/realtime/conversation_item_input_audio_transcription_failed_event.rb +96 -0
  26. data/lib/openai/models/realtime/conversation_item_input_audio_transcription_segment.rb +84 -0
  27. data/lib/openai/models/realtime/conversation_item_retrieve_event.rb +40 -0
  28. data/lib/openai/models/realtime/conversation_item_truncate_event.rb +68 -0
  29. data/lib/openai/models/realtime/conversation_item_truncated_event.rb +60 -0
  30. data/lib/openai/models/realtime/conversation_item_with_reference.rb +235 -0
  31. data/lib/openai/models/realtime/input_audio_buffer_append_event.rb +49 -0
  32. data/lib/openai/models/realtime/input_audio_buffer_clear_event.rb +29 -0
  33. data/lib/openai/models/realtime/input_audio_buffer_cleared_event.rb +29 -0
  34. data/lib/openai/models/realtime/input_audio_buffer_commit_event.rb +35 -0
  35. data/lib/openai/models/realtime/input_audio_buffer_committed_event.rb +51 -0
  36. data/lib/openai/models/realtime/input_audio_buffer_speech_started_event.rb +59 -0
  37. data/lib/openai/models/realtime/input_audio_buffer_speech_stopped_event.rb +51 -0
  38. data/lib/openai/models/realtime/input_audio_buffer_timeout_triggered.rb +52 -0
  39. data/lib/openai/models/realtime/log_prob_properties.rb +39 -0
  40. data/lib/openai/models/realtime/mcp_list_tools_completed.rb +36 -0
  41. data/lib/openai/models/realtime/mcp_list_tools_failed.rb +36 -0
  42. data/lib/openai/models/realtime/mcp_list_tools_in_progress.rb +36 -0
  43. data/lib/openai/models/realtime/output_audio_buffer_clear_event.rb +32 -0
  44. data/lib/openai/models/realtime/rate_limits_updated_event.rb +91 -0
  45. data/lib/openai/models/realtime/realtime_audio_config.rb +446 -0
  46. data/lib/openai/models/realtime/realtime_client_event.rb +123 -0
  47. data/lib/openai/models/realtime/realtime_client_secret_config.rb +64 -0
  48. data/lib/openai/models/realtime/realtime_conversation_item_assistant_message.rb +118 -0
  49. data/lib/openai/models/realtime/realtime_conversation_item_function_call.rb +94 -0
  50. data/lib/openai/models/realtime/realtime_conversation_item_function_call_output.rb +86 -0
  51. data/lib/openai/models/realtime/realtime_conversation_item_system_message.rb +118 -0
  52. data/lib/openai/models/realtime/realtime_conversation_item_user_message.rb +135 -0
  53. data/lib/openai/models/realtime/realtime_error.rb +55 -0
  54. data/lib/openai/models/realtime/realtime_error_event.rb +38 -0
  55. data/lib/openai/models/realtime/realtime_mcp_approval_request.rb +52 -0
  56. data/lib/openai/models/realtime/realtime_mcp_approval_response.rb +52 -0
  57. data/lib/openai/models/realtime/realtime_mcp_list_tools.rb +84 -0
  58. data/lib/openai/models/realtime/realtime_mcp_protocol_error.rb +29 -0
  59. data/lib/openai/models/realtime/realtime_mcp_tool_call.rb +94 -0
  60. data/lib/openai/models/realtime/realtime_mcp_tool_execution_error.rb +23 -0
  61. data/lib/openai/models/realtime/realtime_mcphttp_error.rb +29 -0
  62. data/lib/openai/models/realtime/realtime_response.rb +259 -0
  63. data/lib/openai/models/realtime/realtime_response_status.rb +103 -0
  64. data/lib/openai/models/realtime/realtime_response_usage.rb +61 -0
  65. data/lib/openai/models/realtime/realtime_response_usage_input_token_details.rb +36 -0
  66. data/lib/openai/models/realtime/realtime_response_usage_output_token_details.rb +28 -0
  67. data/lib/openai/models/realtime/realtime_server_event.rb +369 -0
  68. data/lib/openai/models/realtime/realtime_session.rb +696 -0
  69. data/lib/openai/models/realtime/realtime_session_create_request.rb +234 -0
  70. data/lib/openai/models/realtime/realtime_session_create_response.rb +579 -0
  71. data/lib/openai/models/realtime/realtime_tool_choice_config.rb +32 -0
  72. data/lib/openai/models/realtime/realtime_tools_config.rb +11 -0
  73. data/lib/openai/models/realtime/realtime_tools_config_union.rb +379 -0
  74. data/lib/openai/models/realtime/realtime_tracing_config.rb +61 -0
  75. data/lib/openai/models/realtime/realtime_transcription_session_create_request.rb +312 -0
  76. data/lib/openai/models/realtime/realtime_truncation.rb +67 -0
  77. data/lib/openai/models/realtime/response_audio_delta_event.rb +68 -0
  78. data/lib/openai/models/realtime/response_audio_done_event.rb +61 -0
  79. data/lib/openai/models/realtime/response_audio_transcript_delta_event.rb +68 -0
  80. data/lib/openai/models/realtime/response_audio_transcript_done_event.rb +70 -0
  81. data/lib/openai/models/realtime/response_cancel_event.rb +42 -0
  82. data/lib/openai/models/realtime/response_content_part_added_event.rb +120 -0
  83. data/lib/openai/models/realtime/response_content_part_done_event.rb +120 -0
  84. data/lib/openai/models/realtime/response_create_event.rb +391 -0
  85. data/lib/openai/models/realtime/response_created_event.rb +37 -0
  86. data/lib/openai/models/realtime/response_done_event.rb +38 -0
  87. data/lib/openai/models/realtime/response_function_call_arguments_delta_event.rb +72 -0
  88. data/lib/openai/models/realtime/response_function_call_arguments_done_event.rb +73 -0
  89. data/lib/openai/models/realtime/response_mcp_call_arguments_delta.rb +68 -0
  90. data/lib/openai/models/realtime/response_mcp_call_arguments_done.rb +60 -0
  91. data/lib/openai/models/realtime/response_mcp_call_completed.rb +44 -0
  92. data/lib/openai/models/realtime/response_mcp_call_failed.rb +44 -0
  93. data/lib/openai/models/realtime/response_mcp_call_in_progress.rb +44 -0
  94. data/lib/openai/models/realtime/response_output_item_added_event.rb +52 -0
  95. data/lib/openai/models/realtime/response_output_item_done_event.rb +53 -0
  96. data/lib/openai/models/realtime/response_text_delta_event.rb +68 -0
  97. data/lib/openai/models/realtime/response_text_done_event.rb +69 -0
  98. data/lib/openai/models/realtime/session_created_event.rb +38 -0
  99. data/lib/openai/models/realtime/session_update_event.rb +44 -0
  100. data/lib/openai/models/realtime/session_updated_event.rb +37 -0
  101. data/lib/openai/models/realtime/transcription_session_created.rb +278 -0
  102. data/lib/openai/models/realtime/transcription_session_update.rb +36 -0
  103. data/lib/openai/models/realtime/transcription_session_updated_event.rb +279 -0
  104. data/lib/openai/models/responses/response.rb +6 -3
  105. data/lib/openai/models/responses/response_create_params.rb +6 -3
  106. data/lib/openai/models/responses/tool.rb +3 -156
  107. data/lib/openai/models/responses/web_search_preview_tool.rb +124 -0
  108. data/lib/openai/models/responses/web_search_tool.rb +58 -21
  109. data/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb +119 -0
  110. data/lib/openai/models/webhooks/unwrap_webhook_event.rb +4 -1
  111. data/lib/openai/models.rb +2 -0
  112. data/lib/openai/resources/realtime/client_secrets.rb +44 -0
  113. data/lib/openai/resources/realtime.rb +18 -0
  114. data/lib/openai/resources/responses.rb +2 -2
  115. data/lib/openai/resources/webhooks.rb +1 -1
  116. data/lib/openai/version.rb +1 -1
  117. data/lib/openai.rb +95 -0
  118. data/rbi/openai/client.rbi +3 -0
  119. data/rbi/openai/models/audio/speech_create_params.rbi +10 -0
  120. data/rbi/openai/models/chat/chat_completion_audio_param.rbi +10 -0
  121. data/rbi/openai/models/evals/run_cancel_response.rbi +4 -4
  122. data/rbi/openai/models/evals/run_create_params.rbi +8 -8
  123. data/rbi/openai/models/evals/run_create_response.rbi +4 -4
  124. data/rbi/openai/models/evals/run_list_response.rbi +4 -4
  125. data/rbi/openai/models/evals/run_retrieve_response.rbi +4 -4
  126. data/rbi/openai/models/realtime/client_secret_create_params.rbi +222 -0
  127. data/rbi/openai/models/realtime/client_secret_create_response.rbi +676 -0
  128. data/rbi/openai/models/realtime/conversation_created_event.rbi +164 -0
  129. data/rbi/openai/models/realtime/conversation_item.rbi +35 -0
  130. data/rbi/openai/models/realtime/conversation_item_added.rbi +105 -0
  131. data/rbi/openai/models/realtime/conversation_item_create_event.rbi +123 -0
  132. data/rbi/openai/models/realtime/conversation_item_created_event.rbi +117 -0
  133. data/rbi/openai/models/realtime/conversation_item_delete_event.rbi +57 -0
  134. data/rbi/openai/models/realtime/conversation_item_deleted_event.rbi +53 -0
  135. data/rbi/openai/models/realtime/conversation_item_done.rbi +105 -0
  136. data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_completed_event.rbi +305 -0
  137. data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_delta_event.rbi +93 -0
  138. data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_failed_event.rbi +158 -0
  139. data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_segment.rbi +107 -0
  140. data/rbi/openai/models/realtime/conversation_item_retrieve_event.rbi +58 -0
  141. data/rbi/openai/models/realtime/conversation_item_truncate_event.rbi +94 -0
  142. data/rbi/openai/models/realtime/conversation_item_truncated_event.rbi +80 -0
  143. data/rbi/openai/models/realtime/conversation_item_with_reference.rbi +549 -0
  144. data/rbi/openai/models/realtime/input_audio_buffer_append_event.rbi +65 -0
  145. data/rbi/openai/models/realtime/input_audio_buffer_clear_event.rbi +43 -0
  146. data/rbi/openai/models/realtime/input_audio_buffer_cleared_event.rbi +40 -0
  147. data/rbi/openai/models/realtime/input_audio_buffer_commit_event.rbi +49 -0
  148. data/rbi/openai/models/realtime/input_audio_buffer_committed_event.rbi +72 -0
  149. data/rbi/openai/models/realtime/input_audio_buffer_speech_started_event.rbi +82 -0
  150. data/rbi/openai/models/realtime/input_audio_buffer_speech_stopped_event.rbi +73 -0
  151. data/rbi/openai/models/realtime/input_audio_buffer_timeout_triggered.rbi +75 -0
  152. data/rbi/openai/models/realtime/log_prob_properties.rbi +55 -0
  153. data/rbi/openai/models/realtime/mcp_list_tools_completed.rbi +51 -0
  154. data/rbi/openai/models/realtime/mcp_list_tools_failed.rbi +51 -0
  155. data/rbi/openai/models/realtime/mcp_list_tools_in_progress.rbi +51 -0
  156. data/rbi/openai/models/realtime/output_audio_buffer_clear_event.rbi +46 -0
  157. data/rbi/openai/models/realtime/rate_limits_updated_event.rbi +187 -0
  158. data/rbi/openai/models/realtime/realtime_audio_config.rbi +1004 -0
  159. data/rbi/openai/models/realtime/realtime_client_event.rbi +38 -0
  160. data/rbi/openai/models/realtime/realtime_client_secret_config.rbi +147 -0
  161. data/rbi/openai/models/realtime/realtime_conversation_item_assistant_message.rbi +292 -0
  162. data/rbi/openai/models/realtime/realtime_conversation_item_function_call.rbi +199 -0
  163. data/rbi/openai/models/realtime/realtime_conversation_item_function_call_output.rbi +188 -0
  164. data/rbi/openai/models/realtime/realtime_conversation_item_system_message.rbi +292 -0
  165. data/rbi/openai/models/realtime/realtime_conversation_item_user_message.rbi +319 -0
  166. data/rbi/openai/models/realtime/realtime_error.rbi +72 -0
  167. data/rbi/openai/models/realtime/realtime_error_event.rbi +64 -0
  168. data/rbi/openai/models/realtime/realtime_mcp_approval_request.rbi +75 -0
  169. data/rbi/openai/models/realtime/realtime_mcp_approval_response.rbi +75 -0
  170. data/rbi/openai/models/realtime/realtime_mcp_list_tools.rbi +131 -0
  171. data/rbi/openai/models/realtime/realtime_mcp_protocol_error.rbi +40 -0
  172. data/rbi/openai/models/realtime/realtime_mcp_tool_call.rbi +145 -0
  173. data/rbi/openai/models/realtime/realtime_mcp_tool_execution_error.rbi +31 -0
  174. data/rbi/openai/models/realtime/realtime_mcphttp_error.rbi +40 -0
  175. data/rbi/openai/models/realtime/realtime_response.rbi +573 -0
  176. data/rbi/openai/models/realtime/realtime_response_status.rbi +233 -0
  177. data/rbi/openai/models/realtime/realtime_response_usage.rbi +121 -0
  178. data/rbi/openai/models/realtime/realtime_response_usage_input_token_details.rbi +68 -0
  179. data/rbi/openai/models/realtime/realtime_response_usage_output_token_details.rbi +51 -0
  180. data/rbi/openai/models/realtime/realtime_server_event.rbi +311 -0
  181. data/rbi/openai/models/realtime/realtime_session.rbi +1426 -0
  182. data/rbi/openai/models/realtime/realtime_session_create_request.rbi +560 -0
  183. data/rbi/openai/models/realtime/realtime_session_create_response.rbi +1249 -0
  184. data/rbi/openai/models/realtime/realtime_tool_choice_config.rbi +30 -0
  185. data/rbi/openai/models/realtime/realtime_tools_config.rbi +15 -0
  186. data/rbi/openai/models/realtime/realtime_tools_config_union.rbi +755 -0
  187. data/rbi/openai/models/realtime/realtime_tracing_config.rbi +95 -0
  188. data/rbi/openai/models/realtime/realtime_transcription_session_create_request.rbi +703 -0
  189. data/rbi/openai/models/realtime/realtime_truncation.rbi +117 -0
  190. data/rbi/openai/models/realtime/response_audio_delta_event.rbi +91 -0
  191. data/rbi/openai/models/realtime/response_audio_done_event.rbi +84 -0
  192. data/rbi/openai/models/realtime/response_audio_transcript_delta_event.rbi +91 -0
  193. data/rbi/openai/models/realtime/response_audio_transcript_done_event.rbi +93 -0
  194. data/rbi/openai/models/realtime/response_cancel_event.rbi +63 -0
  195. data/rbi/openai/models/realtime/response_content_part_added_event.rbi +219 -0
  196. data/rbi/openai/models/realtime/response_content_part_done_event.rbi +219 -0
  197. data/rbi/openai/models/realtime/response_create_event.rbi +863 -0
  198. data/rbi/openai/models/realtime/response_created_event.rbi +65 -0
  199. data/rbi/openai/models/realtime/response_done_event.rbi +66 -0
  200. data/rbi/openai/models/realtime/response_function_call_arguments_delta_event.rbi +91 -0
  201. data/rbi/openai/models/realtime/response_function_call_arguments_done_event.rbi +92 -0
  202. data/rbi/openai/models/realtime/response_mcp_call_arguments_delta.rbi +91 -0
  203. data/rbi/openai/models/realtime/response_mcp_call_arguments_done.rbi +83 -0
  204. data/rbi/openai/models/realtime/response_mcp_call_completed.rbi +67 -0
  205. data/rbi/openai/models/realtime/response_mcp_call_failed.rbi +67 -0
  206. data/rbi/openai/models/realtime/response_mcp_call_in_progress.rbi +67 -0
  207. data/rbi/openai/models/realtime/response_output_item_added_event.rbi +111 -0
  208. data/rbi/openai/models/realtime/response_output_item_done_event.rbi +112 -0
  209. data/rbi/openai/models/realtime/response_text_delta_event.rbi +91 -0
  210. data/rbi/openai/models/realtime/response_text_done_event.rbi +92 -0
  211. data/rbi/openai/models/realtime/session_created_event.rbi +64 -0
  212. data/rbi/openai/models/realtime/session_update_event.rbi +77 -0
  213. data/rbi/openai/models/realtime/session_updated_event.rbi +63 -0
  214. data/rbi/openai/models/realtime/transcription_session_created.rbi +653 -0
  215. data/rbi/openai/models/realtime/transcription_session_update.rbi +74 -0
  216. data/rbi/openai/models/realtime/transcription_session_updated_event.rbi +657 -0
  217. data/rbi/openai/models/responses/response.rbi +10 -4
  218. data/rbi/openai/models/responses/response_create_params.rbi +16 -10
  219. data/rbi/openai/models/responses/tool.rbi +2 -348
  220. data/rbi/openai/models/responses/web_search_preview_tool.rbi +245 -0
  221. data/rbi/openai/models/responses/web_search_tool.rbi +120 -23
  222. data/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi +222 -0
  223. data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +1 -0
  224. data/rbi/openai/models.rbi +2 -0
  225. data/rbi/openai/resources/realtime/client_secrets.rbi +38 -0
  226. data/rbi/openai/resources/realtime.rbi +15 -0
  227. data/rbi/openai/resources/responses.rbi +12 -6
  228. data/rbi/openai/resources/webhooks.rbi +1 -0
  229. data/sig/openai/client.rbs +2 -0
  230. data/sig/openai/models/audio/speech_create_params.rbs +4 -0
  231. data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -0
  232. data/sig/openai/models/realtime/client_secret_create_params.rbs +89 -0
  233. data/sig/openai/models/realtime/client_secret_create_response.rbs +292 -0
  234. data/sig/openai/models/realtime/conversation_created_event.rbs +70 -0
  235. data/sig/openai/models/realtime/conversation_item.rbs +22 -0
  236. data/sig/openai/models/realtime/conversation_item_added.rbs +37 -0
  237. data/sig/openai/models/realtime/conversation_item_create_event.rbs +41 -0
  238. data/sig/openai/models/realtime/conversation_item_created_event.rbs +37 -0
  239. data/sig/openai/models/realtime/conversation_item_delete_event.rbs +30 -0
  240. data/sig/openai/models/realtime/conversation_item_deleted_event.rbs +32 -0
  241. data/sig/openai/models/realtime/conversation_item_done.rbs +37 -0
  242. data/sig/openai/models/realtime/conversation_item_input_audio_transcription_completed_event.rbs +136 -0
  243. data/sig/openai/models/realtime/conversation_item_input_audio_transcription_delta_event.rbs +51 -0
  244. data/sig/openai/models/realtime/conversation_item_input_audio_transcription_failed_event.rbs +77 -0
  245. data/sig/openai/models/realtime/conversation_item_input_audio_transcription_segment.rbs +62 -0
  246. data/sig/openai/models/realtime/conversation_item_retrieve_event.rbs +34 -0
  247. data/sig/openai/models/realtime/conversation_item_truncate_event.rbs +44 -0
  248. data/sig/openai/models/realtime/conversation_item_truncated_event.rbs +42 -0
  249. data/sig/openai/models/realtime/conversation_item_with_reference.rbs +207 -0
  250. data/sig/openai/models/realtime/input_audio_buffer_append_event.rbs +30 -0
  251. data/sig/openai/models/realtime/input_audio_buffer_clear_event.rbs +23 -0
  252. data/sig/openai/models/realtime/input_audio_buffer_cleared_event.rbs +24 -0
  253. data/sig/openai/models/realtime/input_audio_buffer_commit_event.rbs +23 -0
  254. data/sig/openai/models/realtime/input_audio_buffer_committed_event.rbs +37 -0
  255. data/sig/openai/models/realtime/input_audio_buffer_speech_started_event.rbs +37 -0
  256. data/sig/openai/models/realtime/input_audio_buffer_speech_stopped_event.rbs +37 -0
  257. data/sig/openai/models/realtime/input_audio_buffer_timeout_triggered.rbs +42 -0
  258. data/sig/openai/models/realtime/log_prob_properties.rbs +28 -0
  259. data/sig/openai/models/realtime/mcp_list_tools_completed.rbs +28 -0
  260. data/sig/openai/models/realtime/mcp_list_tools_failed.rbs +28 -0
  261. data/sig/openai/models/realtime/mcp_list_tools_in_progress.rbs +32 -0
  262. data/sig/openai/models/realtime/output_audio_buffer_clear_event.rbs +23 -0
  263. data/sig/openai/models/realtime/rate_limits_updated_event.rbs +85 -0
  264. data/sig/openai/models/realtime/realtime_audio_config.rbs +354 -0
  265. data/sig/openai/models/realtime/realtime_client_event.rbs +25 -0
  266. data/sig/openai/models/realtime/realtime_client_secret_config.rbs +60 -0
  267. data/sig/openai/models/realtime/realtime_conversation_item_assistant_message.rbs +117 -0
  268. data/sig/openai/models/realtime/realtime_conversation_item_function_call.rbs +86 -0
  269. data/sig/openai/models/realtime/realtime_conversation_item_function_call_output.rbs +79 -0
  270. data/sig/openai/models/realtime/realtime_conversation_item_system_message.rbs +117 -0
  271. data/sig/openai/models/realtime/realtime_conversation_item_user_message.rbs +132 -0
  272. data/sig/openai/models/realtime/realtime_error.rbs +42 -0
  273. data/sig/openai/models/realtime/realtime_error_event.rbs +32 -0
  274. data/sig/openai/models/realtime/realtime_mcp_approval_request.rbs +42 -0
  275. data/sig/openai/models/realtime/realtime_mcp_approval_response.rbs +42 -0
  276. data/sig/openai/models/realtime/realtime_mcp_list_tools.rbs +71 -0
  277. data/sig/openai/models/realtime/realtime_mcp_protocol_error.rbs +28 -0
  278. data/sig/openai/models/realtime/realtime_mcp_tool_call.rbs +68 -0
  279. data/sig/openai/models/realtime/realtime_mcp_tool_execution_error.rbs +18 -0
  280. data/sig/openai/models/realtime/realtime_mcphttp_error.rbs +24 -0
  281. data/sig/openai/models/realtime/realtime_response.rbs +210 -0
  282. data/sig/openai/models/realtime/realtime_response_status.rbs +90 -0
  283. data/sig/openai/models/realtime/realtime_response_usage.rbs +56 -0
  284. data/sig/openai/models/realtime/realtime_response_usage_input_token_details.rbs +34 -0
  285. data/sig/openai/models/realtime/realtime_response_usage_output_token_details.rbs +22 -0
  286. data/sig/openai/models/realtime/realtime_server_event.rbs +168 -0
  287. data/sig/openai/models/realtime/realtime_session.rbs +521 -0
  288. data/sig/openai/models/realtime/realtime_session_create_request.rbs +178 -0
  289. data/sig/openai/models/realtime/realtime_session_create_response.rbs +526 -0
  290. data/sig/openai/models/realtime/realtime_tool_choice_config.rbs +16 -0
  291. data/sig/openai/models/realtime/realtime_tools_config.rbs +10 -0
  292. data/sig/openai/models/realtime/realtime_tools_config_union.rbs +280 -0
  293. data/sig/openai/models/realtime/realtime_tracing_config.rbs +43 -0
  294. data/sig/openai/models/realtime/realtime_transcription_session_create_request.rbs +242 -0
  295. data/sig/openai/models/realtime/realtime_truncation.rbs +53 -0
  296. data/sig/openai/models/realtime/response_audio_delta_event.rbs +52 -0
  297. data/sig/openai/models/realtime/response_audio_done_event.rbs +47 -0
  298. data/sig/openai/models/realtime/response_audio_transcript_delta_event.rbs +52 -0
  299. data/sig/openai/models/realtime/response_audio_transcript_done_event.rbs +52 -0
  300. data/sig/openai/models/realtime/response_cancel_event.rbs +32 -0
  301. data/sig/openai/models/realtime/response_content_part_added_event.rbs +105 -0
  302. data/sig/openai/models/realtime/response_content_part_done_event.rbs +105 -0
  303. data/sig/openai/models/realtime/response_create_event.rbs +281 -0
  304. data/sig/openai/models/realtime/response_created_event.rbs +32 -0
  305. data/sig/openai/models/realtime/response_done_event.rbs +32 -0
  306. data/sig/openai/models/realtime/response_function_call_arguments_delta_event.rbs +52 -0
  307. data/sig/openai/models/realtime/response_function_call_arguments_done_event.rbs +52 -0
  308. data/sig/openai/models/realtime/response_mcp_call_arguments_delta.rbs +52 -0
  309. data/sig/openai/models/realtime/response_mcp_call_arguments_done.rbs +47 -0
  310. data/sig/openai/models/realtime/response_mcp_call_completed.rbs +37 -0
  311. data/sig/openai/models/realtime/response_mcp_call_failed.rbs +37 -0
  312. data/sig/openai/models/realtime/response_mcp_call_in_progress.rbs +37 -0
  313. data/sig/openai/models/realtime/response_output_item_added_event.rbs +42 -0
  314. data/sig/openai/models/realtime/response_output_item_done_event.rbs +42 -0
  315. data/sig/openai/models/realtime/response_text_delta_event.rbs +52 -0
  316. data/sig/openai/models/realtime/response_text_done_event.rbs +52 -0
  317. data/sig/openai/models/realtime/session_created_event.rbs +32 -0
  318. data/sig/openai/models/realtime/session_update_event.rbs +34 -0
  319. data/sig/openai/models/realtime/session_updated_event.rbs +32 -0
  320. data/sig/openai/models/realtime/transcription_session_created.rbs +282 -0
  321. data/sig/openai/models/realtime/transcription_session_update.rbs +34 -0
  322. data/sig/openai/models/realtime/transcription_session_updated_event.rbs +282 -0
  323. data/sig/openai/models/responses/tool.rbs +1 -121
  324. data/sig/openai/models/responses/web_search_preview_tool.rbs +96 -0
  325. data/sig/openai/models/responses/web_search_tool.rbs +39 -10
  326. data/sig/openai/models/webhooks/realtime_call_incoming_webhook_event.rbs +90 -0
  327. data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +1 -0
  328. data/sig/openai/models.rbs +2 -0
  329. data/sig/openai/resources/realtime/client_secrets.rbs +15 -0
  330. data/sig/openai/resources/realtime.rbs +9 -0
  331. data/sig/openai/resources/webhooks.rbs +1 -0
  332. metadata +287 -2
@@ -0,0 +1,863 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class ResponseCreateEvent < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Realtime::ResponseCreateEvent,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The event type, must be `response.create`.
16
+ sig { returns(Symbol) }
17
+ attr_accessor :type
18
+
19
+ # Optional client-generated ID used to identify this event.
20
+ sig { returns(T.nilable(String)) }
21
+ attr_reader :event_id
22
+
23
+ sig { params(event_id: String).void }
24
+ attr_writer :event_id
25
+
26
+ # Create a new Realtime response with these parameters
27
+ sig do
28
+ returns(T.nilable(OpenAI::Realtime::ResponseCreateEvent::Response))
29
+ end
30
+ attr_reader :response
31
+
32
+ sig do
33
+ params(
34
+ response: OpenAI::Realtime::ResponseCreateEvent::Response::OrHash
35
+ ).void
36
+ end
37
+ attr_writer :response
38
+
39
+ # This event instructs the server to create a Response, which means triggering
40
+ # model inference. When in Server VAD mode, the server will create Responses
41
+ # automatically.
42
+ #
43
+ # A Response will include at least one Item, and may have two, in which case the
44
+ # second will be a function call. These Items will be appended to the conversation
45
+ # history.
46
+ #
47
+ # The server will respond with a `response.created` event, events for Items and
48
+ # content created, and finally a `response.done` event to indicate the Response is
49
+ # complete.
50
+ #
51
+ # The `response.create` event includes inference configuration like
52
+ # `instructions`, and `temperature`. These fields will override the Session's
53
+ # configuration for this Response only.
54
+ sig do
55
+ params(
56
+ event_id: String,
57
+ response: OpenAI::Realtime::ResponseCreateEvent::Response::OrHash,
58
+ type: Symbol
59
+ ).returns(T.attached_class)
60
+ end
61
+ def self.new(
62
+ # Optional client-generated ID used to identify this event.
63
+ event_id: nil,
64
+ # Create a new Realtime response with these parameters
65
+ response: nil,
66
+ # The event type, must be `response.create`.
67
+ type: :"response.create"
68
+ )
69
+ end
70
+
71
+ sig do
72
+ override.returns(
73
+ {
74
+ type: Symbol,
75
+ event_id: String,
76
+ response: OpenAI::Realtime::ResponseCreateEvent::Response
77
+ }
78
+ )
79
+ end
80
+ def to_hash
81
+ end
82
+
83
+ class Response < OpenAI::Internal::Type::BaseModel
84
+ OrHash =
85
+ T.type_alias do
86
+ T.any(
87
+ OpenAI::Realtime::ResponseCreateEvent::Response,
88
+ OpenAI::Internal::AnyHash
89
+ )
90
+ end
91
+
92
+ # Controls which conversation the response is added to. Currently supports `auto`
93
+ # and `none`, with `auto` as the default value. The `auto` value means that the
94
+ # contents of the response will be added to the default conversation. Set this to
95
+ # `none` to create an out-of-band response which will not add items to default
96
+ # conversation.
97
+ sig do
98
+ returns(
99
+ T.nilable(
100
+ T.any(
101
+ String,
102
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::OrSymbol
103
+ )
104
+ )
105
+ )
106
+ end
107
+ attr_reader :conversation
108
+
109
+ sig do
110
+ params(
111
+ conversation:
112
+ T.any(
113
+ String,
114
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::OrSymbol
115
+ )
116
+ ).void
117
+ end
118
+ attr_writer :conversation
119
+
120
+ # Input items to include in the prompt for the model. Using this field creates a
121
+ # new context for this Response instead of using the default conversation. An
122
+ # empty array `[]` will clear the context for this Response. Note that this can
123
+ # include references to items from the default conversation.
124
+ sig do
125
+ returns(
126
+ T.nilable(
127
+ T::Array[
128
+ T.any(
129
+ OpenAI::Realtime::RealtimeConversationItemSystemMessage,
130
+ OpenAI::Realtime::RealtimeConversationItemUserMessage,
131
+ OpenAI::Realtime::RealtimeConversationItemAssistantMessage,
132
+ OpenAI::Realtime::RealtimeConversationItemFunctionCall,
133
+ OpenAI::Realtime::RealtimeConversationItemFunctionCallOutput,
134
+ OpenAI::Realtime::RealtimeMcpApprovalResponse,
135
+ OpenAI::Realtime::RealtimeMcpListTools,
136
+ OpenAI::Realtime::RealtimeMcpToolCall,
137
+ OpenAI::Realtime::RealtimeMcpApprovalRequest
138
+ )
139
+ ]
140
+ )
141
+ )
142
+ end
143
+ attr_reader :input
144
+
145
+ sig do
146
+ params(
147
+ input:
148
+ T::Array[
149
+ T.any(
150
+ OpenAI::Realtime::RealtimeConversationItemSystemMessage::OrHash,
151
+ OpenAI::Realtime::RealtimeConversationItemUserMessage::OrHash,
152
+ OpenAI::Realtime::RealtimeConversationItemAssistantMessage::OrHash,
153
+ OpenAI::Realtime::RealtimeConversationItemFunctionCall::OrHash,
154
+ OpenAI::Realtime::RealtimeConversationItemFunctionCallOutput::OrHash,
155
+ OpenAI::Realtime::RealtimeMcpApprovalResponse::OrHash,
156
+ OpenAI::Realtime::RealtimeMcpListTools::OrHash,
157
+ OpenAI::Realtime::RealtimeMcpToolCall::OrHash,
158
+ OpenAI::Realtime::RealtimeMcpApprovalRequest::OrHash
159
+ )
160
+ ]
161
+ ).void
162
+ end
163
+ attr_writer :input
164
+
165
+ # The default system instructions (i.e. system message) prepended to model calls.
166
+ # This field allows the client to guide the model on desired responses. The model
167
+ # can be instructed on response content and format, (e.g. "be extremely succinct",
168
+ # "act friendly", "here are examples of good responses") and on audio behavior
169
+ # (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
170
+ # instructions are not guaranteed to be followed by the model, but they provide
171
+ # guidance to the model on the desired behavior.
172
+ #
173
+ # Note that the server sets default instructions which will be used if this field
174
+ # is not set and are visible in the `session.created` event at the start of the
175
+ # session.
176
+ sig { returns(T.nilable(String)) }
177
+ attr_reader :instructions
178
+
179
+ sig { params(instructions: String).void }
180
+ attr_writer :instructions
181
+
182
+ # Maximum number of output tokens for a single assistant response, inclusive of
183
+ # tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
184
+ # `inf` for the maximum available tokens for a given model. Defaults to `inf`.
185
+ sig { returns(T.nilable(T.any(Integer, Symbol))) }
186
+ attr_reader :max_output_tokens
187
+
188
+ sig { params(max_output_tokens: T.any(Integer, Symbol)).void }
189
+ attr_writer :max_output_tokens
190
+
191
+ # Set of 16 key-value pairs that can be attached to an object. This can be useful
192
+ # for storing additional information about the object in a structured format, and
193
+ # querying for objects via API or the dashboard.
194
+ #
195
+ # Keys are strings with a maximum length of 64 characters. Values are strings with
196
+ # a maximum length of 512 characters.
197
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
198
+ attr_accessor :metadata
199
+
200
+ # The set of modalities the model can respond with. To disable audio, set this to
201
+ # ["text"].
202
+ sig do
203
+ returns(
204
+ T.nilable(
205
+ T::Array[
206
+ OpenAI::Realtime::ResponseCreateEvent::Response::Modality::OrSymbol
207
+ ]
208
+ )
209
+ )
210
+ end
211
+ attr_reader :modalities
212
+
213
+ sig do
214
+ params(
215
+ modalities:
216
+ T::Array[
217
+ OpenAI::Realtime::ResponseCreateEvent::Response::Modality::OrSymbol
218
+ ]
219
+ ).void
220
+ end
221
+ attr_writer :modalities
222
+
223
+ # The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
224
+ sig do
225
+ returns(
226
+ T.nilable(
227
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat::OrSymbol
228
+ )
229
+ )
230
+ end
231
+ attr_reader :output_audio_format
232
+
233
+ sig do
234
+ params(
235
+ output_audio_format:
236
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat::OrSymbol
237
+ ).void
238
+ end
239
+ attr_writer :output_audio_format
240
+
241
+ # Reference to a prompt template and its variables.
242
+ # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
243
+ sig { returns(T.nilable(OpenAI::Responses::ResponsePrompt)) }
244
+ attr_reader :prompt
245
+
246
+ sig do
247
+ params(
248
+ prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash)
249
+ ).void
250
+ end
251
+ attr_writer :prompt
252
+
253
+ # Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
254
+ sig { returns(T.nilable(Float)) }
255
+ attr_reader :temperature
256
+
257
+ sig { params(temperature: Float).void }
258
+ attr_writer :temperature
259
+
260
+ # How the model chooses tools. Provide one of the string modes or force a specific
261
+ # function/MCP tool.
262
+ sig do
263
+ returns(
264
+ T.nilable(
265
+ T.any(
266
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
267
+ OpenAI::Responses::ToolChoiceFunction,
268
+ OpenAI::Responses::ToolChoiceMcp
269
+ )
270
+ )
271
+ )
272
+ end
273
+ attr_reader :tool_choice
274
+
275
+ sig do
276
+ params(
277
+ tool_choice:
278
+ T.any(
279
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
280
+ OpenAI::Responses::ToolChoiceFunction::OrHash,
281
+ OpenAI::Responses::ToolChoiceMcp::OrHash
282
+ )
283
+ ).void
284
+ end
285
+ attr_writer :tool_choice
286
+
287
+ # Tools (functions) available to the model.
288
+ sig do
289
+ returns(
290
+ T.nilable(
291
+ T::Array[OpenAI::Realtime::ResponseCreateEvent::Response::Tool]
292
+ )
293
+ )
294
+ end
295
+ attr_reader :tools
296
+
297
+ sig do
298
+ params(
299
+ tools:
300
+ T::Array[
301
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::OrHash
302
+ ]
303
+ ).void
304
+ end
305
+ attr_writer :tools
306
+
307
+ # The voice the model uses to respond. Voice cannot be changed during the session
308
+ # once the model has responded with audio at least once. Current voice options are
309
+ # `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
310
+ sig do
311
+ returns(
312
+ T.nilable(
313
+ T.any(
314
+ String,
315
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::OrSymbol
316
+ )
317
+ )
318
+ )
319
+ end
320
+ attr_reader :voice
321
+
322
+ sig do
323
+ params(
324
+ voice:
325
+ T.any(
326
+ String,
327
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::OrSymbol
328
+ )
329
+ ).void
330
+ end
331
+ attr_writer :voice
332
+
333
+ # Create a new Realtime response with these parameters
334
+ sig do
335
+ params(
336
+ conversation:
337
+ T.any(
338
+ String,
339
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::OrSymbol
340
+ ),
341
+ input:
342
+ T::Array[
343
+ T.any(
344
+ OpenAI::Realtime::RealtimeConversationItemSystemMessage::OrHash,
345
+ OpenAI::Realtime::RealtimeConversationItemUserMessage::OrHash,
346
+ OpenAI::Realtime::RealtimeConversationItemAssistantMessage::OrHash,
347
+ OpenAI::Realtime::RealtimeConversationItemFunctionCall::OrHash,
348
+ OpenAI::Realtime::RealtimeConversationItemFunctionCallOutput::OrHash,
349
+ OpenAI::Realtime::RealtimeMcpApprovalResponse::OrHash,
350
+ OpenAI::Realtime::RealtimeMcpListTools::OrHash,
351
+ OpenAI::Realtime::RealtimeMcpToolCall::OrHash,
352
+ OpenAI::Realtime::RealtimeMcpApprovalRequest::OrHash
353
+ )
354
+ ],
355
+ instructions: String,
356
+ max_output_tokens: T.any(Integer, Symbol),
357
+ metadata: T.nilable(T::Hash[Symbol, String]),
358
+ modalities:
359
+ T::Array[
360
+ OpenAI::Realtime::ResponseCreateEvent::Response::Modality::OrSymbol
361
+ ],
362
+ output_audio_format:
363
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat::OrSymbol,
364
+ prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
365
+ temperature: Float,
366
+ tool_choice:
367
+ T.any(
368
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
369
+ OpenAI::Responses::ToolChoiceFunction::OrHash,
370
+ OpenAI::Responses::ToolChoiceMcp::OrHash
371
+ ),
372
+ tools:
373
+ T::Array[
374
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::OrHash
375
+ ],
376
+ voice:
377
+ T.any(
378
+ String,
379
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::OrSymbol
380
+ )
381
+ ).returns(T.attached_class)
382
+ end
383
+ def self.new(
384
+ # Controls which conversation the response is added to. Currently supports `auto`
385
+ # and `none`, with `auto` as the default value. The `auto` value means that the
386
+ # contents of the response will be added to the default conversation. Set this to
387
+ # `none` to create an out-of-band response which will not add items to default
388
+ # conversation.
389
+ conversation: nil,
390
+ # Input items to include in the prompt for the model. Using this field creates a
391
+ # new context for this Response instead of using the default conversation. An
392
+ # empty array `[]` will clear the context for this Response. Note that this can
393
+ # include references to items from the default conversation.
394
+ input: nil,
395
+ # The default system instructions (i.e. system message) prepended to model calls.
396
+ # This field allows the client to guide the model on desired responses. The model
397
+ # can be instructed on response content and format, (e.g. "be extremely succinct",
398
+ # "act friendly", "here are examples of good responses") and on audio behavior
399
+ # (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
400
+ # instructions are not guaranteed to be followed by the model, but they provide
401
+ # guidance to the model on the desired behavior.
402
+ #
403
+ # Note that the server sets default instructions which will be used if this field
404
+ # is not set and are visible in the `session.created` event at the start of the
405
+ # session.
406
+ instructions: nil,
407
+ # Maximum number of output tokens for a single assistant response, inclusive of
408
+ # tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
409
+ # `inf` for the maximum available tokens for a given model. Defaults to `inf`.
410
+ max_output_tokens: nil,
411
+ # Set of 16 key-value pairs that can be attached to an object. This can be useful
412
+ # for storing additional information about the object in a structured format, and
413
+ # querying for objects via API or the dashboard.
414
+ #
415
+ # Keys are strings with a maximum length of 64 characters. Values are strings with
416
+ # a maximum length of 512 characters.
417
+ metadata: nil,
418
+ # The set of modalities the model can respond with. To disable audio, set this to
419
+ # ["text"].
420
+ modalities: nil,
421
+ # The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
422
+ output_audio_format: nil,
423
+ # Reference to a prompt template and its variables.
424
+ # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
425
+ prompt: nil,
426
+ # Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
427
+ temperature: nil,
428
+ # How the model chooses tools. Provide one of the string modes or force a specific
429
+ # function/MCP tool.
430
+ tool_choice: nil,
431
+ # Tools (functions) available to the model.
432
+ tools: nil,
433
+ # The voice the model uses to respond. Voice cannot be changed during the session
434
+ # once the model has responded with audio at least once. Current voice options are
435
+ # `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
436
+ voice: nil
437
+ )
438
+ end
439
+
440
+ sig do
441
+ override.returns(
442
+ {
443
+ conversation:
444
+ T.any(
445
+ String,
446
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::OrSymbol
447
+ ),
448
+ input:
449
+ T::Array[
450
+ T.any(
451
+ OpenAI::Realtime::RealtimeConversationItemSystemMessage,
452
+ OpenAI::Realtime::RealtimeConversationItemUserMessage,
453
+ OpenAI::Realtime::RealtimeConversationItemAssistantMessage,
454
+ OpenAI::Realtime::RealtimeConversationItemFunctionCall,
455
+ OpenAI::Realtime::RealtimeConversationItemFunctionCallOutput,
456
+ OpenAI::Realtime::RealtimeMcpApprovalResponse,
457
+ OpenAI::Realtime::RealtimeMcpListTools,
458
+ OpenAI::Realtime::RealtimeMcpToolCall,
459
+ OpenAI::Realtime::RealtimeMcpApprovalRequest
460
+ )
461
+ ],
462
+ instructions: String,
463
+ max_output_tokens: T.any(Integer, Symbol),
464
+ metadata: T.nilable(T::Hash[Symbol, String]),
465
+ modalities:
466
+ T::Array[
467
+ OpenAI::Realtime::ResponseCreateEvent::Response::Modality::OrSymbol
468
+ ],
469
+ output_audio_format:
470
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat::OrSymbol,
471
+ prompt: T.nilable(OpenAI::Responses::ResponsePrompt),
472
+ temperature: Float,
473
+ tool_choice:
474
+ T.any(
475
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
476
+ OpenAI::Responses::ToolChoiceFunction,
477
+ OpenAI::Responses::ToolChoiceMcp
478
+ ),
479
+ tools:
480
+ T::Array[
481
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool
482
+ ],
483
+ voice:
484
+ T.any(
485
+ String,
486
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::OrSymbol
487
+ )
488
+ }
489
+ )
490
+ end
491
+ def to_hash
492
+ end
493
+
494
+ # Controls which conversation the response is added to. Currently supports `auto`
495
+ # and `none`, with `auto` as the default value. The `auto` value means that the
496
+ # contents of the response will be added to the default conversation. Set this to
497
+ # `none` to create an out-of-band response which will not add items to default
498
+ # conversation.
499
+ module Conversation
500
+ extend OpenAI::Internal::Type::Union
501
+
502
+ Variants =
503
+ T.type_alias do
504
+ T.any(
505
+ String,
506
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::TaggedSymbol
507
+ )
508
+ end
509
+
510
+ sig do
511
+ override.returns(
512
+ T::Array[
513
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::Variants
514
+ ]
515
+ )
516
+ end
517
+ def self.variants
518
+ end
519
+
520
+ TaggedSymbol =
521
+ T.type_alias do
522
+ T.all(
523
+ Symbol,
524
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation
525
+ )
526
+ end
527
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
528
+
529
+ AUTO =
530
+ T.let(
531
+ :auto,
532
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::TaggedSymbol
533
+ )
534
+ NONE =
535
+ T.let(
536
+ :none,
537
+ OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::TaggedSymbol
538
+ )
539
+ end
540
+
541
+ # Maximum number of output tokens for a single assistant response, inclusive of
542
+ # tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
543
+ # `inf` for the maximum available tokens for a given model. Defaults to `inf`.
544
+ module MaxOutputTokens
545
+ extend OpenAI::Internal::Type::Union
546
+
547
+ Variants = T.type_alias { T.any(Integer, Symbol) }
548
+
549
+ sig do
550
+ override.returns(
551
+ T::Array[
552
+ OpenAI::Realtime::ResponseCreateEvent::Response::MaxOutputTokens::Variants
553
+ ]
554
+ )
555
+ end
556
+ def self.variants
557
+ end
558
+ end
559
+
560
+ module Modality
561
+ extend OpenAI::Internal::Type::Enum
562
+
563
+ TaggedSymbol =
564
+ T.type_alias do
565
+ T.all(
566
+ Symbol,
567
+ OpenAI::Realtime::ResponseCreateEvent::Response::Modality
568
+ )
569
+ end
570
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
571
+
572
+ TEXT =
573
+ T.let(
574
+ :text,
575
+ OpenAI::Realtime::ResponseCreateEvent::Response::Modality::TaggedSymbol
576
+ )
577
+ AUDIO =
578
+ T.let(
579
+ :audio,
580
+ OpenAI::Realtime::ResponseCreateEvent::Response::Modality::TaggedSymbol
581
+ )
582
+
583
+ sig do
584
+ override.returns(
585
+ T::Array[
586
+ OpenAI::Realtime::ResponseCreateEvent::Response::Modality::TaggedSymbol
587
+ ]
588
+ )
589
+ end
590
+ def self.values
591
+ end
592
+ end
593
+
594
+ # The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
595
+ module OutputAudioFormat
596
+ extend OpenAI::Internal::Type::Enum
597
+
598
+ TaggedSymbol =
599
+ T.type_alias do
600
+ T.all(
601
+ Symbol,
602
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat
603
+ )
604
+ end
605
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
606
+
607
+ PCM16 =
608
+ T.let(
609
+ :pcm16,
610
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat::TaggedSymbol
611
+ )
612
+ G711_ULAW =
613
+ T.let(
614
+ :g711_ulaw,
615
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat::TaggedSymbol
616
+ )
617
+ G711_ALAW =
618
+ T.let(
619
+ :g711_alaw,
620
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat::TaggedSymbol
621
+ )
622
+
623
+ sig do
624
+ override.returns(
625
+ T::Array[
626
+ OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat::TaggedSymbol
627
+ ]
628
+ )
629
+ end
630
+ def self.values
631
+ end
632
+ end
633
+
634
+ # How the model chooses tools. Provide one of the string modes or force a specific
635
+ # function/MCP tool.
636
+ module ToolChoice
637
+ extend OpenAI::Internal::Type::Union
638
+
639
+ Variants =
640
+ T.type_alias do
641
+ T.any(
642
+ OpenAI::Responses::ToolChoiceOptions::TaggedSymbol,
643
+ OpenAI::Responses::ToolChoiceFunction,
644
+ OpenAI::Responses::ToolChoiceMcp
645
+ )
646
+ end
647
+
648
+ sig do
649
+ override.returns(
650
+ T::Array[
651
+ OpenAI::Realtime::ResponseCreateEvent::Response::ToolChoice::Variants
652
+ ]
653
+ )
654
+ end
655
+ def self.variants
656
+ end
657
+ end
658
+
659
+ class Tool < OpenAI::Internal::Type::BaseModel
660
+ OrHash =
661
+ T.type_alias do
662
+ T.any(
663
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool,
664
+ OpenAI::Internal::AnyHash
665
+ )
666
+ end
667
+
668
+ # The description of the function, including guidance on when and how to call it,
669
+ # and guidance about what to tell the user when calling (if anything).
670
+ sig { returns(T.nilable(String)) }
671
+ attr_reader :description
672
+
673
+ sig { params(description: String).void }
674
+ attr_writer :description
675
+
676
+ # The name of the function.
677
+ sig { returns(T.nilable(String)) }
678
+ attr_reader :name
679
+
680
+ sig { params(name: String).void }
681
+ attr_writer :name
682
+
683
+ # Parameters of the function in JSON Schema.
684
+ sig { returns(T.nilable(T.anything)) }
685
+ attr_reader :parameters
686
+
687
+ sig { params(parameters: T.anything).void }
688
+ attr_writer :parameters
689
+
690
+ # The type of the tool, i.e. `function`.
691
+ sig do
692
+ returns(
693
+ T.nilable(
694
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::Type::OrSymbol
695
+ )
696
+ )
697
+ end
698
+ attr_reader :type
699
+
700
+ sig do
701
+ params(
702
+ type:
703
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::Type::OrSymbol
704
+ ).void
705
+ end
706
+ attr_writer :type
707
+
708
+ sig do
709
+ params(
710
+ description: String,
711
+ name: String,
712
+ parameters: T.anything,
713
+ type:
714
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::Type::OrSymbol
715
+ ).returns(T.attached_class)
716
+ end
717
+ def self.new(
718
+ # The description of the function, including guidance on when and how to call it,
719
+ # and guidance about what to tell the user when calling (if anything).
720
+ description: nil,
721
+ # The name of the function.
722
+ name: nil,
723
+ # Parameters of the function in JSON Schema.
724
+ parameters: nil,
725
+ # The type of the tool, i.e. `function`.
726
+ type: nil
727
+ )
728
+ end
729
+
730
+ sig do
731
+ override.returns(
732
+ {
733
+ description: String,
734
+ name: String,
735
+ parameters: T.anything,
736
+ type:
737
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::Type::OrSymbol
738
+ }
739
+ )
740
+ end
741
+ def to_hash
742
+ end
743
+
744
+ # The type of the tool, i.e. `function`.
745
+ module Type
746
+ extend OpenAI::Internal::Type::Enum
747
+
748
+ TaggedSymbol =
749
+ T.type_alias do
750
+ T.all(
751
+ Symbol,
752
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::Type
753
+ )
754
+ end
755
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
756
+
757
+ FUNCTION =
758
+ T.let(
759
+ :function,
760
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::Type::TaggedSymbol
761
+ )
762
+
763
+ sig do
764
+ override.returns(
765
+ T::Array[
766
+ OpenAI::Realtime::ResponseCreateEvent::Response::Tool::Type::TaggedSymbol
767
+ ]
768
+ )
769
+ end
770
+ def self.values
771
+ end
772
+ end
773
+ end
774
+
775
+ # The voice the model uses to respond. Voice cannot be changed during the session
776
+ # once the model has responded with audio at least once. Current voice options are
777
+ # `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
778
+ module Voice
779
+ extend OpenAI::Internal::Type::Union
780
+
781
+ Variants =
782
+ T.type_alias do
783
+ T.any(
784
+ String,
785
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
786
+ )
787
+ end
788
+
789
+ sig do
790
+ override.returns(
791
+ T::Array[
792
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::Variants
793
+ ]
794
+ )
795
+ end
796
+ def self.variants
797
+ end
798
+
799
+ TaggedSymbol =
800
+ T.type_alias do
801
+ T.all(
802
+ Symbol,
803
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice
804
+ )
805
+ end
806
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
807
+
808
+ ALLOY =
809
+ T.let(
810
+ :alloy,
811
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
812
+ )
813
+ ASH =
814
+ T.let(
815
+ :ash,
816
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
817
+ )
818
+ BALLAD =
819
+ T.let(
820
+ :ballad,
821
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
822
+ )
823
+ CORAL =
824
+ T.let(
825
+ :coral,
826
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
827
+ )
828
+ ECHO =
829
+ T.let(
830
+ :echo,
831
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
832
+ )
833
+ SAGE =
834
+ T.let(
835
+ :sage,
836
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
837
+ )
838
+ SHIMMER =
839
+ T.let(
840
+ :shimmer,
841
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
842
+ )
843
+ VERSE =
844
+ T.let(
845
+ :verse,
846
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
847
+ )
848
+ MARIN =
849
+ T.let(
850
+ :marin,
851
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
852
+ )
853
+ CEDAR =
854
+ T.let(
855
+ :cedar,
856
+ OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol
857
+ )
858
+ end
859
+ end
860
+ end
861
+ end
862
+ end
863
+ end