openai 0.83.0 → 0.85.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 (293) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +59 -0
  3. data/README.md +1 -1
  4. data/SECURITY.md +10 -0
  5. data/docs/architecture/security-model.md +267 -0
  6. data/lib/openai/auth/workload_identity_auth.rb +17 -2
  7. data/lib/openai/client.rb +24 -6
  8. data/lib/openai/errors.rb +1 -1
  9. data/lib/openai/helpers/streaming/chat_completion_stream.rb +18 -10
  10. data/lib/openai/helpers/streaming/response_events.rb +2 -2
  11. data/lib/openai/helpers/streaming/response_stream.rb +80 -44
  12. data/lib/openai/helpers/structured_output/array_of.rb +2 -2
  13. data/lib/openai/helpers/structured_output/base_model.rb +19 -5
  14. data/lib/openai/helpers/structured_output/chat_completion_parser.rb +12 -3
  15. data/lib/openai/helpers/structured_output/json_schema_converter.rb +34 -11
  16. data/lib/openai/helpers/structured_output/response_parser.rb +1 -1
  17. data/lib/openai/internal/type/base_model.rb +2 -2
  18. data/lib/openai/internal/type/converter.rb +1 -1
  19. data/lib/openai/internal/util.rb +2 -2
  20. data/lib/openai/internal/vector_store_file_uploader.rb +1 -1
  21. data/lib/openai/models/admin/organization/usage_costs_params.rb +10 -1
  22. data/lib/openai/models/batch.rb +4 -4
  23. data/lib/openai/models/beta/beta_custom_tool.rb +13 -1
  24. data/lib/openai/models/beta/beta_function_tool.rb +8 -1
  25. data/lib/openai/models/beta/beta_namespace_tool.rb +10 -1
  26. data/lib/openai/models/beta/beta_response.rb +26 -18
  27. data/lib/openai/models/beta/beta_response_configuration_update_item.rb +103 -0
  28. data/lib/openai/models/beta/beta_response_configuration_update_item_param.rb +104 -0
  29. data/lib/openai/models/beta/beta_response_custom_tool_call.rb +9 -1
  30. data/lib/openai/models/beta/beta_response_custom_tool_call_item.rb +3 -1
  31. data/lib/openai/models/beta/beta_response_error.rb +96 -1
  32. data/lib/openai/models/beta/beta_response_function_tool_call.rb +9 -1
  33. data/lib/openai/models/beta/beta_response_function_tool_call_item.rb +3 -1
  34. data/lib/openai/models/beta/beta_response_incomplete_event.rb +4 -0
  35. data/lib/openai/models/beta/beta_response_inject_event.rb +2 -2
  36. data/lib/openai/models/beta/beta_response_inject_failed_event.rb +2 -2
  37. data/lib/openai/models/beta/beta_response_input_item.rb +6 -1
  38. data/lib/openai/models/beta/beta_response_item.rb +5 -1
  39. data/lib/openai/models/beta/beta_response_steer_accepted_event.rb +81 -0
  40. data/lib/openai/models/beta/beta_response_steer_error_code.rb +61 -0
  41. data/lib/openai/models/beta/beta_response_steer_event.rb +75 -0
  42. data/lib/openai/models/beta/beta_response_steer_failed_event.rb +151 -0
  43. data/lib/openai/models/beta/beta_response_steer_input.rb +360 -0
  44. data/lib/openai/models/beta/beta_response_steer_input_content.rb +28 -0
  45. data/lib/openai/models/beta/beta_response_steer_pending_event.rb +113 -0
  46. data/lib/openai/models/beta/beta_response_steer_pending_reason.rb +26 -0
  47. data/lib/openai/models/beta/beta_response_steer_required_input.rb +215 -0
  48. data/lib/openai/models/beta/beta_response_stream_event.rb +4 -0
  49. data/lib/openai/models/beta/beta_response_usage.rb +1 -12
  50. data/lib/openai/models/beta/beta_responses_client_event.rb +45 -16
  51. data/lib/openai/models/beta/beta_responses_server_event.rb +164 -2
  52. data/lib/openai/models/beta/response_compact_params.rb +13 -10
  53. data/lib/openai/models/beta/response_create_params.rb +14 -15
  54. data/lib/openai/models/beta/responses/beta_response_item_list.rb +2 -2
  55. data/lib/openai/models/beta/responses/input_token_count_params.rb +3 -3
  56. data/lib/openai/models/chat/completion_create_params.rb +8 -8
  57. data/lib/openai/models/chat_model.rb +1 -0
  58. data/lib/openai/models/completion_usage.rb +1 -12
  59. data/lib/openai/models/conversations/conversation_create_params.rb +2 -2
  60. data/lib/openai/models/conversations/conversation_item.rb +5 -1
  61. data/lib/openai/models/conversations/conversation_item_list.rb +2 -2
  62. data/lib/openai/models/conversations/item_create_params.rb +2 -2
  63. data/lib/openai/models/error_object.rb +90 -1
  64. data/lib/openai/models/eval_create_response.rb +1 -1
  65. data/lib/openai/models/eval_list_response.rb +1 -1
  66. data/lib/openai/models/eval_retrieve_response.rb +1 -1
  67. data/lib/openai/models/eval_update_response.rb +1 -1
  68. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +2 -2
  69. data/lib/openai/models/reasoning.rb +0 -2
  70. data/lib/openai/models/responses/custom_tool.rb +13 -1
  71. data/lib/openai/models/responses/function_tool.rb +8 -1
  72. data/lib/openai/models/responses/input_token_count_params.rb +3 -3
  73. data/lib/openai/models/responses/namespace_tool.rb +10 -1
  74. data/lib/openai/models/responses/response.rb +20 -13
  75. data/lib/openai/models/responses/response_compact_params.rb +13 -10
  76. data/lib/openai/models/responses/response_configuration_update_item.rb +56 -0
  77. data/lib/openai/models/responses/response_configuration_update_item_param.rb +57 -0
  78. data/lib/openai/models/responses/response_create_params.rb +8 -10
  79. data/lib/openai/models/responses/response_custom_tool_call.rb +9 -1
  80. data/lib/openai/models/responses/response_custom_tool_call_item.rb +3 -1
  81. data/lib/openai/models/responses/response_error.rb +96 -1
  82. data/lib/openai/models/responses/response_function_tool_call.rb +9 -1
  83. data/lib/openai/models/responses/response_function_tool_call_item.rb +3 -1
  84. data/lib/openai/models/responses/response_incomplete_event.rb +4 -0
  85. data/lib/openai/models/responses/response_input_item.rb +6 -1
  86. data/lib/openai/models/responses/response_item.rb +5 -1
  87. data/lib/openai/models/responses/response_item_list.rb +2 -2
  88. data/lib/openai/models/responses/response_steer_accepted_event.rb +79 -0
  89. data/lib/openai/models/responses/response_steer_error_code.rb +59 -0
  90. data/lib/openai/models/responses/response_steer_event.rb +73 -0
  91. data/lib/openai/models/responses/response_steer_failed_event.rb +149 -0
  92. data/lib/openai/models/responses/response_steer_input.rb +304 -0
  93. data/lib/openai/models/responses/response_steer_input_content.rb +26 -0
  94. data/lib/openai/models/responses/response_steer_pending_event.rb +111 -0
  95. data/lib/openai/models/responses/response_steer_pending_reason.rb +24 -0
  96. data/lib/openai/models/responses/response_steer_required_input.rb +213 -0
  97. data/lib/openai/models/responses/response_stream_event.rb +4 -0
  98. data/lib/openai/models/responses/response_usage.rb +1 -12
  99. data/lib/openai/models/responses/responses_client_event.rb +872 -771
  100. data/lib/openai/models/responses/responses_server_event.rb +162 -2
  101. data/lib/openai/models/safety/alert_retrieve_params.rb +24 -0
  102. data/lib/openai/models/safety/safety_alert.rb +96 -0
  103. data/lib/openai/models/video_create_error.rb +93 -1
  104. data/lib/openai/models/webhooks/safety_alert_created_webhook_event.rb +63 -0
  105. data/lib/openai/models/webhooks/safety_org_alert_created_webhook_event.rb +63 -0
  106. data/lib/openai/models/webhooks/unwrap_webhook_event.rb +7 -1
  107. data/lib/openai/models.rb +2 -0
  108. data/lib/openai/net_http_client.rb +1 -1
  109. data/lib/openai/providers/bedrock.rb +20 -12
  110. data/lib/openai/resources/admin/organization/usage.rb +3 -1
  111. data/lib/openai/resources/beta/responses/input_items.rb +1 -1
  112. data/lib/openai/resources/beta/responses/input_tokens.rb +1 -1
  113. data/lib/openai/resources/beta/responses.rb +8 -8
  114. data/lib/openai/resources/chat/completions.rb +2 -2
  115. data/lib/openai/resources/conversations/items.rb +3 -3
  116. data/lib/openai/resources/conversations.rb +1 -1
  117. data/lib/openai/resources/responses/input_items.rb +1 -1
  118. data/lib/openai/resources/responses/input_tokens.rb +1 -1
  119. data/lib/openai/resources/responses.rb +10 -9
  120. data/lib/openai/resources/safety/alerts.rb +37 -0
  121. data/lib/openai/resources/safety.rb +18 -0
  122. data/lib/openai/resources/webhooks.rb +1 -1
  123. data/lib/openai/version.rb +1 -1
  124. data/lib/openai.rb +29 -0
  125. data/rbi/openai/client.rbi +3 -0
  126. data/rbi/openai/errors.rbi +1 -1
  127. data/rbi/openai/helpers/streaming/events.rbi +2 -2
  128. data/rbi/openai/helpers/streaming/response_stream.rbi +3 -3
  129. data/rbi/openai/models/admin/organization/usage_costs_params.rbi +15 -0
  130. data/rbi/openai/models/batch.rbi +6 -6
  131. data/rbi/openai/models/beta/beta_custom_tool.rbi +15 -0
  132. data/rbi/openai/models/beta/beta_function_tool.rbi +11 -0
  133. data/rbi/openai/models/beta/beta_namespace_tool.rbi +15 -0
  134. data/rbi/openai/models/beta/beta_response.rbi +21 -18
  135. data/rbi/openai/models/beta/beta_response_configuration_update_item.rbi +200 -0
  136. data/rbi/openai/models/beta/beta_response_configuration_update_item_param.rbi +207 -0
  137. data/rbi/openai/models/beta/beta_response_custom_tool_call.rbi +13 -0
  138. data/rbi/openai/models/beta/beta_response_custom_tool_call_item.rbi +6 -0
  139. data/rbi/openai/models/beta/beta_response_error.rbi +161 -3
  140. data/rbi/openai/models/beta/beta_response_function_tool_call.rbi +13 -0
  141. data/rbi/openai/models/beta/beta_response_function_tool_call_item.rbi +6 -0
  142. data/rbi/openai/models/beta/beta_response_incomplete_event.rbi +4 -0
  143. data/rbi/openai/models/beta/beta_response_inject_event.rbi +3 -0
  144. data/rbi/openai/models/beta/beta_response_inject_failed_event.rbi +3 -0
  145. data/rbi/openai/models/beta/beta_response_input_item.rbi +1 -0
  146. data/rbi/openai/models/beta/beta_response_item.rbi +1 -0
  147. data/rbi/openai/models/beta/beta_response_steer_accepted_event.rbi +148 -0
  148. data/rbi/openai/models/beta/beta_response_steer_error_code.rbi +65 -0
  149. data/rbi/openai/models/beta/beta_response_steer_event.rbi +118 -0
  150. data/rbi/openai/models/beta/beta_response_steer_failed_event.rbi +267 -0
  151. data/rbi/openai/models/beta/beta_response_steer_input.rbi +602 -0
  152. data/rbi/openai/models/beta/beta_response_steer_input_content.rbi +31 -0
  153. data/rbi/openai/models/beta/beta_response_steer_pending_event.rbi +222 -0
  154. data/rbi/openai/models/beta/beta_response_steer_pending_reason.rbi +35 -0
  155. data/rbi/openai/models/beta/beta_response_steer_required_input.rbi +379 -0
  156. data/rbi/openai/models/beta/beta_response_usage.rbi +3 -13
  157. data/rbi/openai/models/beta/beta_responses_client_event.rbi +14 -15
  158. data/rbi/openai/models/beta/beta_responses_server_event.rbi +206 -3
  159. data/rbi/openai/models/beta/response_compact_params.rbi +10 -9
  160. data/rbi/openai/models/beta/response_create_params.rbi +10 -15
  161. data/rbi/openai/models/beta/responses/beta_response_item_list.rbi +1 -0
  162. data/rbi/openai/models/chat/completion_create_params.rbi +9 -9
  163. data/rbi/openai/models/chat_model.rbi +1 -0
  164. data/rbi/openai/models/completion_usage.rbi +0 -10
  165. data/rbi/openai/models/conversations/conversation_create_params.rbi +3 -0
  166. data/rbi/openai/models/conversations/conversation_item.rbi +1 -0
  167. data/rbi/openai/models/conversations/conversation_item_list.rbi +1 -0
  168. data/rbi/openai/models/conversations/item_create_params.rbi +3 -0
  169. data/rbi/openai/models/error_object.rbi +156 -3
  170. data/rbi/openai/models/eval_create_response.rbi +1 -1
  171. data/rbi/openai/models/eval_list_response.rbi +1 -1
  172. data/rbi/openai/models/eval_retrieve_response.rbi +1 -1
  173. data/rbi/openai/models/eval_update_response.rbi +1 -1
  174. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +2 -2
  175. data/rbi/openai/models/reasoning.rbi +0 -2
  176. data/rbi/openai/models/responses/custom_tool.rbi +15 -0
  177. data/rbi/openai/models/responses/function_tool.rbi +11 -0
  178. data/rbi/openai/models/responses/namespace_tool.rbi +15 -0
  179. data/rbi/openai/models/responses/response.rbi +17 -13
  180. data/rbi/openai/models/responses/response_compact_params.rbi +10 -9
  181. data/rbi/openai/models/responses/response_configuration_update_item.rbi +112 -0
  182. data/rbi/openai/models/responses/response_configuration_update_item_param.rbi +117 -0
  183. data/rbi/openai/models/responses/response_create_params.rbi +6 -10
  184. data/rbi/openai/models/responses/response_custom_tool_call.rbi +13 -0
  185. data/rbi/openai/models/responses/response_custom_tool_call_item.rbi +6 -0
  186. data/rbi/openai/models/responses/response_error.rbi +161 -3
  187. data/rbi/openai/models/responses/response_function_tool_call.rbi +13 -0
  188. data/rbi/openai/models/responses/response_function_tool_call_item.rbi +6 -0
  189. data/rbi/openai/models/responses/response_incomplete_event.rbi +4 -0
  190. data/rbi/openai/models/responses/response_input_item.rbi +1 -0
  191. data/rbi/openai/models/responses/response_item.rbi +1 -0
  192. data/rbi/openai/models/responses/response_item_list.rbi +1 -0
  193. data/rbi/openai/models/responses/response_steer_accepted_event.rbi +146 -0
  194. data/rbi/openai/models/responses/response_steer_error_code.rbi +63 -0
  195. data/rbi/openai/models/responses/response_steer_event.rbi +119 -0
  196. data/rbi/openai/models/responses/response_steer_failed_event.rbi +268 -0
  197. data/rbi/openai/models/responses/response_steer_input.rbi +474 -0
  198. data/rbi/openai/models/responses/response_steer_input_content.rbi +29 -0
  199. data/rbi/openai/models/responses/response_steer_pending_event.rbi +220 -0
  200. data/rbi/openai/models/responses/response_steer_pending_reason.rbi +33 -0
  201. data/rbi/openai/models/responses/response_steer_required_input.rbi +377 -0
  202. data/rbi/openai/models/responses/response_usage.rbi +3 -13
  203. data/rbi/openai/models/responses/responses_client_event.rbi +1205 -1041
  204. data/rbi/openai/models/responses/responses_server_event.rbi +202 -3
  205. data/rbi/openai/models/safety/alert_retrieve_params.rbi +55 -0
  206. data/rbi/openai/models/safety/safety_alert.rbi +147 -0
  207. data/rbi/openai/models/video_create_error.rbi +149 -3
  208. data/rbi/openai/models/webhooks/safety_alert_created_webhook_event.rbi +130 -0
  209. data/rbi/openai/models/webhooks/safety_org_alert_created_webhook_event.rbi +130 -0
  210. data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +3 -1
  211. data/rbi/openai/models.rbi +2 -0
  212. data/rbi/openai/resources/admin/organization/usage.rbi +4 -0
  213. data/rbi/openai/resources/beta/responses.rbi +7 -11
  214. data/rbi/openai/resources/chat/completions.rbi +6 -6
  215. data/rbi/openai/resources/conversations/items.rbi +1 -0
  216. data/rbi/openai/resources/conversations.rbi +1 -0
  217. data/rbi/openai/resources/responses.rbi +9 -13
  218. data/rbi/openai/resources/safety/alerts.rbi +30 -0
  219. data/rbi/openai/resources/safety.rbi +18 -0
  220. data/rbi/openai/resources/webhooks.rbi +3 -1
  221. data/sig/openai/client.rbs +2 -0
  222. data/sig/openai/errors.rbs +1 -1
  223. data/sig/openai/internal/transport/base_client.rbs +4 -19
  224. data/sig/openai/models/admin/organization/usage_costs_params.rbs +7 -0
  225. data/sig/openai/models/beta/beta_custom_tool.rbs +7 -0
  226. data/sig/openai/models/beta/beta_function_tool.rbs +7 -0
  227. data/sig/openai/models/beta/beta_namespace_tool.rbs +7 -0
  228. data/sig/openai/models/beta/beta_response.rbs +7 -2
  229. data/sig/openai/models/beta/beta_response_configuration_update_item.rbs +91 -0
  230. data/sig/openai/models/beta/beta_response_configuration_update_item_param.rbs +87 -0
  231. data/sig/openai/models/beta/beta_response_custom_tool_call.rbs +7 -0
  232. data/sig/openai/models/beta/beta_response_custom_tool_call_item.rbs +3 -0
  233. data/sig/openai/models/beta/beta_response_error.rbs +82 -3
  234. data/sig/openai/models/beta/beta_response_function_tool_call.rbs +7 -0
  235. data/sig/openai/models/beta/beta_response_function_tool_call_item.rbs +3 -0
  236. data/sig/openai/models/beta/beta_response_input_item.rbs +1 -0
  237. data/sig/openai/models/beta/beta_response_item.rbs +1 -0
  238. data/sig/openai/models/beta/beta_response_steer_accepted_event.rbs +53 -0
  239. data/sig/openai/models/beta/beta_response_steer_error_code.rbs +31 -0
  240. data/sig/openai/models/beta/beta_response_steer_event.rbs +34 -0
  241. data/sig/openai/models/beta/beta_response_steer_failed_event.rbs +102 -0
  242. data/sig/openai/models/beta/beta_response_steer_input.rbs +214 -0
  243. data/sig/openai/models/beta/beta_response_steer_input_content.rbs +18 -0
  244. data/sig/openai/models/beta/beta_response_steer_pending_event.rbs +63 -0
  245. data/sig/openai/models/beta/beta_response_steer_pending_reason.rbs +16 -0
  246. data/sig/openai/models/beta/beta_response_steer_required_input.rbs +161 -0
  247. data/sig/openai/models/beta/beta_response_usage.rbs +3 -8
  248. data/sig/openai/models/beta/beta_responses_client_event.rbs +4 -1
  249. data/sig/openai/models/beta/beta_responses_server_event.rbs +80 -3
  250. data/sig/openai/models/beta/response_compact_params.rbs +3 -1
  251. data/sig/openai/models/beta/response_create_params.rbs +3 -1
  252. data/sig/openai/models/chat_model.rbs +3 -1
  253. data/sig/openai/models/completion_usage.rbs +0 -5
  254. data/sig/openai/models/conversations/conversation_item.rbs +1 -0
  255. data/sig/openai/models/error_object.rbs +82 -3
  256. data/sig/openai/models/responses/custom_tool.rbs +7 -0
  257. data/sig/openai/models/responses/function_tool.rbs +7 -0
  258. data/sig/openai/models/responses/namespace_tool.rbs +7 -0
  259. data/sig/openai/models/responses/response.rbs +4 -1
  260. data/sig/openai/models/responses/response_compact_params.rbs +3 -1
  261. data/sig/openai/models/responses/response_configuration_update_item.rbs +46 -0
  262. data/sig/openai/models/responses/response_configuration_update_item_param.rbs +46 -0
  263. data/sig/openai/models/responses/response_custom_tool_call.rbs +7 -0
  264. data/sig/openai/models/responses/response_custom_tool_call_item.rbs +3 -0
  265. data/sig/openai/models/responses/response_error.rbs +79 -3
  266. data/sig/openai/models/responses/response_function_tool_call.rbs +7 -0
  267. data/sig/openai/models/responses/response_function_tool_call_item.rbs +3 -0
  268. data/sig/openai/models/responses/response_input_item.rbs +1 -0
  269. data/sig/openai/models/responses/response_item.rbs +1 -0
  270. data/sig/openai/models/responses/response_steer_accepted_event.rbs +51 -0
  271. data/sig/openai/models/responses/response_steer_error_code.rbs +29 -0
  272. data/sig/openai/models/responses/response_steer_event.rbs +32 -0
  273. data/sig/openai/models/responses/response_steer_failed_event.rbs +100 -0
  274. data/sig/openai/models/responses/response_steer_input.rbs +182 -0
  275. data/sig/openai/models/responses/response_steer_input_content.rbs +16 -0
  276. data/sig/openai/models/responses/response_steer_pending_event.rbs +61 -0
  277. data/sig/openai/models/responses/response_steer_pending_reason.rbs +13 -0
  278. data/sig/openai/models/responses/response_steer_required_input.rbs +159 -0
  279. data/sig/openai/models/responses/response_usage.rbs +3 -8
  280. data/sig/openai/models/responses/responses_client_event.rbs +355 -344
  281. data/sig/openai/models/responses/responses_server_event.rbs +80 -3
  282. data/sig/openai/models/safety/alert_retrieve_params.rbs +22 -0
  283. data/sig/openai/models/safety/safety_alert.rbs +81 -0
  284. data/sig/openai/models/video_create_error.rbs +87 -3
  285. data/sig/openai/models/webhooks/safety_alert_created_webhook_event.rbs +52 -0
  286. data/sig/openai/models/webhooks/safety_org_alert_created_webhook_event.rbs +52 -0
  287. data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +2 -0
  288. data/sig/openai/models.rbs +2 -0
  289. data/sig/openai/resources/admin/organization/usage.rbs +1 -0
  290. data/sig/openai/resources/safety/alerts.rbs +14 -0
  291. data/sig/openai/resources/safety.rbs +9 -0
  292. data/sig/openai/resources/webhooks.rbs +3 -1
  293. metadata +86 -1
