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,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class ResponseCancelEvent < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute type
8
+ # The event type, must be `response.cancel`.
9
+ #
10
+ # @return [Symbol, :"response.cancel"]
11
+ required :type, const: :"response.cancel"
12
+
13
+ # @!attribute event_id
14
+ # Optional client-generated ID used to identify this event.
15
+ #
16
+ # @return [String, nil]
17
+ optional :event_id, String
18
+
19
+ # @!attribute response_id
20
+ # A specific response ID to cancel - if not provided, will cancel an in-progress
21
+ # response in the default conversation.
22
+ #
23
+ # @return [String, nil]
24
+ optional :response_id, String
25
+
26
+ # @!method initialize(event_id: nil, response_id: nil, type: :"response.cancel")
27
+ # Some parameter documentations has been truncated, see
28
+ # {OpenAI::Models::Realtime::ResponseCancelEvent} for more details.
29
+ #
30
+ # Send this event to cancel an in-progress response. The server will respond with
31
+ # a `response.done` event with a status of `response.status=cancelled`. If there
32
+ # is no response to cancel, the server will respond with an error.
33
+ #
34
+ # @param event_id [String] Optional client-generated ID used to identify this event.
35
+ #
36
+ # @param response_id [String] A specific response ID to cancel - if not provided, will cancel an
37
+ #
38
+ # @param type [Symbol, :"response.cancel"] The event type, must be `response.cancel`.
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class ResponseContentPartAddedEvent < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute content_index
8
+ # The index of the content part in the item's content array.
9
+ #
10
+ # @return [Integer]
11
+ required :content_index, Integer
12
+
13
+ # @!attribute event_id
14
+ # The unique ID of the server event.
15
+ #
16
+ # @return [String]
17
+ required :event_id, String
18
+
19
+ # @!attribute item_id
20
+ # The ID of the item to which the content part was added.
21
+ #
22
+ # @return [String]
23
+ required :item_id, String
24
+
25
+ # @!attribute output_index
26
+ # The index of the output item in the response.
27
+ #
28
+ # @return [Integer]
29
+ required :output_index, Integer
30
+
31
+ # @!attribute part
32
+ # The content part that was added.
33
+ #
34
+ # @return [OpenAI::Models::Realtime::ResponseContentPartAddedEvent::Part]
35
+ required :part, -> { OpenAI::Realtime::ResponseContentPartAddedEvent::Part }
36
+
37
+ # @!attribute response_id
38
+ # The ID of the response.
39
+ #
40
+ # @return [String]
41
+ required :response_id, String
42
+
43
+ # @!attribute type
44
+ # The event type, must be `response.content_part.added`.
45
+ #
46
+ # @return [Symbol, :"response.content_part.added"]
47
+ required :type, const: :"response.content_part.added"
48
+
49
+ # @!method initialize(content_index:, event_id:, item_id:, output_index:, part:, response_id:, type: :"response.content_part.added")
50
+ # Returned when a new content part is added to an assistant message item during
51
+ # response generation.
52
+ #
53
+ # @param content_index [Integer] The index of the content part in the item's content array.
54
+ #
55
+ # @param event_id [String] The unique ID of the server event.
56
+ #
57
+ # @param item_id [String] The ID of the item to which the content part was added.
58
+ #
59
+ # @param output_index [Integer] The index of the output item in the response.
60
+ #
61
+ # @param part [OpenAI::Models::Realtime::ResponseContentPartAddedEvent::Part] The content part that was added.
62
+ #
63
+ # @param response_id [String] The ID of the response.
64
+ #
65
+ # @param type [Symbol, :"response.content_part.added"] The event type, must be `response.content_part.added`.
66
+
67
+ # @see OpenAI::Models::Realtime::ResponseContentPartAddedEvent#part
68
+ class Part < OpenAI::Internal::Type::BaseModel
69
+ # @!attribute audio
70
+ # Base64-encoded audio data (if type is "audio").
71
+ #
72
+ # @return [String, nil]
73
+ optional :audio, String
74
+
75
+ # @!attribute text
76
+ # The text content (if type is "text").
77
+ #
78
+ # @return [String, nil]
79
+ optional :text, String
80
+
81
+ # @!attribute transcript
82
+ # The transcript of the audio (if type is "audio").
83
+ #
84
+ # @return [String, nil]
85
+ optional :transcript, String
86
+
87
+ # @!attribute type
88
+ # The content type ("text", "audio").
89
+ #
90
+ # @return [Symbol, OpenAI::Models::Realtime::ResponseContentPartAddedEvent::Part::Type, nil]
91
+ optional :type, enum: -> { OpenAI::Realtime::ResponseContentPartAddedEvent::Part::Type }
92
+
93
+ # @!method initialize(audio: nil, text: nil, transcript: nil, type: nil)
94
+ # The content part that was added.
95
+ #
96
+ # @param audio [String] Base64-encoded audio data (if type is "audio").
97
+ #
98
+ # @param text [String] The text content (if type is "text").
99
+ #
100
+ # @param transcript [String] The transcript of the audio (if type is "audio").
101
+ #
102
+ # @param type [Symbol, OpenAI::Models::Realtime::ResponseContentPartAddedEvent::Part::Type] The content type ("text", "audio").
103
+
104
+ # The content type ("text", "audio").
105
+ #
106
+ # @see OpenAI::Models::Realtime::ResponseContentPartAddedEvent::Part#type
107
+ module Type
108
+ extend OpenAI::Internal::Type::Enum
109
+
110
+ TEXT = :text
111
+ AUDIO = :audio
112
+
113
+ # @!method self.values
114
+ # @return [Array<Symbol>]
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class ResponseContentPartDoneEvent < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute content_index
8
+ # The index of the content part in the item's content array.
9
+ #
10
+ # @return [Integer]
11
+ required :content_index, Integer
12
+
13
+ # @!attribute event_id
14
+ # The unique ID of the server event.
15
+ #
16
+ # @return [String]
17
+ required :event_id, String
18
+
19
+ # @!attribute item_id
20
+ # The ID of the item.
21
+ #
22
+ # @return [String]
23
+ required :item_id, String
24
+
25
+ # @!attribute output_index
26
+ # The index of the output item in the response.
27
+ #
28
+ # @return [Integer]
29
+ required :output_index, Integer
30
+
31
+ # @!attribute part
32
+ # The content part that is done.
33
+ #
34
+ # @return [OpenAI::Models::Realtime::ResponseContentPartDoneEvent::Part]
35
+ required :part, -> { OpenAI::Realtime::ResponseContentPartDoneEvent::Part }
36
+
37
+ # @!attribute response_id
38
+ # The ID of the response.
39
+ #
40
+ # @return [String]
41
+ required :response_id, String
42
+
43
+ # @!attribute type
44
+ # The event type, must be `response.content_part.done`.
45
+ #
46
+ # @return [Symbol, :"response.content_part.done"]
47
+ required :type, const: :"response.content_part.done"
48
+
49
+ # @!method initialize(content_index:, event_id:, item_id:, output_index:, part:, response_id:, type: :"response.content_part.done")
50
+ # Returned when a content part is done streaming in an assistant message item.
51
+ # Also emitted when a Response is interrupted, incomplete, or cancelled.
52
+ #
53
+ # @param content_index [Integer] The index of the content part in the item's content array.
54
+ #
55
+ # @param event_id [String] The unique ID of the server event.
56
+ #
57
+ # @param item_id [String] The ID of the item.
58
+ #
59
+ # @param output_index [Integer] The index of the output item in the response.
60
+ #
61
+ # @param part [OpenAI::Models::Realtime::ResponseContentPartDoneEvent::Part] The content part that is done.
62
+ #
63
+ # @param response_id [String] The ID of the response.
64
+ #
65
+ # @param type [Symbol, :"response.content_part.done"] The event type, must be `response.content_part.done`.
66
+
67
+ # @see OpenAI::Models::Realtime::ResponseContentPartDoneEvent#part
68
+ class Part < OpenAI::Internal::Type::BaseModel
69
+ # @!attribute audio
70
+ # Base64-encoded audio data (if type is "audio").
71
+ #
72
+ # @return [String, nil]
73
+ optional :audio, String
74
+
75
+ # @!attribute text
76
+ # The text content (if type is "text").
77
+ #
78
+ # @return [String, nil]
79
+ optional :text, String
80
+
81
+ # @!attribute transcript
82
+ # The transcript of the audio (if type is "audio").
83
+ #
84
+ # @return [String, nil]
85
+ optional :transcript, String
86
+
87
+ # @!attribute type
88
+ # The content type ("text", "audio").
89
+ #
90
+ # @return [Symbol, OpenAI::Models::Realtime::ResponseContentPartDoneEvent::Part::Type, nil]
91
+ optional :type, enum: -> { OpenAI::Realtime::ResponseContentPartDoneEvent::Part::Type }
92
+
93
+ # @!method initialize(audio: nil, text: nil, transcript: nil, type: nil)
94
+ # The content part that is done.
95
+ #
96
+ # @param audio [String] Base64-encoded audio data (if type is "audio").
97
+ #
98
+ # @param text [String] The text content (if type is "text").
99
+ #
100
+ # @param transcript [String] The transcript of the audio (if type is "audio").
101
+ #
102
+ # @param type [Symbol, OpenAI::Models::Realtime::ResponseContentPartDoneEvent::Part::Type] The content type ("text", "audio").
103
+
104
+ # The content type ("text", "audio").
105
+ #
106
+ # @see OpenAI::Models::Realtime::ResponseContentPartDoneEvent::Part#type
107
+ module Type
108
+ extend OpenAI::Internal::Type::Enum
109
+
110
+ TEXT = :text
111
+ AUDIO = :audio
112
+
113
+ # @!method self.values
114
+ # @return [Array<Symbol>]
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,391 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class ResponseCreateEvent < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute type
8
+ # The event type, must be `response.create`.
9
+ #
10
+ # @return [Symbol, :"response.create"]
11
+ required :type, const: :"response.create"
12
+
13
+ # @!attribute event_id
14
+ # Optional client-generated ID used to identify this event.
15
+ #
16
+ # @return [String, nil]
17
+ optional :event_id, String
18
+
19
+ # @!attribute response
20
+ # Create a new Realtime response with these parameters
21
+ #
22
+ # @return [OpenAI::Models::Realtime::ResponseCreateEvent::Response, nil]
23
+ optional :response, -> { OpenAI::Realtime::ResponseCreateEvent::Response }
24
+
25
+ # @!method initialize(event_id: nil, response: nil, type: :"response.create")
26
+ # This event instructs the server to create a Response, which means triggering
27
+ # model inference. When in Server VAD mode, the server will create Responses
28
+ # automatically.
29
+ #
30
+ # A Response will include at least one Item, and may have two, in which case the
31
+ # second will be a function call. These Items will be appended to the conversation
32
+ # history.
33
+ #
34
+ # The server will respond with a `response.created` event, events for Items and
35
+ # content created, and finally a `response.done` event to indicate the Response is
36
+ # complete.
37
+ #
38
+ # The `response.create` event includes inference configuration like
39
+ # `instructions`, and `temperature`. These fields will override the Session's
40
+ # configuration for this Response only.
41
+ #
42
+ # @param event_id [String] Optional client-generated ID used to identify this event.
43
+ #
44
+ # @param response [OpenAI::Models::Realtime::ResponseCreateEvent::Response] Create a new Realtime response with these parameters
45
+ #
46
+ # @param type [Symbol, :"response.create"] The event type, must be `response.create`.
47
+
48
+ # @see OpenAI::Models::Realtime::ResponseCreateEvent#response
49
+ class Response < OpenAI::Internal::Type::BaseModel
50
+ # @!attribute conversation
51
+ # Controls which conversation the response is added to. Currently supports `auto`
52
+ # and `none`, with `auto` as the default value. The `auto` value means that the
53
+ # contents of the response will be added to the default conversation. Set this to
54
+ # `none` to create an out-of-band response which will not add items to default
55
+ # conversation.
56
+ #
57
+ # @return [String, Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Conversation, nil]
58
+ optional :conversation, union: -> { OpenAI::Realtime::ResponseCreateEvent::Response::Conversation }
59
+
60
+ # @!attribute input
61
+ # Input items to include in the prompt for the model. Using this field creates a
62
+ # new context for this Response instead of using the default conversation. An
63
+ # empty array `[]` will clear the context for this Response. Note that this can
64
+ # include references to items from the default conversation.
65
+ #
66
+ # @return [Array<OpenAI::Models::Realtime::RealtimeConversationItemSystemMessage, OpenAI::Models::Realtime::RealtimeConversationItemUserMessage, OpenAI::Models::Realtime::RealtimeConversationItemAssistantMessage, OpenAI::Models::Realtime::RealtimeConversationItemFunctionCall, OpenAI::Models::Realtime::RealtimeConversationItemFunctionCallOutput, OpenAI::Models::Realtime::RealtimeMcpApprovalResponse, OpenAI::Models::Realtime::RealtimeMcpListTools, OpenAI::Models::Realtime::RealtimeMcpToolCall, OpenAI::Models::Realtime::RealtimeMcpApprovalRequest>, nil]
67
+ optional :input, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::ConversationItem] }
68
+
69
+ # @!attribute instructions
70
+ # The default system instructions (i.e. system message) prepended to model calls.
71
+ # This field allows the client to guide the model on desired responses. The model
72
+ # can be instructed on response content and format, (e.g. "be extremely succinct",
73
+ # "act friendly", "here are examples of good responses") and on audio behavior
74
+ # (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
75
+ # instructions are not guaranteed to be followed by the model, but they provide
76
+ # guidance to the model on the desired behavior.
77
+ #
78
+ # Note that the server sets default instructions which will be used if this field
79
+ # is not set and are visible in the `session.created` event at the start of the
80
+ # session.
81
+ #
82
+ # @return [String, nil]
83
+ optional :instructions, String
84
+
85
+ # @!attribute max_output_tokens
86
+ # Maximum number of output tokens for a single assistant response, inclusive of
87
+ # tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
88
+ # `inf` for the maximum available tokens for a given model. Defaults to `inf`.
89
+ #
90
+ # @return [Integer, Symbol, :inf, nil]
91
+ optional :max_output_tokens,
92
+ union: -> { OpenAI::Realtime::ResponseCreateEvent::Response::MaxOutputTokens }
93
+
94
+ # @!attribute metadata
95
+ # Set of 16 key-value pairs that can be attached to an object. This can be useful
96
+ # for storing additional information about the object in a structured format, and
97
+ # querying for objects via API or the dashboard.
98
+ #
99
+ # Keys are strings with a maximum length of 64 characters. Values are strings with
100
+ # a maximum length of 512 characters.
101
+ #
102
+ # @return [Hash{Symbol=>String}, nil]
103
+ optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true
104
+
105
+ # @!attribute modalities
106
+ # The set of modalities the model can respond with. To disable audio, set this to
107
+ # ["text"].
108
+ #
109
+ # @return [Array<Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Modality>, nil]
110
+ optional :modalities,
111
+ -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::ResponseCreateEvent::Response::Modality] }
112
+
113
+ # @!attribute output_audio_format
114
+ # The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
115
+ #
116
+ # @return [Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::OutputAudioFormat, nil]
117
+ optional :output_audio_format,
118
+ enum: -> { OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat }
119
+
120
+ # @!attribute prompt
121
+ # Reference to a prompt template and its variables.
122
+ # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
123
+ #
124
+ # @return [OpenAI::Models::Responses::ResponsePrompt, nil]
125
+ optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true
126
+
127
+ # @!attribute temperature
128
+ # Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
129
+ #
130
+ # @return [Float, nil]
131
+ optional :temperature, Float
132
+
133
+ # @!attribute tool_choice
134
+ # How the model chooses tools. Provide one of the string modes or force a specific
135
+ # function/MCP tool.
136
+ #
137
+ # @return [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, nil]
138
+ optional :tool_choice, union: -> { OpenAI::Realtime::ResponseCreateEvent::Response::ToolChoice }
139
+
140
+ # @!attribute tools
141
+ # Tools (functions) available to the model.
142
+ #
143
+ # @return [Array<OpenAI::Models::Realtime::ResponseCreateEvent::Response::Tool>, nil]
144
+ optional :tools,
145
+ -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Realtime::ResponseCreateEvent::Response::Tool] }
146
+
147
+ # @!attribute voice
148
+ # The voice the model uses to respond. Voice cannot be changed during the session
149
+ # once the model has responded with audio at least once. Current voice options are
150
+ # `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
151
+ #
152
+ # @return [String, Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice, nil]
153
+ optional :voice, union: -> { OpenAI::Realtime::ResponseCreateEvent::Response::Voice }
154
+
155
+ # @!method initialize(conversation: nil, input: nil, instructions: nil, max_output_tokens: nil, metadata: nil, modalities: nil, output_audio_format: nil, prompt: nil, temperature: nil, tool_choice: nil, tools: nil, voice: nil)
156
+ # Some parameter documentations has been truncated, see
157
+ # {OpenAI::Models::Realtime::ResponseCreateEvent::Response} for more details.
158
+ #
159
+ # Create a new Realtime response with these parameters
160
+ #
161
+ # @param conversation [String, Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Conversation] Controls which conversation the response is added to. Currently supports
162
+ #
163
+ # @param input [Array<OpenAI::Models::Realtime::RealtimeConversationItemSystemMessage, OpenAI::Models::Realtime::RealtimeConversationItemUserMessage, OpenAI::Models::Realtime::RealtimeConversationItemAssistantMessage, OpenAI::Models::Realtime::RealtimeConversationItemFunctionCall, OpenAI::Models::Realtime::RealtimeConversationItemFunctionCallOutput, OpenAI::Models::Realtime::RealtimeMcpApprovalResponse, OpenAI::Models::Realtime::RealtimeMcpListTools, OpenAI::Models::Realtime::RealtimeMcpToolCall, OpenAI::Models::Realtime::RealtimeMcpApprovalRequest>] Input items to include in the prompt for the model. Using this field
164
+ #
165
+ # @param instructions [String] The default system instructions (i.e. system message) prepended to model
166
+ #
167
+ # @param max_output_tokens [Integer, Symbol, :inf] Maximum number of output tokens for a single assistant response,
168
+ #
169
+ # @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. This can be
170
+ #
171
+ # @param modalities [Array<Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Modality>] The set of modalities the model can respond with. To disable audio,
172
+ #
173
+ # @param output_audio_format [Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::OutputAudioFormat] The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
174
+ #
175
+ # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables.
176
+ #
177
+ # @param temperature [Float] Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.
178
+ #
179
+ # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific
180
+ #
181
+ # @param tools [Array<OpenAI::Models::Realtime::ResponseCreateEvent::Response::Tool>] Tools (functions) available to the model.
182
+ #
183
+ # @param voice [String, Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice] The voice the model uses to respond. Voice cannot be changed during the
184
+
185
+ # Controls which conversation the response is added to. Currently supports `auto`
186
+ # and `none`, with `auto` as the default value. The `auto` value means that the
187
+ # contents of the response will be added to the default conversation. Set this to
188
+ # `none` to create an out-of-band response which will not add items to default
189
+ # conversation.
190
+ #
191
+ # @see OpenAI::Models::Realtime::ResponseCreateEvent::Response#conversation
192
+ module Conversation
193
+ extend OpenAI::Internal::Type::Union
194
+
195
+ variant String
196
+
197
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Conversation::AUTO }
198
+
199
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Conversation::NONE }
200
+
201
+ # @!method self.variants
202
+ # @return [Array(String, Symbol)]
203
+
204
+ define_sorbet_constant!(:Variants) do
205
+ T.type_alias { T.any(String, OpenAI::Realtime::ResponseCreateEvent::Response::Conversation::TaggedSymbol) }
206
+ end
207
+
208
+ # @!group
209
+
210
+ AUTO = :auto
211
+ NONE = :none
212
+
213
+ # @!endgroup
214
+ end
215
+
216
+ # Maximum number of output tokens for a single assistant response, inclusive of
217
+ # tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
218
+ # `inf` for the maximum available tokens for a given model. Defaults to `inf`.
219
+ #
220
+ # @see OpenAI::Models::Realtime::ResponseCreateEvent::Response#max_output_tokens
221
+ module MaxOutputTokens
222
+ extend OpenAI::Internal::Type::Union
223
+
224
+ variant Integer
225
+
226
+ variant const: :inf
227
+
228
+ # @!method self.variants
229
+ # @return [Array(Integer, Symbol, :inf)]
230
+ end
231
+
232
+ module Modality
233
+ extend OpenAI::Internal::Type::Enum
234
+
235
+ TEXT = :text
236
+ AUDIO = :audio
237
+
238
+ # @!method self.values
239
+ # @return [Array<Symbol>]
240
+ end
241
+
242
+ # The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
243
+ #
244
+ # @see OpenAI::Models::Realtime::ResponseCreateEvent::Response#output_audio_format
245
+ module OutputAudioFormat
246
+ extend OpenAI::Internal::Type::Enum
247
+
248
+ PCM16 = :pcm16
249
+ G711_ULAW = :g711_ulaw
250
+ G711_ALAW = :g711_alaw
251
+
252
+ # @!method self.values
253
+ # @return [Array<Symbol>]
254
+ end
255
+
256
+ # How the model chooses tools. Provide one of the string modes or force a specific
257
+ # function/MCP tool.
258
+ #
259
+ # @see OpenAI::Models::Realtime::ResponseCreateEvent::Response#tool_choice
260
+ module ToolChoice
261
+ extend OpenAI::Internal::Type::Union
262
+
263
+ # Controls which (if any) tool is called by the model.
264
+ #
265
+ # `none` means the model will not call any tool and instead generates a message.
266
+ #
267
+ # `auto` means the model can pick between generating a message or calling one or
268
+ # more tools.
269
+ #
270
+ # `required` means the model must call one or more tools.
271
+ variant enum: -> { OpenAI::Responses::ToolChoiceOptions }
272
+
273
+ # Use this option to force the model to call a specific function.
274
+ variant -> { OpenAI::Responses::ToolChoiceFunction }
275
+
276
+ # Use this option to force the model to call a specific tool on a remote MCP server.
277
+ variant -> { OpenAI::Responses::ToolChoiceMcp }
278
+
279
+ # @!method self.variants
280
+ # @return [Array(Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp)]
281
+ end
282
+
283
+ class Tool < OpenAI::Internal::Type::BaseModel
284
+ # @!attribute description
285
+ # The description of the function, including guidance on when and how to call it,
286
+ # and guidance about what to tell the user when calling (if anything).
287
+ #
288
+ # @return [String, nil]
289
+ optional :description, String
290
+
291
+ # @!attribute name
292
+ # The name of the function.
293
+ #
294
+ # @return [String, nil]
295
+ optional :name, String
296
+
297
+ # @!attribute parameters
298
+ # Parameters of the function in JSON Schema.
299
+ #
300
+ # @return [Object, nil]
301
+ optional :parameters, OpenAI::Internal::Type::Unknown
302
+
303
+ # @!attribute type
304
+ # The type of the tool, i.e. `function`.
305
+ #
306
+ # @return [Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Tool::Type, nil]
307
+ optional :type, enum: -> { OpenAI::Realtime::ResponseCreateEvent::Response::Tool::Type }
308
+
309
+ # @!method initialize(description: nil, name: nil, parameters: nil, type: nil)
310
+ # Some parameter documentations has been truncated, see
311
+ # {OpenAI::Models::Realtime::ResponseCreateEvent::Response::Tool} for more
312
+ # details.
313
+ #
314
+ # @param description [String] The description of the function, including guidance on when and how
315
+ #
316
+ # @param name [String] The name of the function.
317
+ #
318
+ # @param parameters [Object] Parameters of the function in JSON Schema.
319
+ #
320
+ # @param type [Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Tool::Type] The type of the tool, i.e. `function`.
321
+
322
+ # The type of the tool, i.e. `function`.
323
+ #
324
+ # @see OpenAI::Models::Realtime::ResponseCreateEvent::Response::Tool#type
325
+ module Type
326
+ extend OpenAI::Internal::Type::Enum
327
+
328
+ FUNCTION = :function
329
+
330
+ # @!method self.values
331
+ # @return [Array<Symbol>]
332
+ end
333
+ end
334
+
335
+ # The voice the model uses to respond. Voice cannot be changed during the session
336
+ # once the model has responded with audio at least once. Current voice options are
337
+ # `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.
338
+ #
339
+ # @see OpenAI::Models::Realtime::ResponseCreateEvent::Response#voice
340
+ module Voice
341
+ extend OpenAI::Internal::Type::Union
342
+
343
+ variant String
344
+
345
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::ALLOY }
346
+
347
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::ASH }
348
+
349
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::BALLAD }
350
+
351
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::CORAL }
352
+
353
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::ECHO }
354
+
355
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::SAGE }
356
+
357
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::SHIMMER }
358
+
359
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::VERSE }
360
+
361
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::MARIN }
362
+
363
+ variant const: -> { OpenAI::Models::Realtime::ResponseCreateEvent::Response::Voice::CEDAR }
364
+
365
+ # @!method self.variants
366
+ # @return [Array(String, Symbol)]
367
+
368
+ define_sorbet_constant!(:Variants) do
369
+ T.type_alias { T.any(String, OpenAI::Realtime::ResponseCreateEvent::Response::Voice::TaggedSymbol) }
370
+ end
371
+
372
+ # @!group
373
+
374
+ ALLOY = :alloy
375
+ ASH = :ash
376
+ BALLAD = :ballad
377
+ CORAL = :coral
378
+ ECHO = :echo
379
+ SAGE = :sage
380
+ SHIMMER = :shimmer
381
+ VERSE = :verse
382
+ MARIN = :marin
383
+ CEDAR = :cedar
384
+
385
+ # @!endgroup
386
+ end
387
+ end
388
+ end
389
+ end
390
+ end
391
+ end