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,755 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ # Give the model access to additional tools via remote Model Context Protocol
7
+ # (MCP) servers.
8
+ # [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
9
+ module RealtimeToolsConfigUnion
10
+ extend OpenAI::Internal::Type::Union
11
+
12
+ Variants =
13
+ T.type_alias do
14
+ T.any(
15
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function,
16
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp
17
+ )
18
+ end
19
+
20
+ class Function < OpenAI::Internal::Type::BaseModel
21
+ OrHash =
22
+ T.type_alias do
23
+ T.any(
24
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function,
25
+ OpenAI::Internal::AnyHash
26
+ )
27
+ end
28
+
29
+ # The description of the function, including guidance on when and how to call it,
30
+ # and guidance about what to tell the user when calling (if anything).
31
+ sig { returns(T.nilable(String)) }
32
+ attr_reader :description
33
+
34
+ sig { params(description: String).void }
35
+ attr_writer :description
36
+
37
+ # The name of the function.
38
+ sig { returns(T.nilable(String)) }
39
+ attr_reader :name
40
+
41
+ sig { params(name: String).void }
42
+ attr_writer :name
43
+
44
+ # Parameters of the function in JSON Schema.
45
+ sig { returns(T.nilable(T.anything)) }
46
+ attr_reader :parameters
47
+
48
+ sig { params(parameters: T.anything).void }
49
+ attr_writer :parameters
50
+
51
+ # The type of the tool, i.e. `function`.
52
+ sig do
53
+ returns(
54
+ T.nilable(
55
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function::Type::OrSymbol
56
+ )
57
+ )
58
+ end
59
+ attr_reader :type
60
+
61
+ sig do
62
+ params(
63
+ type:
64
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function::Type::OrSymbol
65
+ ).void
66
+ end
67
+ attr_writer :type
68
+
69
+ sig do
70
+ params(
71
+ description: String,
72
+ name: String,
73
+ parameters: T.anything,
74
+ type:
75
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function::Type::OrSymbol
76
+ ).returns(T.attached_class)
77
+ end
78
+ def self.new(
79
+ # The description of the function, including guidance on when and how to call it,
80
+ # and guidance about what to tell the user when calling (if anything).
81
+ description: nil,
82
+ # The name of the function.
83
+ name: nil,
84
+ # Parameters of the function in JSON Schema.
85
+ parameters: nil,
86
+ # The type of the tool, i.e. `function`.
87
+ type: nil
88
+ )
89
+ end
90
+
91
+ sig do
92
+ override.returns(
93
+ {
94
+ description: String,
95
+ name: String,
96
+ parameters: T.anything,
97
+ type:
98
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function::Type::OrSymbol
99
+ }
100
+ )
101
+ end
102
+ def to_hash
103
+ end
104
+
105
+ # The type of the tool, i.e. `function`.
106
+ module Type
107
+ extend OpenAI::Internal::Type::Enum
108
+
109
+ TaggedSymbol =
110
+ T.type_alias do
111
+ T.all(
112
+ Symbol,
113
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function::Type
114
+ )
115
+ end
116
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
117
+
118
+ FUNCTION =
119
+ T.let(
120
+ :function,
121
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function::Type::TaggedSymbol
122
+ )
123
+
124
+ sig do
125
+ override.returns(
126
+ T::Array[
127
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Function::Type::TaggedSymbol
128
+ ]
129
+ )
130
+ end
131
+ def self.values
132
+ end
133
+ end
134
+ end
135
+
136
+ class Mcp < OpenAI::Internal::Type::BaseModel
137
+ OrHash =
138
+ T.type_alias do
139
+ T.any(
140
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp,
141
+ OpenAI::Internal::AnyHash
142
+ )
143
+ end
144
+
145
+ # A label for this MCP server, used to identify it in tool calls.
146
+ sig { returns(String) }
147
+ attr_accessor :server_label
148
+
149
+ # The type of the MCP tool. Always `mcp`.
150
+ sig { returns(Symbol) }
151
+ attr_accessor :type
152
+
153
+ # List of allowed tool names or a filter object.
154
+ sig do
155
+ returns(
156
+ T.nilable(
157
+ T.any(
158
+ T::Array[String],
159
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::AllowedTools::McpToolFilter
160
+ )
161
+ )
162
+ )
163
+ end
164
+ attr_accessor :allowed_tools
165
+
166
+ # An OAuth access token that can be used with a remote MCP server, either with a
167
+ # custom MCP server URL or a service connector. Your application must handle the
168
+ # OAuth authorization flow and provide the token here.
169
+ sig { returns(T.nilable(String)) }
170
+ attr_reader :authorization
171
+
172
+ sig { params(authorization: String).void }
173
+ attr_writer :authorization
174
+
175
+ # Identifier for service connectors, like those available in ChatGPT. One of
176
+ # `server_url` or `connector_id` must be provided. Learn more about service
177
+ # connectors
178
+ # [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
179
+ #
180
+ # Currently supported `connector_id` values are:
181
+ #
182
+ # - Dropbox: `connector_dropbox`
183
+ # - Gmail: `connector_gmail`
184
+ # - Google Calendar: `connector_googlecalendar`
185
+ # - Google Drive: `connector_googledrive`
186
+ # - Microsoft Teams: `connector_microsoftteams`
187
+ # - Outlook Calendar: `connector_outlookcalendar`
188
+ # - Outlook Email: `connector_outlookemail`
189
+ # - SharePoint: `connector_sharepoint`
190
+ sig do
191
+ returns(
192
+ T.nilable(
193
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::OrSymbol
194
+ )
195
+ )
196
+ end
197
+ attr_reader :connector_id
198
+
199
+ sig do
200
+ params(
201
+ connector_id:
202
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::OrSymbol
203
+ ).void
204
+ end
205
+ attr_writer :connector_id
206
+
207
+ # Optional HTTP headers to send to the MCP server. Use for authentication or other
208
+ # purposes.
209
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
210
+ attr_accessor :headers
211
+
212
+ # Specify which of the MCP server's tools require approval.
213
+ sig do
214
+ returns(
215
+ T.nilable(
216
+ T.any(
217
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter,
218
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalSetting::OrSymbol
219
+ )
220
+ )
221
+ )
222
+ end
223
+ attr_accessor :require_approval
224
+
225
+ # Optional description of the MCP server, used to provide more context.
226
+ sig { returns(T.nilable(String)) }
227
+ attr_reader :server_description
228
+
229
+ sig { params(server_description: String).void }
230
+ attr_writer :server_description
231
+
232
+ # The URL for the MCP server. One of `server_url` or `connector_id` must be
233
+ # provided.
234
+ sig { returns(T.nilable(String)) }
235
+ attr_reader :server_url
236
+
237
+ sig { params(server_url: String).void }
238
+ attr_writer :server_url
239
+
240
+ # Give the model access to additional tools via remote Model Context Protocol
241
+ # (MCP) servers.
242
+ # [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
243
+ sig do
244
+ params(
245
+ server_label: String,
246
+ allowed_tools:
247
+ T.nilable(
248
+ T.any(
249
+ T::Array[String],
250
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::AllowedTools::McpToolFilter::OrHash
251
+ )
252
+ ),
253
+ authorization: String,
254
+ connector_id:
255
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::OrSymbol,
256
+ headers: T.nilable(T::Hash[Symbol, String]),
257
+ require_approval:
258
+ T.nilable(
259
+ T.any(
260
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::OrHash,
261
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalSetting::OrSymbol
262
+ )
263
+ ),
264
+ server_description: String,
265
+ server_url: String,
266
+ type: Symbol
267
+ ).returns(T.attached_class)
268
+ end
269
+ def self.new(
270
+ # A label for this MCP server, used to identify it in tool calls.
271
+ server_label:,
272
+ # List of allowed tool names or a filter object.
273
+ allowed_tools: nil,
274
+ # An OAuth access token that can be used with a remote MCP server, either with a
275
+ # custom MCP server URL or a service connector. Your application must handle the
276
+ # OAuth authorization flow and provide the token here.
277
+ authorization: nil,
278
+ # Identifier for service connectors, like those available in ChatGPT. One of
279
+ # `server_url` or `connector_id` must be provided. Learn more about service
280
+ # connectors
281
+ # [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
282
+ #
283
+ # Currently supported `connector_id` values are:
284
+ #
285
+ # - Dropbox: `connector_dropbox`
286
+ # - Gmail: `connector_gmail`
287
+ # - Google Calendar: `connector_googlecalendar`
288
+ # - Google Drive: `connector_googledrive`
289
+ # - Microsoft Teams: `connector_microsoftteams`
290
+ # - Outlook Calendar: `connector_outlookcalendar`
291
+ # - Outlook Email: `connector_outlookemail`
292
+ # - SharePoint: `connector_sharepoint`
293
+ connector_id: nil,
294
+ # Optional HTTP headers to send to the MCP server. Use for authentication or other
295
+ # purposes.
296
+ headers: nil,
297
+ # Specify which of the MCP server's tools require approval.
298
+ require_approval: nil,
299
+ # Optional description of the MCP server, used to provide more context.
300
+ server_description: nil,
301
+ # The URL for the MCP server. One of `server_url` or `connector_id` must be
302
+ # provided.
303
+ server_url: nil,
304
+ # The type of the MCP tool. Always `mcp`.
305
+ type: :mcp
306
+ )
307
+ end
308
+
309
+ sig do
310
+ override.returns(
311
+ {
312
+ server_label: String,
313
+ type: Symbol,
314
+ allowed_tools:
315
+ T.nilable(
316
+ T.any(
317
+ T::Array[String],
318
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::AllowedTools::McpToolFilter
319
+ )
320
+ ),
321
+ authorization: String,
322
+ connector_id:
323
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::OrSymbol,
324
+ headers: T.nilable(T::Hash[Symbol, String]),
325
+ require_approval:
326
+ T.nilable(
327
+ T.any(
328
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter,
329
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalSetting::OrSymbol
330
+ )
331
+ ),
332
+ server_description: String,
333
+ server_url: String
334
+ }
335
+ )
336
+ end
337
+ def to_hash
338
+ end
339
+
340
+ # List of allowed tool names or a filter object.
341
+ module AllowedTools
342
+ extend OpenAI::Internal::Type::Union
343
+
344
+ Variants =
345
+ T.type_alias do
346
+ T.any(
347
+ T::Array[String],
348
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::AllowedTools::McpToolFilter
349
+ )
350
+ end
351
+
352
+ class McpToolFilter < OpenAI::Internal::Type::BaseModel
353
+ OrHash =
354
+ T.type_alias do
355
+ T.any(
356
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::AllowedTools::McpToolFilter,
357
+ OpenAI::Internal::AnyHash
358
+ )
359
+ end
360
+
361
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
362
+ # is
363
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
364
+ # it will match this filter.
365
+ sig { returns(T.nilable(T::Boolean)) }
366
+ attr_reader :read_only
367
+
368
+ sig { params(read_only: T::Boolean).void }
369
+ attr_writer :read_only
370
+
371
+ # List of allowed tool names.
372
+ sig { returns(T.nilable(T::Array[String])) }
373
+ attr_reader :tool_names
374
+
375
+ sig { params(tool_names: T::Array[String]).void }
376
+ attr_writer :tool_names
377
+
378
+ # A filter object to specify which tools are allowed.
379
+ sig do
380
+ params(
381
+ read_only: T::Boolean,
382
+ tool_names: T::Array[String]
383
+ ).returns(T.attached_class)
384
+ end
385
+ def self.new(
386
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
387
+ # is
388
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
389
+ # it will match this filter.
390
+ read_only: nil,
391
+ # List of allowed tool names.
392
+ tool_names: nil
393
+ )
394
+ end
395
+
396
+ sig do
397
+ override.returns(
398
+ { read_only: T::Boolean, tool_names: T::Array[String] }
399
+ )
400
+ end
401
+ def to_hash
402
+ end
403
+ end
404
+
405
+ sig do
406
+ override.returns(
407
+ T::Array[
408
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::AllowedTools::Variants
409
+ ]
410
+ )
411
+ end
412
+ def self.variants
413
+ end
414
+
415
+ StringArray =
416
+ T.let(
417
+ OpenAI::Internal::Type::ArrayOf[String],
418
+ OpenAI::Internal::Type::Converter
419
+ )
420
+ end
421
+
422
+ # Identifier for service connectors, like those available in ChatGPT. One of
423
+ # `server_url` or `connector_id` must be provided. Learn more about service
424
+ # connectors
425
+ # [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
426
+ #
427
+ # Currently supported `connector_id` values are:
428
+ #
429
+ # - Dropbox: `connector_dropbox`
430
+ # - Gmail: `connector_gmail`
431
+ # - Google Calendar: `connector_googlecalendar`
432
+ # - Google Drive: `connector_googledrive`
433
+ # - Microsoft Teams: `connector_microsoftteams`
434
+ # - Outlook Calendar: `connector_outlookcalendar`
435
+ # - Outlook Email: `connector_outlookemail`
436
+ # - SharePoint: `connector_sharepoint`
437
+ module ConnectorID
438
+ extend OpenAI::Internal::Type::Enum
439
+
440
+ TaggedSymbol =
441
+ T.type_alias do
442
+ T.all(
443
+ Symbol,
444
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID
445
+ )
446
+ end
447
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
448
+
449
+ CONNECTOR_DROPBOX =
450
+ T.let(
451
+ :connector_dropbox,
452
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
453
+ )
454
+ CONNECTOR_GMAIL =
455
+ T.let(
456
+ :connector_gmail,
457
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
458
+ )
459
+ CONNECTOR_GOOGLECALENDAR =
460
+ T.let(
461
+ :connector_googlecalendar,
462
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
463
+ )
464
+ CONNECTOR_GOOGLEDRIVE =
465
+ T.let(
466
+ :connector_googledrive,
467
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
468
+ )
469
+ CONNECTOR_MICROSOFTTEAMS =
470
+ T.let(
471
+ :connector_microsoftteams,
472
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
473
+ )
474
+ CONNECTOR_OUTLOOKCALENDAR =
475
+ T.let(
476
+ :connector_outlookcalendar,
477
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
478
+ )
479
+ CONNECTOR_OUTLOOKEMAIL =
480
+ T.let(
481
+ :connector_outlookemail,
482
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
483
+ )
484
+ CONNECTOR_SHAREPOINT =
485
+ T.let(
486
+ :connector_sharepoint,
487
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
488
+ )
489
+
490
+ sig do
491
+ override.returns(
492
+ T::Array[
493
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::ConnectorID::TaggedSymbol
494
+ ]
495
+ )
496
+ end
497
+ def self.values
498
+ end
499
+ end
500
+
501
+ # Specify which of the MCP server's tools require approval.
502
+ module RequireApproval
503
+ extend OpenAI::Internal::Type::Union
504
+
505
+ Variants =
506
+ T.type_alias do
507
+ T.any(
508
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter,
509
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalSetting::TaggedSymbol
510
+ )
511
+ end
512
+
513
+ class McpToolApprovalFilter < OpenAI::Internal::Type::BaseModel
514
+ OrHash =
515
+ T.type_alias do
516
+ T.any(
517
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter,
518
+ OpenAI::Internal::AnyHash
519
+ )
520
+ end
521
+
522
+ # A filter object to specify which tools are allowed.
523
+ sig do
524
+ returns(
525
+ T.nilable(
526
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Always
527
+ )
528
+ )
529
+ end
530
+ attr_reader :always
531
+
532
+ sig do
533
+ params(
534
+ always:
535
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Always::OrHash
536
+ ).void
537
+ end
538
+ attr_writer :always
539
+
540
+ # A filter object to specify which tools are allowed.
541
+ sig do
542
+ returns(
543
+ T.nilable(
544
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Never
545
+ )
546
+ )
547
+ end
548
+ attr_reader :never
549
+
550
+ sig do
551
+ params(
552
+ never:
553
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Never::OrHash
554
+ ).void
555
+ end
556
+ attr_writer :never
557
+
558
+ # Specify which of the MCP server's tools require approval. Can be `always`,
559
+ # `never`, or a filter object associated with tools that require approval.
560
+ sig do
561
+ params(
562
+ always:
563
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Always::OrHash,
564
+ never:
565
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Never::OrHash
566
+ ).returns(T.attached_class)
567
+ end
568
+ def self.new(
569
+ # A filter object to specify which tools are allowed.
570
+ always: nil,
571
+ # A filter object to specify which tools are allowed.
572
+ never: nil
573
+ )
574
+ end
575
+
576
+ sig do
577
+ override.returns(
578
+ {
579
+ always:
580
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Always,
581
+ never:
582
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Never
583
+ }
584
+ )
585
+ end
586
+ def to_hash
587
+ end
588
+
589
+ class Always < OpenAI::Internal::Type::BaseModel
590
+ OrHash =
591
+ T.type_alias do
592
+ T.any(
593
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Always,
594
+ OpenAI::Internal::AnyHash
595
+ )
596
+ end
597
+
598
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
599
+ # is
600
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
601
+ # it will match this filter.
602
+ sig { returns(T.nilable(T::Boolean)) }
603
+ attr_reader :read_only
604
+
605
+ sig { params(read_only: T::Boolean).void }
606
+ attr_writer :read_only
607
+
608
+ # List of allowed tool names.
609
+ sig { returns(T.nilable(T::Array[String])) }
610
+ attr_reader :tool_names
611
+
612
+ sig { params(tool_names: T::Array[String]).void }
613
+ attr_writer :tool_names
614
+
615
+ # A filter object to specify which tools are allowed.
616
+ sig do
617
+ params(
618
+ read_only: T::Boolean,
619
+ tool_names: T::Array[String]
620
+ ).returns(T.attached_class)
621
+ end
622
+ def self.new(
623
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
624
+ # is
625
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
626
+ # it will match this filter.
627
+ read_only: nil,
628
+ # List of allowed tool names.
629
+ tool_names: nil
630
+ )
631
+ end
632
+
633
+ sig do
634
+ override.returns(
635
+ { read_only: T::Boolean, tool_names: T::Array[String] }
636
+ )
637
+ end
638
+ def to_hash
639
+ end
640
+ end
641
+
642
+ class Never < OpenAI::Internal::Type::BaseModel
643
+ OrHash =
644
+ T.type_alias do
645
+ T.any(
646
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalFilter::Never,
647
+ OpenAI::Internal::AnyHash
648
+ )
649
+ end
650
+
651
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
652
+ # is
653
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
654
+ # it will match this filter.
655
+ sig { returns(T.nilable(T::Boolean)) }
656
+ attr_reader :read_only
657
+
658
+ sig { params(read_only: T::Boolean).void }
659
+ attr_writer :read_only
660
+
661
+ # List of allowed tool names.
662
+ sig { returns(T.nilable(T::Array[String])) }
663
+ attr_reader :tool_names
664
+
665
+ sig { params(tool_names: T::Array[String]).void }
666
+ attr_writer :tool_names
667
+
668
+ # A filter object to specify which tools are allowed.
669
+ sig do
670
+ params(
671
+ read_only: T::Boolean,
672
+ tool_names: T::Array[String]
673
+ ).returns(T.attached_class)
674
+ end
675
+ def self.new(
676
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
677
+ # is
678
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
679
+ # it will match this filter.
680
+ read_only: nil,
681
+ # List of allowed tool names.
682
+ tool_names: nil
683
+ )
684
+ end
685
+
686
+ sig do
687
+ override.returns(
688
+ { read_only: T::Boolean, tool_names: T::Array[String] }
689
+ )
690
+ end
691
+ def to_hash
692
+ end
693
+ end
694
+ end
695
+
696
+ # Specify a single approval policy for all tools. One of `always` or `never`. When
697
+ # set to `always`, all tools will require approval. When set to `never`, all tools
698
+ # will not require approval.
699
+ module McpToolApprovalSetting
700
+ extend OpenAI::Internal::Type::Enum
701
+
702
+ TaggedSymbol =
703
+ T.type_alias do
704
+ T.all(
705
+ Symbol,
706
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalSetting
707
+ )
708
+ end
709
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
710
+
711
+ ALWAYS =
712
+ T.let(
713
+ :always,
714
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalSetting::TaggedSymbol
715
+ )
716
+ NEVER =
717
+ T.let(
718
+ :never,
719
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalSetting::TaggedSymbol
720
+ )
721
+
722
+ sig do
723
+ override.returns(
724
+ T::Array[
725
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::McpToolApprovalSetting::TaggedSymbol
726
+ ]
727
+ )
728
+ end
729
+ def self.values
730
+ end
731
+ end
732
+
733
+ sig do
734
+ override.returns(
735
+ T::Array[
736
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::RequireApproval::Variants
737
+ ]
738
+ )
739
+ end
740
+ def self.variants
741
+ end
742
+ end
743
+ end
744
+
745
+ sig do
746
+ override.returns(
747
+ T::Array[OpenAI::Realtime::RealtimeToolsConfigUnion::Variants]
748
+ )
749
+ end
750
+ def self.variants
751
+ end
752
+ end
753
+ end
754
+ end
755
+ end