@@ -3,878 +3,979 @@
3
3
  module OpenAI
4
4
  module Models
5
5
  module Responses
6
- class ResponsesClientEvent < OpenAI::Internal::Type::BaseModel
7
- # @!attribute type
8
- # The type of the client event. Always `response.create`.
9
- #
10
- # @return [Symbol, :"response.create"]
11
- required :type, const: :"response.create"
12
-
13
- # @!attribute background
14
- # Whether to run the model response in the background.
15
- # [Learn more](https://platform.openai.com/docs/guides/background).
16
- #
17
- # @return [Boolean, nil]
18
- optional :background, OpenAI::Internal::Type::Boolean, nil?: true
19
-
20
- # @!attribute context_management
21
- # Context management configuration for this request.
22
- #
23
- # @return [Array<OpenAI::Models::Responses::ResponsesClientEvent::ContextManagement>, nil]
24
- optional(
25
- :context_management,
26
- -> {
27
- OpenAI::Internal::Type::ArrayOf[OpenAI::Responses::ResponsesClientEvent::ContextManagement]
28
- },
29
- nil?: true
30
- )
31
-
32
- # @!attribute conversation
33
- # The conversation that this response belongs to. Items from this conversation are
34
- # prepended to `input_items` for this response request. Input items and output
35
- # items from this response are automatically added to this conversation after this
36
- # response completes.
37
- #
38
- # @return [String, OpenAI::Models::Responses::ResponseConversationParam, nil]
39
- optional(
40
- :conversation,
41
- union: -> {
42
- OpenAI::Responses::ResponsesClientEvent::Conversation
43
- },
44
- nil?: true
45
- )
46
-
47
- # @!attribute include
48
- # Specify additional output data to include in the model response. Currently
49
- # supported values are:
50
- #
51
- # - `web_search_call.action.sources`: Include the sources of the web search tool
52
- # call.
53
- # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
54
- # in code interpreter tool call items.
55
- # - `computer_call_output.output.image_url`: Include image urls from the computer
56
- # call output.
57
- # - `file_search_call.results`: Include the search results of the file search tool
58
- # call.
59
- # - `message.input_image.image_url`: Include image urls from the input message.
60
- # - `message.output_text.logprobs`: Include logprobs with assistant messages.
61
- # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
62
- # tokens in reasoning item outputs. This enables reasoning items to be used in
63
- # multi-turn conversations when using the Responses API statelessly (like when
64
- # the `store` parameter is set to `false`, or when an organization is enrolled
65
- # in the zero data retention program).
66
- #
67
- # @return [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil]
68
- optional(
69
- :include,
70
- -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Responses::ResponseIncludable] },
71
- nil?: true
72
- )
73
-
74
- # @!attribute input
75
- # Text, image, or file inputs to the model, used to generate a response.
76
- #
77
- # Learn more:
78
- #
79
- # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
80
- # - [Image inputs](https://platform.openai.com/docs/guides/images)
81
- # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
82
- # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
83
- # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
84
- #
85
- # @return [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>, nil]
86
- optional :input, union: -> { OpenAI::Responses::ResponsesClientEvent::Input }
87
-
88
- # @!attribute instructions
89
- # A system (or developer) message inserted into the model's context.
90
- #
91
- # When using along with `previous_response_id`, the instructions from a previous
92
- # response will not be carried over to the next response. This makes it simple to
93
- # swap out system (or developer) messages in new responses.
94
- #
95
- # @return [String, nil]
96
- optional :instructions, String, nil?: true
97
-
98
- # @!attribute max_output_tokens
99
- # An upper bound for the number of tokens that can be generated for a response,
100
- # including visible output tokens and
101
- # [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
102
- #
103
- # @return [Integer, nil]
104
- optional :max_output_tokens, Integer, nil?: true
105
-
106
- # @!attribute max_tool_calls
107
- # The maximum number of total calls to built-in tools that can be processed in a
108
- # response. This maximum number applies across all built-in tool calls, not per
109
- # individual tool. Any further attempts to call a tool by the model will be
110
- # ignored.
111
- #
112
- # @return [Integer, nil]
113
- optional :max_tool_calls, Integer, nil?: true
114
-
115
- # @!attribute metadata
116
- # Set of 16 key-value pairs that can be attached to an object. This can be useful
117
- # for storing additional information about the object in a structured format, and
118
- # querying for objects via API or the dashboard.
119
- #
120
- # Keys are strings with a maximum length of 64 characters. Values are strings with
121
- # a maximum length of 512 characters.
122
- #
123
- # @return [Hash{Symbol=>String}, nil]
124
- optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true
125
-
126
- # @!attribute model
127
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
128
- # wide range of models with different capabilities, performance characteristics,
129
- # and price points. Refer to the
130
- # [model guide](https://platform.openai.com/docs/models) to browse and compare
131
- # available models.
132
- #
133
- # @return [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel, nil]
134
- optional :model, union: -> { OpenAI::ResponsesModel }
6
+ # Client events accepted by the Responses WebSocket server.
7
+ module ResponsesClientEvent
8
+ extend OpenAI::Internal::Type::Union
9
+
10
+ discriminator :type
11
+
12
+ # Client event for creating a response over a persistent WebSocket connection.
13
+ # This payload uses the same top-level fields as `POST /v1/responses`, plus
14
+ # WebSocket-only envelope metadata.
15
+ #
16
+ # Notes:
17
+ # - `stream` is implicit over WebSocket and should not be sent.
18
+ # - `background` is not supported over WebSocket.
19
+ # - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.
20
+ variant :"response.create", -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate }
21
+
22
+ # Queues user input to steer a response on this WebSocket connection. Input
23
+ # can contain text, images, and files. Steering is supported only for
24
+ # single-agent responses on models and execution modes that support steering.
25
+ # Responses bound to a conversation or using automatic compaction do not
26
+ # support steering.
27
+ #
28
+ # A `response.steer.accepted` event acknowledges that the server owns the
29
+ # queued input, not that it has been applied. The successor's `response.created`
30
+ # event is the commit point. Input that cannot be committed is returned in
31
+ # `response.steer.failed`.
32
+ #
33
+ # Steering may cause the active response to finish at a safe output boundary
34
+ # with `response.incomplete` and `incomplete_details.reason` set to `steered`,
35
+ # followed automatically by a successor `response.created`. Normal completion
36
+ # can also be followed by an automatic successor. Automatic successors inherit
37
+ # the previous response's settings and continue from it with the queued input.
38
+ #
39
+ # If the response stops for client-owned tool output or approval, accepted
40
+ # steering input remains queued and `response.steer.pending` is emitted after
41
+ # `response.completed`. Fill the `required_input` stubs from that event with
42
+ # saved tool results or approval decisions, and send one explicit
43
+ # `response.create` per parent with the same `previous_response_id` and
44
+ # WebSocket lane. Do not rerun tools or resend accepted steering input. The
45
+ # queued input is prepended in submission order to that request's input, and
46
+ # the explicit request retains its own settings.
47
+ #
48
+ # This event accepts only `type`, `previous_response_id`, and `input`. Do not
49
+ # send `stream_id`; the target response determines the WebSocket lane.
50
+ variant :"response.steer", -> { OpenAI::Responses::ResponseSteerEvent }
51
+
52
+ class ResponseCreate < OpenAI::Internal::Type::BaseModel
53
+ # @!attribute type
54
+ # The type of the client event. Always `response.create`.
55
+ #
56
+ # @return [Symbol, :"response.create"]
57
+ required :type, const: :"response.create"
135
58
 
136
- # @!attribute moderation
137
- # Configuration for running moderation on the input and output of this response.
138
- #
139
- # @return [OpenAI::Models::Responses::ResponsesClientEvent::Moderation, nil]
140
- optional :moderation, -> { OpenAI::Responses::ResponsesClientEvent::Moderation }, nil?: true
59
+ # @!attribute background
60
+ # Whether to run the model response in the background.
61
+ # [Learn more](https://platform.openai.com/docs/guides/background).
62
+ #
63
+ # @return [Boolean, nil]
64
+ optional :background, OpenAI::Internal::Type::Boolean, nil?: true
141
65
 
142
- # @!attribute parallel_tool_calls
143
- # Whether to allow the model to run tool calls in parallel.
144
- #
145
- # @return [Boolean, nil]
146
- optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean, nil?: true
147
-
148
- # @!attribute previous_response_id
149
- # The unique ID of the previous response to the model. Use this to create
150
- # multi-turn conversations. Learn more about
151
- # [conversation state](https://platform.openai.com/docs/guides/conversation-state).
152
- # Cannot be used in conjunction with `conversation`.
153
- #
154
- # @return [String, nil]
155
- optional :previous_response_id, String, nil?: true
66
+ # @!attribute context_management
67
+ # Context management configuration for this request.
68
+ #
69
+ # @return [Array<OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement>, nil]
70
+ optional(
71
+ :context_management,
72
+ -> {
73
+ OpenAI::Internal::Type::ArrayOf[
74
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement
75
+ ]
76
+ },
77
+ nil?: true
78
+ )
79
+
80
+ # @!attribute conversation
81
+ # The conversation that this response belongs to. Items from this conversation are
82
+ # prepended to `input_items` for this response request. Input items and output
83
+ # items from this response are automatically added to this conversation after this
84
+ # response completes.
85
+ #
86
+ # @return [String, OpenAI::Models::Responses::ResponseConversationParam, nil]
87
+ optional(
88
+ :conversation,
89
+ union: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Conversation },
90
+ nil?: true
91
+ )
92
+
93
+ # @!attribute include
94
+ # Specify additional output data to include in the model response. Currently
95
+ # supported values are:
96
+ #
97
+ # - `web_search_call.action.sources`: Include the sources of the web search tool
98
+ # call.
99
+ # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
100
+ # in code interpreter tool call items.
101
+ # - `computer_call_output.output.image_url`: Include image urls from the computer
102
+ # call output.
103
+ # - `file_search_call.results`: Include the search results of the file search tool
104
+ # call.
105
+ # - `message.input_image.image_url`: Include image urls from the input message.
106
+ # - `message.output_text.logprobs`: Include logprobs with assistant messages.
107
+ # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
108
+ # tokens in reasoning item outputs. This enables reasoning items to be used in
109
+ # multi-turn conversations when using the Responses API statelessly (like when
110
+ # the `store` parameter is set to `false`, or when an organization is enrolled
111
+ # in the zero data retention program).
112
+ #
113
+ # @return [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil]
114
+ optional(
115
+ :include,
116
+ -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Responses::ResponseIncludable] },
117
+ nil?: true
118
+ )
119
+
120
+ # @!attribute input
121
+ # Text, image, or file inputs to the model, used to generate a response.
122
+ #
123
+ # Learn more:
124
+ #
125
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
126
+ # - [Image inputs](https://platform.openai.com/docs/guides/images)
127
+ # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
128
+ # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
129
+ # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
130
+ #
131
+ # @return [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseConfigurationUpdateItemParam, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>, nil]
132
+ optional :input, union: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Input }
156
133
 
157
- # @!attribute prompt
158
- # Reference to a prompt template and its variables.
159
- # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
160
- #
161
- # @return [OpenAI::Models::Responses::ResponsePrompt, nil]
162
- optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true
134
+ # @!attribute instructions
135
+ # A system (or developer) message inserted into the model's context.
136
+ #
137
+ # When using along with `previous_response_id`, the instructions from a previous
138
+ # response will not be carried over to the next response. This makes it simple to
139
+ # swap out system (or developer) messages in new responses.
140
+ #
141
+ # @return [String, nil]
142
+ optional :instructions, String, nil?: true
163
143
 
164
- # @!attribute prompt_cache_key
165
- # Used by OpenAI to cache responses for similar requests to optimize your cache
166
- # hit rates. Replaces the `user` field.
167
- # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
168
- #
169
- # @return [String, nil]
170
- optional :prompt_cache_key, String, nil?: true
171
-
172
- # @!attribute prompt_cache_options
173
- # Options for prompt caching. Supported for `gpt-5.6` and later models. By
174
- # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
175
- # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
176
- # request can write up to four breakpoints. For cache matching, OpenAI considers
177
- # up to the latest 80 breakpoints in the conversation, without a content-block
178
- # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
179
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
180
- # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
181
- # for current details.
182
- #
183
- # @return [OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions, nil]
184
- optional :prompt_cache_options, -> { OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions }
144
+ # @!attribute max_output_tokens
145
+ # An upper bound for the number of tokens that can be generated for a response,
146
+ # including visible output tokens and
147
+ # [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
148
+ #
149
+ # @return [Integer, nil]
150
+ optional :max_output_tokens, Integer, nil?: true
185
151
 
186
- # @!attribute prompt_cache_retention
187
- # @deprecated
188
- #
189
- # Deprecated. Use `prompt_cache_options.ttl` instead.
190
- #
191
- # The retention policy for the prompt cache. Set to `24h` to enable extended
192
- # prompt caching, which keeps cached prefixes active for longer, up to a maximum
193
- # of 24 hours.
194
- # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
195
- # This field expresses a maximum retention policy, while
196
- # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
197
- # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
198
- # models, only `24h` is supported.
199
- #
200
- # For older models that support both `in_memory` and `24h`, the default depends on
201
- # your organization's data retention policy:
202
- #
203
- # - Organizations without ZDR enabled default to `24h`.
204
- # - Organizations with ZDR enabled default to `in_memory` when
205
- # `prompt_cache_retention` is not specified.
206
- #
207
- # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheRetention, nil]
208
- optional(
209
- :prompt_cache_retention,
210
- enum: -> { OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention },
211
- nil?: true
212
- )
213
-
214
- # @!attribute reasoning
215
- # **gpt-5 and o-series models only**
216
- #
217
- # Configuration options for
218
- # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
219
- #
220
- # @return [OpenAI::Models::Reasoning, nil]
221
- optional :reasoning, -> { OpenAI::Reasoning }, nil?: true
222
-
223
- # @!attribute safety_identifier
224
- # A stable identifier used to help detect users of your application that may be
225
- # violating OpenAI's usage policies. The IDs should be a string that uniquely
226
- # identifies each user, with a maximum length of 64 characters. We recommend
227
- # hashing their username or email address, in order to avoid sending us any
228
- # identifying information.
229
- # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
230
- #
231
- # @return [String, nil]
232
- optional :safety_identifier, String, nil?: true
152
+ # @!attribute max_tool_calls
153
+ # The maximum number of total calls to built-in tools that can be processed in a
154
+ # response. This maximum number applies across all built-in tool calls, not per
155
+ # individual tool. Any further attempts to call a tool by the model will be
156
+ # ignored.
157
+ #
158
+ # @return [Integer, nil]
159
+ optional :max_tool_calls, Integer, nil?: true
233
160
 
234
- # @!attribute service_tier
235
- # Specifies the processing type used for serving the request.
236
- #
237
- # - If set to 'auto', then the request will be processed with the service tier
238
- # configured in the Project settings. Unless otherwise configured, the Project
239
- # will use 'default'.
240
- # - If set to 'default', then the request will be processed with the standard
241
- # pricing and performance for the selected model.
242
- # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
243
- # then the request will be processed with the Flex Processing service tier.
244
- # - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
245
- # include the `service_tier=fast` or `service_tier=priority` parameter for
246
- # Responses or Chat Completions. The response will show `service_tier=priority`
247
- # regardless of if you specify `service_tier=fast` or `priority` in your
248
- # request.
249
- # - If set to 'ultrafast', then the request will be processed with the
250
- # access-controlled Ultrafast Processing service tier. This tier is currently
251
- # available for `gpt-5.6-sol`; a response served through it will show
252
- # `service_tier=ultrafast`.
253
- # - When not set, the default behavior is 'auto'.
254
- #
255
- # When the `service_tier` parameter is set, the response body will include the
256
- # `service_tier` value based on the processing mode actually used to serve the
257
- # request. This response value may be different from the value set in the
258
- # parameter.
259
- #
260
- # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ServiceTier, nil]
261
- optional :service_tier, enum: -> { OpenAI::Responses::ResponsesClientEvent::ServiceTier }, nil?: true
161
+ # @!attribute metadata
162
+ # Set of 16 key-value pairs that can be attached to an object. This can be useful
163
+ # for storing additional information about the object in a structured format, and
164
+ # querying for objects via API or the dashboard.
165
+ #
166
+ # Keys are strings with a maximum length of 64 characters. Values are strings with
167
+ # a maximum length of 512 characters.
168
+ #
169
+ # @return [Hash{Symbol=>String}, nil]
170
+ optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true
262
171
 
263
- # @!attribute store
264
- # Whether to store the generated model response for later retrieval via API.
265
- #
266
- # @return [Boolean, nil]
267
- optional :store, OpenAI::Internal::Type::Boolean, nil?: true
268
-
269
- # @!attribute stream
270
- # If set to true, the model response data will be streamed to the client as it is
271
- # generated using
272
- # [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
273
- # See the
274
- # [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
275
- # for more information.
276
- #
277
- # @return [Boolean, nil]
278
- optional :stream, OpenAI::Internal::Type::Boolean, nil?: true
172
+ # @!attribute model
173
+ # Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide
174
+ # range of models with different capabilities, performance characteristics, and
175
+ # price points. Refer to the
176
+ # [model guide](https://platform.openai.com/docs/models) to browse and compare
177
+ # available models.
178
+ #
179
+ # @return [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel, nil]
180
+ optional :model, union: -> { OpenAI::ResponsesModel }
279
181
 
280
- # @!attribute stream_id
281
- # The WebSocket lane for this response. Requests with the same `stream_id` are
282
- # processed FIFO, and events for the response echo the same `stream_id`.
283
- #
284
- # `stream_id` controls routing; `previous_response_id` controls conversation
285
- # lineage, so a new lane can fork from a response created on another lane.
286
- #
287
- # @return [String, nil]
288
- optional :stream_id, String
182
+ # @!attribute moderation
183
+ # Configuration for running moderation on the input and output of this response.
184
+ #
185
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation, nil]
186
+ optional(
187
+ :moderation,
188
+ -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation },
189
+ nil?: true
190
+ )
191
+
192
+ # @!attribute parallel_tool_calls
193
+ # Whether to allow the model to run tool calls in parallel.
194
+ #
195
+ # @return [Boolean, nil]
196
+ optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean, nil?: true
289
197
 
290
- # @!attribute stream_options
291
- # Options for streaming responses. Only set this when you set `stream: true`.
292
- #
293
- # @return [OpenAI::Models::Responses::ResponsesClientEvent::StreamOptions, nil]
294
- optional :stream_options, -> { OpenAI::Responses::ResponsesClientEvent::StreamOptions }, nil?: true
295
-
296
- # @!attribute temperature
297
- # What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
298
- # make the output more random, while lower values like 0.2 will make it more
299
- # focused and deterministic. We generally recommend altering this or `top_p` but
300
- # not both.
301
- #
302
- # @return [Float, nil]
303
- optional :temperature, Float, nil?: true
198
+ # @!attribute previous_response_id
199
+ # The unique ID of the previous response to the model. Use this to create
200
+ # multi-turn conversations. Learn more about
201
+ # [conversation state](https://platform.openai.com/docs/guides/conversation-state).
202
+ # Cannot be used in conjunction with `conversation`.
203
+ #
204
+ # @return [String, nil]
205
+ optional :previous_response_id, String, nil?: true
304
206
 
305
- # @!attribute text
306
- # Configuration options for a text response from the model. Can be plain text or
307
- # structured JSON data. Learn more:
308
- #
309
- # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
310
- # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
311
- #
312
- # @return [OpenAI::Models::Responses::ResponseTextConfig, nil]
313
- optional :text, -> { OpenAI::Responses::ResponseTextConfig }
207
+ # @!attribute prompt
208
+ # Reference to a prompt template and its variables.
209
+ # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
210
+ #
211
+ # @return [OpenAI::Models::Responses::ResponsePrompt, nil]
212
+ optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true
314
213
 
315
- # @!attribute tool_choice
316
- # How the model should select which tool (or tools) to use when generating a
317
- # response. See the `tools` parameter to see how to specify which tools the model
318
- # can call.
319
- #
320
- # @return [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell, nil]
321
- optional :tool_choice, union: -> { OpenAI::Responses::ResponsesClientEvent::ToolChoice }
214
+ # @!attribute prompt_cache_key
215
+ # Used by OpenAI to cache responses for similar requests to optimize your cache
216
+ # hit rates. Replaces the `user` field.
217
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
218
+ #
219
+ # @return [String, nil]
220
+ optional :prompt_cache_key, String, nil?: true
322
221
 
323
- # @!attribute tools
324
- # An array of tools the model may call while generating a response. You can
325
- # specify which tool to use by setting the `tool_choice` parameter.
326
- #
327
- # We support the following categories of tools:
328
- #
329
- # - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
330
- # capabilities, like
331
- # [web search](https://platform.openai.com/docs/guides/tools-web-search) or
332
- # [file search](https://platform.openai.com/docs/guides/tools-file-search).
333
- # Learn more about
334
- # [built-in tools](https://platform.openai.com/docs/guides/tools).
335
- # - **MCP Tools**: Integrations with third-party systems via custom MCP servers or
336
- # predefined connectors such as Google Drive and SharePoint. Learn more about
337
- # [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
338
- # - **Function calls (custom tools)**: Functions that are defined by you, enabling
339
- # the model to call your own code with strongly typed arguments and outputs.
340
- # Learn more about
341
- # [function calling](https://platform.openai.com/docs/guides/function-calling).
342
- # You can also use custom tools to call your own code.
343
- #
344
- # @return [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::ComputerUsePreviewTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ProgrammaticToolCalling, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::FunctionShellTool, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::NamespaceTool, OpenAI::Models::Responses::ToolSearchTool, OpenAI::Models::Responses::ApplyPatchTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>, nil]
345
- optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::Tool] }
222
+ # @!attribute prompt_cache_options
223
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
224
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
225
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
226
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
227
+ # up to the latest 80 breakpoints in the conversation, without a content-block
228
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
229
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
230
+ # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
231
+ # for current details.
232
+ #
233
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions, nil]
234
+ optional(
235
+ :prompt_cache_options,
236
+ -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions }
237
+ )
238
+
239
+ # @!attribute prompt_cache_retention
240
+ # @deprecated
241
+ #
242
+ # Deprecated. Use `prompt_cache_options.ttl` instead.
243
+ #
244
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
245
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
246
+ # of 24 hours.
247
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
248
+ # This field expresses a maximum retention policy, while
249
+ # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
250
+ # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
251
+ # models, only `24h` is supported.
252
+ #
253
+ # For older models that support both `in_memory` and `24h`, the default depends on
254
+ # your organization's data retention policy:
255
+ #
256
+ # - Organizations without ZDR enabled default to `24h`.
257
+ # - Organizations with ZDR enabled default to `in_memory` when
258
+ # `prompt_cache_retention` is not specified.
259
+ #
260
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention, nil]
261
+ optional(
262
+ :prompt_cache_retention,
263
+ enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention },
264
+ nil?: true
265
+ )
266
+
267
+ # @!attribute reasoning
268
+ # Configuration options for
269
+ # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
270
+ #
271
+ # @return [OpenAI::Models::Reasoning, nil]
272
+ optional :reasoning, -> { OpenAI::Reasoning }, nil?: true
273
+
274
+ # @!attribute safety_identifier
275
+ # A stable identifier used to help detect users of your application that may be
276
+ # violating OpenAI's usage policies. The IDs should be a string that uniquely
277
+ # identifies each user, with a maximum length of 64 characters. We recommend
278
+ # hashing their username or email address, in order to avoid sending us any
279
+ # identifying information.
280
+ # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
281
+ #
282
+ # @return [String, nil]
283
+ optional :safety_identifier, String, nil?: true
346
284
 
347
- # @!attribute top_logprobs
348
- # An integer between 0 and 20 specifying the maximum number of most likely tokens
349
- # to return at each token position, each with an associated log probability. In
350
- # some cases, the number of returned tokens may be fewer than requested.
351
- #
352
- # @return [Integer, nil]
353
- optional :top_logprobs, Integer, nil?: true
285
+ # @!attribute service_tier
286
+ # Specifies the processing type used for serving the request.
287
+ #
288
+ # - If set to 'auto', then the request will be processed with the service tier
289
+ # configured in the Project settings. Unless otherwise configured, the Project
290
+ # will use 'default'.
291
+ # - If set to 'default', then the request will be processed with the standard
292
+ # pricing and performance for the selected model.
293
+ # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
294
+ # then the request will be processed with the Flex Processing service tier.
295
+ # - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
296
+ # include the `service_tier=fast` or `service_tier=priority` parameter for
297
+ # Responses or Chat Completions. The response will show `service_tier=priority`
298
+ # regardless of if you specify `service_tier=fast` or `priority` in your
299
+ # request.
300
+ # - If set to 'ultrafast', then the request will be processed with the
301
+ # access-controlled Ultrafast Processing service tier. This tier is currently
302
+ # available for `gpt-5.6-sol`; a response served through it will show
303
+ # `service_tier=ultrafast`.
304
+ # - When not set, the default behavior is 'auto'.
305
+ #
306
+ # When the `service_tier` parameter is set, the response body will include the
307
+ # `service_tier` value based on the processing mode actually used to serve the
308
+ # request. This response value may be different from the value set in the
309
+ # parameter.
310
+ #
311
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier, nil]
312
+ optional(
313
+ :service_tier,
314
+ enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier },
315
+ nil?: true
316
+ )
317
+
318
+ # @!attribute store
319
+ # Whether to store the generated model response for later retrieval via API.
320
+ #
321
+ # @return [Boolean, nil]
322
+ optional :store, OpenAI::Internal::Type::Boolean, nil?: true
323
+
324
+ # @!attribute stream
325
+ # If set to true, the model response data will be streamed to the client as it is
326
+ # generated using
327
+ # [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
328
+ # See the
329
+ # [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
330
+ # for more information.
331
+ #
332
+ # @return [Boolean, nil]
333
+ optional :stream, OpenAI::Internal::Type::Boolean, nil?: true
354
334
 
355
- # @!attribute top_p
356
- # An alternative to sampling with temperature, called nucleus sampling, where the
357
- # model considers the results of the tokens with top_p probability mass. So 0.1
358
- # means only the tokens comprising the top 10% probability mass are considered.
359
- #
360
- # We generally recommend altering this or `temperature` but not both.
361
- #
362
- # @return [Float, nil]
363
- optional :top_p, Float, nil?: true
335
+ # @!attribute stream_id
336
+ # The WebSocket lane for this response. Requests with the same `stream_id` are
337
+ # processed FIFO, and events for the response echo the same `stream_id`.
338
+ #
339
+ # `stream_id` controls routing; `previous_response_id` controls conversation
340
+ # lineage, so a new lane can fork from a response created on another lane.
341
+ #
342
+ # @return [String, nil]
343
+ optional :stream_id, String
364
344
 
365
- # @!attribute truncation
366
- # @deprecated
367
- #
368
- # The truncation strategy to use for the model response.
369
- #
370
- # - `auto`: If the input to this Response exceeds the model's context window size,
371
- # the model will truncate the response to fit the context window by dropping
372
- # items from the beginning of the conversation.
373
- # - `disabled` (default): If the input size will exceed the context window size
374
- # for a model, the request will fail with a 400 error.
375
- #
376
- # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::Truncation, nil]
377
- optional :truncation, enum: -> { OpenAI::Responses::ResponsesClientEvent::Truncation }, nil?: true
345
+ # @!attribute stream_options
346
+ # Options for streaming responses. Only set this when you set `stream: true`.
347
+ #
348
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions, nil]
349
+ optional(
350
+ :stream_options,
351
+ -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions },
352
+ nil?: true
353
+ )
354
+
355
+ # @!attribute temperature
356
+ # What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
357
+ # make the output more random, while lower values like 0.2 will make it more
358
+ # focused and deterministic. We generally recommend altering this or `top_p` but
359
+ # not both.
360
+ #
361
+ # @return [Float, nil]
362
+ optional :temperature, Float, nil?: true
378
363
 
379
- # @!attribute user
380
- # @deprecated
381
- #
382
- # This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
383
- # `prompt_cache_key` instead to maintain caching optimizations. A stable
384
- # identifier for your end-users. Used to boost cache hit rates by better bucketing
385
- # similar requests and to help OpenAI detect and prevent abuse.
386
- # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
387
- #
388
- # @return [String, nil]
389
- optional :user, String
364
+ # @!attribute text
365
+ # Configuration options for a text response from the model. Can be plain text or
366
+ # structured JSON data. Learn more:
367
+ #
368
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
369
+ # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
370
+ #
371
+ # @return [OpenAI::Models::Responses::ResponseTextConfig, nil]
372
+ optional :text, -> { OpenAI::Responses::ResponseTextConfig }
390
373
 
391
- # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_id: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
392
- # Some parameter documentations has been truncated, see
393
- # {OpenAI::Models::Responses::ResponsesClientEvent} for more details.
394
- #
395
- # @param background [Boolean, nil] Whether to run the model response in the background.
396
- #
397
- # @param context_management [Array<OpenAI::Models::Responses::ResponsesClientEvent::ContextManagement>, nil] Context management configuration for this request.
398
- #
399
- # @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
400
- #
401
- # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently suppo
402
- #
403
- # @param input [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>] Text, image, or file inputs to the model, used to generate a response.
404
- #
405
- # @param instructions [String, nil] A system (or developer) message inserted into the model's context.
406
- #
407
- # @param max_output_tokens [Integer, nil] An upper bound for the number of tokens that can be generated for a response, in
408
- #
409
- # @param max_tool_calls [Integer, nil] The maximum number of total calls to built-in tools that can be processed in a r
410
- #
411
- # @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. This can be
412
- #
413
- # @param model [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel] Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI
414
- #
415
- # @param moderation [OpenAI::Models::Responses::ResponsesClientEvent::Moderation, nil] Configuration for running moderation on the input and output of this response.
416
- #
417
- # @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
418
- #
419
- # @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to
420
- #
421
- # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables.
422
- #
423
- # @param prompt_cache_key [String, nil] Used by OpenAI to cache responses for similar requests to optimize your cache hi
424
- #
425
- # @param prompt_cache_options [OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions] Options for prompt caching. Supported for `gpt-5.6` and later models. By default
426
- #
427
- # @param prompt_cache_retention [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheRetention, nil] Deprecated. Use `prompt_cache_options.ttl` instead.
428
- #
429
- # @param reasoning [OpenAI::Models::Reasoning, nil] **gpt-5 and o-series models only**
430
- #
431
- # @param safety_identifier [String, nil] A stable identifier used to help detect users of your application that may be vi
432
- #
433
- # @param service_tier [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ServiceTier, nil] Specifies the processing type used for serving the request.
434
- #
435
- # @param store [Boolean, nil] Whether to store the generated model response for later retrieval via
436
- #
437
- # @param stream [Boolean, nil] If set to true, the model response data will be streamed to the client
438
- #
439
- # @param stream_id [String] The WebSocket lane for this response. Requests with the same
440
- #
441
- # @param stream_options [OpenAI::Models::Responses::ResponsesClientEvent::StreamOptions, nil] Options for streaming responses. Only set this when you set `stream: true`.
442
- #
443
- # @param temperature [Float, nil] What sampling temperature to use, between 0 and 2. Higher values like 0.8 will m
444
- #
445
- # @param text [OpenAI::Models::Responses::ResponseTextConfig] Configuration options for a text response from the model. Can be plain
446
- #
447
- # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell] How the model should select which tool (or tools) to use when generating
448
- #
449
- # @param tools [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::ComputerUsePreviewTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ProgrammaticToolCalling, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::FunctionShellTool, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::NamespaceTool, OpenAI::Models::Responses::ToolSearchTool, OpenAI::Models::Responses::ApplyPatchTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>] An array of tools the model may call while generating a response. You
450
- #
451
- # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely
452
- #
453
- # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling,
454
- #
455
- # @param truncation [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::Truncation, nil] The truncation strategy to use for the model response.
456
- #
457
- # @param user [String] This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
458
- #
459
- # @param type [Symbol, :"response.create"] The type of the client event. Always `response.create`.
374
+ # @!attribute tool_choice
375
+ # How the model should select which tool (or tools) to use when generating a
376
+ # response. See the `tools` parameter to see how to specify which tools the model
377
+ # can call.
378
+ #
379
+ # @return [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell, nil]
380
+ optional :tool_choice, union: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice }
460
381
 
461
- class ContextManagement < OpenAI::Internal::Type::BaseModel
462
- # @!attribute type
463
- # The context management entry type. Currently only 'compaction' is supported.
382
+ # @!attribute tools
383
+ # An array of tools the model may call while generating a response. You can
384
+ # specify which tool to use by setting the `tool_choice` parameter.
385
+ #
386
+ # We support the following categories of tools:
387
+ #
388
+ # - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
389
+ # capabilities, like
390
+ # [web search](https://platform.openai.com/docs/guides/tools-web-search) or
391
+ # [file search](https://platform.openai.com/docs/guides/tools-file-search).
392
+ # Learn more about
393
+ # [built-in tools](https://platform.openai.com/docs/guides/tools).
394
+ # - **MCP Tools**: Integrations with third-party systems via custom MCP servers or
395
+ # predefined connectors such as Google Drive and SharePoint. Learn more about
396
+ # [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
397
+ # - **Function calls (custom tools)**: Functions that are defined by you, enabling
398
+ # the model to call your own code with strongly typed arguments and outputs.
399
+ # Learn more about
400
+ # [function calling](https://platform.openai.com/docs/guides/function-calling).
401
+ # You can also use custom tools to call your own code.
464
402
  #
465
- # @return [String]
466
- required :type, String
403
+ # @return [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::ComputerUsePreviewTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ProgrammaticToolCalling, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::FunctionShellTool, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::NamespaceTool, OpenAI::Models::Responses::ToolSearchTool, OpenAI::Models::Responses::ApplyPatchTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>, nil]
404
+ optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::Tool] }
467
405
 
468
- # @!attribute compact_threshold
469
- # Token threshold at which compaction should be triggered for this entry.
406
+ # @!attribute top_logprobs
407
+ # An integer between 0 and 20 specifying the maximum number of most likely tokens
408
+ # to return at each token position, each with an associated log probability. In
409
+ # some cases, the number of returned tokens may be fewer than requested.
470
410
  #
471
411
  # @return [Integer, nil]
472
- optional :compact_threshold, Integer, nil?: true
412
+ optional :top_logprobs, Integer, nil?: true
473
413
 
474
- # @!method initialize(type:, compact_threshold: nil)
475
- # @param type [String] The context management entry type. Currently only 'compaction' is supported.
414
+ # @!attribute top_p
415
+ # An alternative to sampling with temperature, called nucleus sampling, where the
416
+ # model considers the results of the tokens with top_p probability mass. So 0.1
417
+ # means only the tokens comprising the top 10% probability mass are considered.
476
418
  #
477
- # @param compact_threshold [Integer, nil] Token threshold at which compaction should be triggered for this entry.
478
- end
479
-
480
- # The conversation that this response belongs to. Items from this conversation are
481
- # prepended to `input_items` for this response request. Input items and output
482
- # items from this response are automatically added to this conversation after this
483
- # response completes.
484
- #
485
- # @see OpenAI::Models::Responses::ResponsesClientEvent#conversation
486
- module Conversation
487
- extend OpenAI::Internal::Type::Union
419
+ # We generally recommend altering this or `temperature` but not both.
420
+ #
421
+ # @return [Float, nil]
422
+ optional :top_p, Float, nil?: true
488
423
 
489
- # The unique ID of the conversation.
490
- variant String
424
+ # @!attribute truncation
425
+ # @deprecated
426
+ #
427
+ # The truncation strategy to use for the model response.
428
+ #
429
+ # - `auto`: If the input to this Response exceeds the model's context window size,
430
+ # the model will truncate the response to fit the context window by dropping
431
+ # items from the beginning of the conversation.
432
+ # - `disabled` (default): If the input size will exceed the context window size
433
+ # for a model, the request will fail with a 400 error.
434
+ #
435
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Truncation, nil]
436
+ optional(
437
+ :truncation,
438
+ enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation },
439
+ nil?: true
440
+ )
441
+
442
+ # @!attribute user
443
+ # @deprecated
444
+ #
445
+ # This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
446
+ # `prompt_cache_key` instead to maintain caching optimizations. A stable
447
+ # identifier for your end-users. Used to boost cache hit rates by better bucketing
448
+ # similar requests and to help OpenAI detect and prevent abuse.
449
+ # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
450
+ #
451
+ # @return [String, nil]
452
+ optional :user, String
491
453
 
492
- # The conversation that this response belongs to.
493
- variant -> { OpenAI::Responses::ResponseConversationParam }
454
+ # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_id: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
455
+ # Some parameter documentations has been truncated, see
456
+ # {OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate} for more
457
+ # details.
458
+ #
459
+ # Client event for creating a response over a persistent WebSocket connection.
460
+ # This payload uses the same top-level fields as `POST /v1/responses`, plus
461
+ # WebSocket-only envelope metadata.
462
+ #
463
+ # Notes:
464
+ #
465
+ # - `stream` is implicit over WebSocket and should not be sent.
466
+ # - `background` is not supported over WebSocket.
467
+ # - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.
468
+ #
469
+ # @param background [Boolean, nil] Whether to run the model response in the background.
470
+ #
471
+ # @param context_management [Array<OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement>, nil] Context management configuration for this request.
472
+ #
473
+ # @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
474
+ #
475
+ # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently suppo
476
+ #
477
+ # @param input [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseConfigurationUpdateItemParam, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>] Text, image, or file inputs to the model, used to generate a response.
478
+ #
479
+ # @param instructions [String, nil] A system (or developer) message inserted into the model's context.
480
+ #
481
+ # @param max_output_tokens [Integer, nil] An upper bound for the number of tokens that can be generated for a response, in
482
+ #
483
+ # @param max_tool_calls [Integer, nil] The maximum number of total calls to built-in tools that can be processed in a r
484
+ #
485
+ # @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. This can be
486
+ #
487
+ # @param model [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel] Model ID used to generate the response, like `gpt-6-astra`. OpenAI
488
+ #
489
+ # @param moderation [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation, nil] Configuration for running moderation on the input and output of this response.
490
+ #
491
+ # @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
492
+ #
493
+ # @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to
494
+ #
495
+ # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables.
496
+ #
497
+ # @param prompt_cache_key [String, nil] Used by OpenAI to cache responses for similar requests to optimize your cache hi
498
+ #
499
+ # @param prompt_cache_options [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions] Options for prompt caching. Supported for `gpt-5.6` and later models. By default
500
+ #
501
+ # @param prompt_cache_retention [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention, nil] Deprecated. Use `prompt_cache_options.ttl` instead.
502
+ #
503
+ # @param reasoning [OpenAI::Models::Reasoning, nil] Configuration options for
504
+ #
505
+ # @param safety_identifier [String, nil] A stable identifier used to help detect users of your application that may be vi
506
+ #
507
+ # @param service_tier [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier, nil] Specifies the processing type used for serving the request.
508
+ #
509
+ # @param store [Boolean, nil] Whether to store the generated model response for later retrieval via
510
+ #
511
+ # @param stream [Boolean, nil] If set to true, the model response data will be streamed to the client
512
+ #
513
+ # @param stream_id [String] The WebSocket lane for this response. Requests with the same
514
+ #
515
+ # @param stream_options [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions, nil] Options for streaming responses. Only set this when you set `stream: true`.
516
+ #
517
+ # @param temperature [Float, nil] What sampling temperature to use, between 0 and 2. Higher values like 0.8 will m
518
+ #
519
+ # @param text [OpenAI::Models::Responses::ResponseTextConfig] Configuration options for a text response from the model. Can be plain
520
+ #
521
+ # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell] How the model should select which tool (or tools) to use when generating
522
+ #
523
+ # @param tools [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::ComputerUsePreviewTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ProgrammaticToolCalling, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::FunctionShellTool, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::NamespaceTool, OpenAI::Models::Responses::ToolSearchTool, OpenAI::Models::Responses::ApplyPatchTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>] An array of tools the model may call while generating a response. You
524
+ #
525
+ # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely
526
+ #
527
+ # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling,
528
+ #
529
+ # @param truncation [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Truncation, nil] The truncation strategy to use for the model response.
530
+ #
531
+ # @param user [String] This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
532
+ #
533
+ # @param type [Symbol, :"response.create"] The type of the client event. Always `response.create`.
494
534
 
495
- # @!method self.variants
496
- # @return [Array(String, OpenAI::Models::Responses::ResponseConversationParam)]
497
- end
535
+ class ContextManagement < OpenAI::Internal::Type::BaseModel
536
+ # @!attribute type
537
+ # The context management entry type. Currently only 'compaction' is supported.
538
+ #
539
+ # @return [String]
540
+ required :type, String
498
541
 
499
- # Text, image, or file inputs to the model, used to generate a response.
500
- #
501
- # Learn more:
502
- #
503
- # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
504
- # - [Image inputs](https://platform.openai.com/docs/guides/images)
505
- # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
506
- # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
507
- # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
508
- #
509
- # @see OpenAI::Models::Responses::ResponsesClientEvent#input
510
- module Input
511
- extend OpenAI::Internal::Type::Union
542
+ # @!attribute compact_threshold
543
+ # Token threshold at which compaction should be triggered for this entry.
544
+ #
545
+ # @return [Integer, nil]
546
+ optional :compact_threshold, Integer, nil?: true
512
547
 
513
- # A text input to the model, equivalent to a text input with the
514
- # `user` role.
515
- variant String
548
+ # @!method initialize(type:, compact_threshold: nil)
549
+ # @param type [String] The context management entry type. Currently only 'compaction' is supported.
550
+ #
551
+ # @param compact_threshold [Integer, nil] Token threshold at which compaction should be triggered for this entry.
552
+ end
516
553
 
517
- # A list of one or many input items to the model, containing
518
- # different content types.
519
- variant -> { OpenAI::Responses::ResponseInput }
554
+ # The conversation that this response belongs to. Items from this conversation are
555
+ # prepended to `input_items` for this response request. Input items and output
556
+ # items from this response are automatically added to this conversation after this
557
+ # response completes.
558
+ #
559
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#conversation
560
+ module Conversation
561
+ extend OpenAI::Internal::Type::Union
520
562
 
521
- # @!method self.variants
522
- # @return [Array(String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>)]
523
- end
563
+ # The unique ID of the conversation.
564
+ variant String
524
565
 
525
- # @see OpenAI::Models::Responses::ResponsesClientEvent#moderation
526
- class Moderation < OpenAI::Internal::Type::BaseModel
527
- # @!attribute model
528
- # The moderation model to use for moderated completions, e.g.
529
- # 'omni-moderation-latest'.
530
- #
531
- # @return [String]
532
- required :model, String
566
+ # The conversation that this response belongs to.
567
+ variant -> { OpenAI::Responses::ResponseConversationParam }
533
568
 
534
- # @!attribute policy
535
- # The policy to apply to moderated response input and output.
536
- #
537
- # @return [OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy, nil]
538
- optional :policy, -> { OpenAI::Responses::ResponsesClientEvent::Moderation::Policy }, nil?: true
569
+ # @!method self.variants
570
+ # @return [Array(String, OpenAI::Models::Responses::ResponseConversationParam)]
571
+ end
539
572
 
540
- # @!method initialize(model:, policy: nil)
541
- # Some parameter documentations has been truncated, see
542
- # {OpenAI::Models::Responses::ResponsesClientEvent::Moderation} for more details.
573
+ # Text, image, or file inputs to the model, used to generate a response.
543
574
  #
544
- # Configuration for running moderation on the input and output of this response.
575
+ # Learn more:
545
576
  #
546
- # @param model [String] The moderation model to use for moderated completions, e.g. 'omni-moderation-lat
577
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
578
+ # - [Image inputs](https://platform.openai.com/docs/guides/images)
579
+ # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
580
+ # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
581
+ # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
547
582
  #
548
- # @param policy [OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy, nil] The policy to apply to moderated response input and output.
583
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#input
584
+ module Input
585
+ extend OpenAI::Internal::Type::Union
586
+
587
+ # A text input to the model, equivalent to a text input with the
588
+ # `user` role.
589
+ variant String
590
+
591
+ # A list of one or many input items to the model, containing
592
+ # different content types.
593
+ variant -> { OpenAI::Responses::ResponseInput }
594
+
595
+ # @!method self.variants
596
+ # @return [Array(String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseConfigurationUpdateItemParam, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference, OpenAI::Models::Responses::ResponseInputItem::Program, OpenAI::Models::Responses::ResponseInputItem::ProgramOutput>)]
597
+ end
549
598
 
550
- # @see OpenAI::Models::Responses::ResponsesClientEvent::Moderation#policy
551
- class Policy < OpenAI::Internal::Type::BaseModel
552
- # @!attribute input
553
- # The moderation policy for the response input.
599
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#moderation
600
+ class Moderation < OpenAI::Internal::Type::BaseModel
601
+ # @!attribute model
602
+ # The moderation model to use for moderated completions, e.g.
603
+ # 'omni-moderation-latest'.
554
604
  #
555
- # @return [OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Input, nil]
556
- optional(
557
- :input,
558
- -> {
559
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input
560
- },
561
- nil?: true
562
- )
605
+ # @return [String]
606
+ required :model, String
563
607
 
564
- # @!attribute output
565
- # The moderation policy for the response output.
608
+ # @!attribute policy
609
+ # The policy to apply to moderated response input and output.
566
610
  #
567
- # @return [OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Output, nil]
611
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy, nil]
568
612
  optional(
569
- :output,
570
- -> {
571
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output
572
- },
613
+ :policy,
614
+ -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy },
573
615
  nil?: true
574
616
  )
575
617
 
576
- # @!method initialize(input: nil, output: nil)
577
- # The policy to apply to moderated response input and output.
618
+ # @!method initialize(model:, policy: nil)
619
+ # Some parameter documentations has been truncated, see
620
+ # {OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation}
621
+ # for more details.
578
622
  #
579
- # @param input [OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Input, nil] The moderation policy for the response input.
623
+ # Configuration for running moderation on the input and output of this response.
580
624
  #
581
- # @param output [OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Output, nil] The moderation policy for the response output.
582
-
583
- # @see OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy#input
584
- class Input < OpenAI::Internal::Type::BaseModel
585
- # @!attribute mode
586
- #
587
- # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode]
588
- required :mode, enum: -> { OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode }
625
+ # @param model [String] The moderation model to use for moderated completions, e.g. 'omni-moderation-lat
626
+ #
627
+ # @param policy [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy, nil] The policy to apply to moderated response input and output.
589
628
 
590
- # @!method initialize(mode:)
629
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation#policy
630
+ class Policy < OpenAI::Internal::Type::BaseModel
631
+ # @!attribute input
591
632
  # The moderation policy for the response input.
592
633
  #
593
- # @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode]
594
-
595
- # @see OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Input#mode
596
- module Mode
597
- extend OpenAI::Internal::Type::Enum
598
-
599
- SCORE = :score
600
- BLOCK = :block
634
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input, nil]
635
+ optional(
636
+ :input,
637
+ -> {
638
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input
639
+ },
640
+ nil?: true
641
+ )
642
+
643
+ # @!attribute output
644
+ # The moderation policy for the response output.
645
+ #
646
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output, nil]
647
+ optional(
648
+ :output,
649
+ -> {
650
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output
651
+ },
652
+ nil?: true
653
+ )
654
+
655
+ # @!method initialize(input: nil, output: nil)
656
+ # The policy to apply to moderated response input and output.
657
+ #
658
+ # @param input [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input, nil] The moderation policy for the response input.
659
+ #
660
+ # @param output [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output, nil] The moderation policy for the response output.
661
+
662
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy#input
663
+ class Input < OpenAI::Internal::Type::BaseModel
664
+ # @!attribute mode
665
+ #
666
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode]
667
+ required(
668
+ :mode,
669
+ enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode }
670
+ )
671
+
672
+ # @!method initialize(mode:)
673
+ # The moderation policy for the response input.
674
+ #
675
+ # @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode]
676
+
677
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input#mode
678
+ module Mode
679
+ extend OpenAI::Internal::Type::Enum
680
+
681
+ SCORE = :score
682
+ BLOCK = :block
683
+
684
+ # @!method self.values
685
+ # @return [Array<Symbol>]
686
+ end
687
+ end
601
688
 
602
- # @!method self.values
603
- # @return [Array<Symbol>]
689
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy#output
690
+ class Output < OpenAI::Internal::Type::BaseModel
691
+ # @!attribute mode
692
+ #
693
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode]
694
+ required(
695
+ :mode,
696
+ enum: -> {
697
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode
698
+ }
699
+ )
700
+
701
+ # @!method initialize(mode:)
702
+ # The moderation policy for the response output.
703
+ #
704
+ # @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode]
705
+
706
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output#mode
707
+ module Mode
708
+ extend OpenAI::Internal::Type::Enum
709
+
710
+ SCORE = :score
711
+ BLOCK = :block
712
+
713
+ # @!method self.values
714
+ # @return [Array<Symbol>]
715
+ end
604
716
  end
605
717
  end
718
+ end
606
719
 
607
- # @see OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy#output
608
- class Output < OpenAI::Internal::Type::BaseModel
609
- # @!attribute mode
610
- #
611
- # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode]
612
- required :mode, enum: -> { OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode }
720
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#prompt_cache_options
721
+ class PromptCacheOptions < OpenAI::Internal::Type::BaseModel
722
+ # @!attribute mode
723
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
724
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
725
+ # and writes up to the latest three explicit breakpoints in the request. With
726
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
727
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
728
+ # request does not use prompt caching.
729
+ #
730
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode, nil]
731
+ optional(
732
+ :mode,
733
+ enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode }
734
+ )
613
735
 
614
- # @!method initialize(mode:)
615
- # The moderation policy for the response output.
616
- #
617
- # @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode]
736
+ # @!attribute ttl
737
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
738
+ # written by the request. Defaults to `30m`, which is currently the only supported
739
+ # value. The backend may retain cache entries for longer.
740
+ #
741
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl, nil]
742
+ optional(
743
+ :ttl,
744
+ enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl }
745
+ )
618
746
 
619
- # @see OpenAI::Models::Responses::ResponsesClientEvent::Moderation::Policy::Output#mode
620
- module Mode
621
- extend OpenAI::Internal::Type::Enum
747
+ # @!method initialize(mode: nil, ttl: nil)
748
+ # Some parameter documentations has been truncated, see
749
+ # {OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions}
750
+ # for more details.
751
+ #
752
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
753
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
754
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
755
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
756
+ # up to the latest 80 breakpoints in the conversation, without a content-block
757
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
758
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
759
+ # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
760
+ # for current details.
761
+ #
762
+ # @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode] Controls whether OpenAI automatically creates an implicit cache breakpoint. Defa
763
+ #
764
+ # @param ttl [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl] The minimum lifetime applied to every implicit and explicit cache breakpoint wri
765
+
766
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
767
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
768
+ # and writes up to the latest three explicit breakpoints in the request. With
769
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
770
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
771
+ # request does not use prompt caching.
772
+ #
773
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions#mode
774
+ module Mode
775
+ extend OpenAI::Internal::Type::Enum
622
776
 
623
- SCORE = :score
624
- BLOCK = :block
777
+ IMPLICIT = :implicit
778
+ EXPLICIT = :explicit
625
779
 
626
- # @!method self.values
627
- # @return [Array<Symbol>]
628
- end
780
+ # @!method self.values
781
+ # @return [Array<Symbol>]
629
782
  end
630
- end
631
- end
632
783
 
633
- # @see OpenAI::Models::Responses::ResponsesClientEvent#prompt_cache_options
634
- class PromptCacheOptions < OpenAI::Internal::Type::BaseModel
635
- # @!attribute mode
636
- # Controls whether OpenAI automatically creates an implicit cache breakpoint.
637
- # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
638
- # and writes up to the latest three explicit breakpoints in the request. With
639
- # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
640
- # latest four explicit breakpoints. If there are no explicit breakpoints, the
641
- # request does not use prompt caching.
642
- #
643
- # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions::Mode, nil]
644
- optional :mode, enum: -> { OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode }
784
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
785
+ # written by the request. Defaults to `30m`, which is currently the only supported
786
+ # value. The backend may retain cache entries for longer.
787
+ #
788
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions#ttl
789
+ module Ttl
790
+ extend OpenAI::Internal::Type::Enum
645
791
 
646
- # @!attribute ttl
647
- # The minimum lifetime applied to every implicit and explicit cache breakpoint
648
- # written by the request. Defaults to `30m`, which is currently the only supported
649
- # value. The backend may retain cache entries for longer.
650
- #
651
- # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl, nil]
652
- optional :ttl, enum: -> { OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl }
792
+ TTL_30M = :"30m"
653
793
 
654
- # @!method initialize(mode: nil, ttl: nil)
655
- # Some parameter documentations has been truncated, see
656
- # {OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions} for more
657
- # details.
794
+ # @!method self.values
795
+ # @return [Array<Symbol>]
796
+ end
797
+ end
798
+
799
+ # @deprecated
658
800
  #
659
- # Options for prompt caching. Supported for `gpt-5.6` and later models. By
660
- # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
661
- # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
662
- # request can write up to four breakpoints. For cache matching, OpenAI considers
663
- # up to the latest 80 breakpoints in the conversation, without a content-block
664
- # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
665
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
666
- # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
667
- # for current details.
801
+ # Deprecated. Use `prompt_cache_options.ttl` instead.
668
802
  #
669
- # @param mode [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions::Mode] Controls whether OpenAI automatically creates an implicit cache breakpoint. Defa
803
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
804
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
805
+ # of 24 hours.
806
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
807
+ # This field expresses a maximum retention policy, while
808
+ # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
809
+ # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
810
+ # models, only `24h` is supported.
670
811
  #
671
- # @param ttl [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl] The minimum lifetime applied to every implicit and explicit cache breakpoint wri
672
-
673
- # Controls whether OpenAI automatically creates an implicit cache breakpoint.
674
- # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
675
- # and writes up to the latest three explicit breakpoints in the request. With
676
- # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
677
- # latest four explicit breakpoints. If there are no explicit breakpoints, the
678
- # request does not use prompt caching.
812
+ # For older models that support both `in_memory` and `24h`, the default depends on
813
+ # your organization's data retention policy:
814
+ #
815
+ # - Organizations without ZDR enabled default to `24h`.
816
+ # - Organizations with ZDR enabled default to `in_memory` when
817
+ # `prompt_cache_retention` is not specified.
679
818
  #
680
- # @see OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions#mode
681
- module Mode
819
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#prompt_cache_retention
820
+ module PromptCacheRetention
682
821
  extend OpenAI::Internal::Type::Enum
683
822
 
684
- IMPLICIT = :implicit
685
- EXPLICIT = :explicit
823
+ IN_MEMORY = :in_memory
824
+ PROMPT_CACHE_RETENTION_24H = :"24h"
686
825
 
687
826
  # @!method self.values
688
827
  # @return [Array<Symbol>]
689
828
  end
690
829
 
691
- # The minimum lifetime applied to every implicit and explicit cache breakpoint
692
- # written by the request. Defaults to `30m`, which is currently the only supported
693
- # value. The backend may retain cache entries for longer.
830
+ # Specifies the processing type used for serving the request.
831
+ #
832
+ # - If set to 'auto', then the request will be processed with the service tier
833
+ # configured in the Project settings. Unless otherwise configured, the Project
834
+ # will use 'default'.
835
+ # - If set to 'default', then the request will be processed with the standard
836
+ # pricing and performance for the selected model.
837
+ # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
838
+ # then the request will be processed with the Flex Processing service tier.
839
+ # - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
840
+ # include the `service_tier=fast` or `service_tier=priority` parameter for
841
+ # Responses or Chat Completions. The response will show `service_tier=priority`
842
+ # regardless of if you specify `service_tier=fast` or `priority` in your
843
+ # request.
844
+ # - If set to 'ultrafast', then the request will be processed with the
845
+ # access-controlled Ultrafast Processing service tier. This tier is currently
846
+ # available for `gpt-5.6-sol`; a response served through it will show
847
+ # `service_tier=ultrafast`.
848
+ # - When not set, the default behavior is 'auto'.
849
+ #
850
+ # When the `service_tier` parameter is set, the response body will include the
851
+ # `service_tier` value based on the processing mode actually used to serve the
852
+ # request. This response value may be different from the value set in the
853
+ # parameter.
694
854
  #
695
- # @see OpenAI::Models::Responses::ResponsesClientEvent::PromptCacheOptions#ttl
696
- module Ttl
855
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#service_tier
856
+ module ServiceTier
697
857
  extend OpenAI::Internal::Type::Enum
698
858
 
699
- TTL_30M = :"30m"
859
+ AUTO = :auto
860
+ DEFAULT = :default
861
+ FLEX = :flex
862
+ SCALE = :scale
863
+ PRIORITY = :priority
864
+ FAST = :fast
865
+ ULTRAFAST = :ultrafast
700
866
 
701
867
  # @!method self.values
702
868
  # @return [Array<Symbol>]
703
869
  end
704
- end
705
-
706
- # @deprecated
707
- #
708
- # Deprecated. Use `prompt_cache_options.ttl` instead.
709
- #
710
- # The retention policy for the prompt cache. Set to `24h` to enable extended
711
- # prompt caching, which keeps cached prefixes active for longer, up to a maximum
712
- # of 24 hours.
713
- # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
714
- # This field expresses a maximum retention policy, while
715
- # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
716
- # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
717
- # models, only `24h` is supported.
718
- #
719
- # For older models that support both `in_memory` and `24h`, the default depends on
720
- # your organization's data retention policy:
721
- #
722
- # - Organizations without ZDR enabled default to `24h`.
723
- # - Organizations with ZDR enabled default to `in_memory` when
724
- # `prompt_cache_retention` is not specified.
725
- #
726
- # @see OpenAI::Models::Responses::ResponsesClientEvent#prompt_cache_retention
727
- module PromptCacheRetention
728
- extend OpenAI::Internal::Type::Enum
729
-
730
- IN_MEMORY = :in_memory
731
- PROMPT_CACHE_RETENTION_24H = :"24h"
732
-
733
- # @!method self.values
734
- # @return [Array<Symbol>]
735
- end
736
870
 
737
- # Specifies the processing type used for serving the request.
738
- #
739
- # - If set to 'auto', then the request will be processed with the service tier
740
- # configured in the Project settings. Unless otherwise configured, the Project
741
- # will use 'default'.
742
- # - If set to 'default', then the request will be processed with the standard
743
- # pricing and performance for the selected model.
744
- # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
745
- # then the request will be processed with the Flex Processing service tier.
746
- # - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
747
- # include the `service_tier=fast` or `service_tier=priority` parameter for
748
- # Responses or Chat Completions. The response will show `service_tier=priority`
749
- # regardless of if you specify `service_tier=fast` or `priority` in your
750
- # request.
751
- # - If set to 'ultrafast', then the request will be processed with the
752
- # access-controlled Ultrafast Processing service tier. This tier is currently
753
- # available for `gpt-5.6-sol`; a response served through it will show
754
- # `service_tier=ultrafast`.
755
- # - When not set, the default behavior is 'auto'.
756
- #
757
- # When the `service_tier` parameter is set, the response body will include the
758
- # `service_tier` value based on the processing mode actually used to serve the
759
- # request. This response value may be different from the value set in the
760
- # parameter.
761
- #
762
- # @see OpenAI::Models::Responses::ResponsesClientEvent#service_tier
763
- module ServiceTier
764
- extend OpenAI::Internal::Type::Enum
765
-
766
- AUTO = :auto
767
- DEFAULT = :default
768
- FLEX = :flex
769
- SCALE = :scale
770
- PRIORITY = :priority
771
- FAST = :fast
772
- ULTRAFAST = :ultrafast
773
-
774
- # @!method self.values
775
- # @return [Array<Symbol>]
776
- end
871
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#stream_options
872
+ class StreamOptions < OpenAI::Internal::Type::BaseModel
873
+ # @!attribute include_obfuscation
874
+ # When true, stream obfuscation will be enabled. Stream obfuscation adds random
875
+ # characters to an `obfuscation` field on streaming delta events to normalize
876
+ # payload sizes as a mitigation to certain side-channel attacks. These obfuscation
877
+ # fields are included by default, but add a small amount of overhead to the data
878
+ # stream. You can set `include_obfuscation` to false to optimize for bandwidth if
879
+ # you trust the network links between your application and the OpenAI API.
880
+ #
881
+ # @return [Boolean, nil]
882
+ optional :include_obfuscation, OpenAI::Internal::Type::Boolean
777
883
 
778
- # @see OpenAI::Models::Responses::ResponsesClientEvent#stream_options
779
- class StreamOptions < OpenAI::Internal::Type::BaseModel
780
- # @!attribute include_obfuscation
781
- # When true, stream obfuscation will be enabled. Stream obfuscation adds random
782
- # characters to an `obfuscation` field on streaming delta events to normalize
783
- # payload sizes as a mitigation to certain side-channel attacks. These obfuscation
784
- # fields are included by default, but add a small amount of overhead to the data
785
- # stream. You can set `include_obfuscation` to false to optimize for bandwidth if
786
- # you trust the network links between your application and the OpenAI API.
787
- #
788
- # @return [Boolean, nil]
789
- optional :include_obfuscation, OpenAI::Internal::Type::Boolean
884
+ # @!method initialize(include_obfuscation: nil)
885
+ # Some parameter documentations has been truncated, see
886
+ # {OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions}
887
+ # for more details.
888
+ #
889
+ # Options for streaming responses. Only set this when you set `stream: true`.
890
+ #
891
+ # @param include_obfuscation [Boolean] When true, stream obfuscation will be enabled. Stream obfuscation adds
892
+ end
790
893
 
791
- # @!method initialize(include_obfuscation: nil)
792
- # Some parameter documentations has been truncated, see
793
- # {OpenAI::Models::Responses::ResponsesClientEvent::StreamOptions} for more
794
- # details.
795
- #
796
- # Options for streaming responses. Only set this when you set `stream: true`.
894
+ # How the model should select which tool (or tools) to use when generating a
895
+ # response. See the `tools` parameter to see how to specify which tools the model
896
+ # can call.
797
897
  #
798
- # @param include_obfuscation [Boolean] When true, stream obfuscation will be enabled. Stream obfuscation adds
799
- end
898
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#tool_choice
899
+ module ToolChoice
900
+ extend OpenAI::Internal::Type::Union
800
901
 
801
- # How the model should select which tool (or tools) to use when generating a
802
- # response. See the `tools` parameter to see how to specify which tools the model
803
- # can call.
804
- #
805
- # @see OpenAI::Models::Responses::ResponsesClientEvent#tool_choice
806
- module ToolChoice
807
- extend OpenAI::Internal::Type::Union
902
+ # Controls which (if any) tool is called by the model.
903
+ #
904
+ # `none` means the model will not call any tool and instead generates a message.
905
+ #
906
+ # `auto` means the model can pick between generating a message or calling one or
907
+ # more tools.
908
+ #
909
+ # `required` means the model must call one or more tools.
910
+ variant enum: -> { OpenAI::Responses::ToolChoiceOptions }
808
911
 
809
- # Controls which (if any) tool is called by the model.
810
- #
811
- # `none` means the model will not call any tool and instead generates a message.
812
- #
813
- # `auto` means the model can pick between generating a message or calling one or
814
- # more tools.
815
- #
816
- # `required` means the model must call one or more tools.
817
- variant enum: -> { OpenAI::Responses::ToolChoiceOptions }
912
+ # Constrains the tools available to the model to a pre-defined set.
913
+ variant -> { OpenAI::Responses::ToolChoiceAllowed }
818
914
 
819
- # Constrains the tools available to the model to a pre-defined set.
820
- variant -> { OpenAI::Responses::ToolChoiceAllowed }
915
+ # Indicates that the model should use a built-in tool to generate a response.
916
+ # [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
917
+ variant -> { OpenAI::Responses::ToolChoiceTypes }
821
918
 
822
- # Indicates that the model should use a built-in tool to generate a response.
823
- # [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
824
- variant -> { OpenAI::Responses::ToolChoiceTypes }
919
+ # Use this option to force the model to call a specific function.
920
+ variant -> { OpenAI::Responses::ToolChoiceFunction }
825
921
 
826
- # Use this option to force the model to call a specific function.
827
- variant -> { OpenAI::Responses::ToolChoiceFunction }
922
+ # Use this option to force the model to call a specific tool on a remote MCP server.
923
+ variant -> { OpenAI::Responses::ToolChoiceMcp }
828
924
 
829
- # Use this option to force the model to call a specific tool on a remote MCP server.
830
- variant -> { OpenAI::Responses::ToolChoiceMcp }
925
+ # Use this option to force the model to call a specific custom tool.
926
+ variant -> { OpenAI::Responses::ToolChoiceCustom }
831
927
 
832
- # Use this option to force the model to call a specific custom tool.
833
- variant -> { OpenAI::Responses::ToolChoiceCustom }
928
+ variant(
929
+ -> {
930
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam
931
+ }
932
+ )
834
933
 
835
- variant -> { OpenAI::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam }
934
+ # Forces the model to call the apply_patch tool when executing a tool call.
935
+ variant -> { OpenAI::Responses::ToolChoiceApplyPatch }
836
936
 
837
- # Forces the model to call the apply_patch tool when executing a tool call.
838
- variant -> { OpenAI::Responses::ToolChoiceApplyPatch }
937
+ # Forces the model to call the shell tool when a tool call is required.
938
+ variant -> { OpenAI::Responses::ToolChoiceShell }
839
939
 
840
- # Forces the model to call the shell tool when a tool call is required.
841
- variant -> { OpenAI::Responses::ToolChoiceShell }
940
+ class SpecificProgrammaticToolCallingParam < OpenAI::Internal::Type::BaseModel
941
+ # @!attribute type
942
+ # The tool to call. Always `programmatic_tool_calling`.
943
+ #
944
+ # @return [Symbol, :programmatic_tool_calling]
945
+ required :type, const: :programmatic_tool_calling
842
946
 
843
- class SpecificProgrammaticToolCallingParam < OpenAI::Internal::Type::BaseModel
844
- # @!attribute type
845
- # The tool to call. Always `programmatic_tool_calling`.
846
- #
847
- # @return [Symbol, :programmatic_tool_calling]
848
- required :type, const: :programmatic_tool_calling
947
+ # @!method initialize(type: :programmatic_tool_calling)
948
+ # @param type [Symbol, :programmatic_tool_calling] The tool to call. Always `programmatic_tool_calling`.
949
+ end
849
950
 
850
- # @!method initialize(type: :programmatic_tool_calling)
851
- # @param type [Symbol, :programmatic_tool_calling] The tool to call. Always `programmatic_tool_calling`.
951
+ # @!method self.variants
952
+ # @return [Array(Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell)]
852
953
  end
853
954
 
854
- # @!method self.variants
855
- # @return [Array(Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, OpenAI::Models::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam, OpenAI::Models::Responses::ToolChoiceApplyPatch, OpenAI::Models::Responses::ToolChoiceShell)]
856
- end
857
-
858
- # @deprecated
859
- #
860
- # The truncation strategy to use for the model response.
861
- #
862
- # - `auto`: If the input to this Response exceeds the model's context window size,
863
- # the model will truncate the response to fit the context window by dropping
864
- # items from the beginning of the conversation.
865
- # - `disabled` (default): If the input size will exceed the context window size
866
- # for a model, the request will fail with a 400 error.
867
- #
868
- # @see OpenAI::Models::Responses::ResponsesClientEvent#truncation
869
- module Truncation
870
- extend OpenAI::Internal::Type::Enum
955
+ # @deprecated
956
+ #
957
+ # The truncation strategy to use for the model response.
958
+ #
959
+ # - `auto`: If the input to this Response exceeds the model's context window size,
960
+ # the model will truncate the response to fit the context window by dropping
961
+ # items from the beginning of the conversation.
962
+ # - `disabled` (default): If the input size will exceed the context window size
963
+ # for a model, the request will fail with a 400 error.
964
+ #
965
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#truncation
966
+ module Truncation
967
+ extend OpenAI::Internal::Type::Enum
871
968
 
872
- AUTO = :auto
873
- DISABLED = :disabled
969
+ AUTO = :auto
970
+ DISABLED = :disabled
874
971
 
875
- # @!method self.values
876
- # @return [Array<Symbol>]
972
+ # @!method self.values
973
+ # @return [Array<Symbol>]
974
+ end
877
975
  end
976
+
977
+ # @!method self.variants
978
+ # @return [Array(OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate, OpenAI::Models::Responses::ResponseSteerEvent)]
878
979
  end
879
980
  end
880
981
  end