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
@@ -5,546 +5,46 @@ module OpenAI
5
5
 
6
6
  module Responses
7
7
 
8
- class ResponsesClientEvent < OpenAI::Internal::Type::BaseModel
8
+ # Client events accepted by the Responses WebSocket server.
9
+ module ResponsesClientEvent
10
+ extend OpenAI::Internal::Type::Union
9
11
 
10
- OrHash = T.type_alias do
12
+ Variants = T.type_alias do
11
13
  T.any(
12
- OpenAI::Responses::ResponsesClientEvent,
13
- OpenAI::Internal::AnyHash
14
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate,
15
+ OpenAI::Responses::ResponseSteerEvent
14
16
  )
15
17
  end
16
18
 
17
- # The type of the client event. Always `response.create`.
18
- sig { returns(Symbol) }
19
- attr_accessor :type
20
-
21
- # Whether to run the model response in the background.
22
- # [Learn more](https://platform.openai.com/docs/guides/background).
23
- sig { returns(T.nilable(T::Boolean)) }
24
- attr_accessor :background
25
-
26
- # Context management configuration for this request.
27
- sig { returns(T.nilable(T::Array[OpenAI::Responses::ResponsesClientEvent::ContextManagement])) }
28
- attr_accessor :context_management
29
-
30
- # The conversation that this response belongs to. Items from this conversation are
31
- # prepended to `input_items` for this response request. Input items and output
32
- # items from this response are automatically added to this conversation after this
33
- # response completes.
34
- sig { returns(T.nilable(T.any(String, OpenAI::Responses::ResponseConversationParam))) }
35
- attr_accessor :conversation
36
-
37
- # Specify additional output data to include in the model response. Currently
38
- # supported values are:
39
- #
40
- # - `web_search_call.action.sources`: Include the sources of the web search tool
41
- # call.
42
- # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
43
- # in code interpreter tool call items.
44
- # - `computer_call_output.output.image_url`: Include image urls from the computer
45
- # call output.
46
- # - `file_search_call.results`: Include the search results of the file search tool
47
- # call.
48
- # - `message.input_image.image_url`: Include image urls from the input message.
49
- # - `message.output_text.logprobs`: Include logprobs with assistant messages.
50
- # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
51
- # tokens in reasoning item outputs. This enables reasoning items to be used in
52
- # multi-turn conversations when using the Responses API statelessly (like when
53
- # the `store` parameter is set to `false`, or when an organization is enrolled
54
- # in the zero data retention program).
55
- sig { returns(T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol])) }
56
- attr_accessor :include
57
-
58
- # Text, image, or file inputs to the model, used to generate a response.
59
- #
60
- # Learn more:
61
- #
62
- # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
63
- # - [Image inputs](https://platform.openai.com/docs/guides/images)
64
- # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
65
- # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
66
- # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
67
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::Input::Variants)) }
68
- attr_reader :input
69
-
70
- sig { params(input: OpenAI::Responses::ResponsesClientEvent::Input::Variants).void }
71
- attr_writer :input
72
-
73
- # A system (or developer) message inserted into the model's context.
74
- #
75
- # When using along with `previous_response_id`, the instructions from a previous
76
- # response will not be carried over to the next response. This makes it simple to
77
- # swap out system (or developer) messages in new responses.
78
- sig { returns(T.nilable(String)) }
79
- attr_accessor :instructions
80
-
81
- # An upper bound for the number of tokens that can be generated for a response,
82
- # including visible output tokens and
83
- # [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
84
- sig { returns(T.nilable(Integer)) }
85
- attr_accessor :max_output_tokens
86
-
87
- # The maximum number of total calls to built-in tools that can be processed in a
88
- # response. This maximum number applies across all built-in tool calls, not per
89
- # individual tool. Any further attempts to call a tool by the model will be
90
- # ignored.
91
- sig { returns(T.nilable(Integer)) }
92
- attr_accessor :max_tool_calls
93
-
94
- # Set of 16 key-value pairs that can be attached to an object. This can be useful
95
- # for storing additional information about the object in a structured format, and
96
- # querying for objects via API or the dashboard.
97
- #
98
- # Keys are strings with a maximum length of 64 characters. Values are strings with
99
- # a maximum length of 512 characters.
100
- sig { returns(T.nilable(T::Hash[Symbol, String])) }
101
- attr_accessor :metadata
102
-
103
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
104
- # wide range of models with different capabilities, performance characteristics,
105
- # and price points. Refer to the
106
- # [model guide](https://platform.openai.com/docs/models) to browse and compare
107
- # available models.
108
- sig {
109
- returns(
110
- T.nilable(T.any(String, OpenAI::ChatModel::OrSymbol, OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol))
111
- )
112
- }
113
- attr_reader :model
114
-
115
- sig {
116
- params(
117
- model: T.any(String, OpenAI::ChatModel::OrSymbol, OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol)
118
- )
119
- .void
120
- }
121
- attr_writer :model
122
-
123
- # Configuration for running moderation on the input and output of this response.
124
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation)) }
125
- attr_reader :moderation
126
-
127
- sig { params(moderation: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::OrHash)).void }
128
- attr_writer :moderation
129
-
130
- # Whether to allow the model to run tool calls in parallel.
131
- sig { returns(T.nilable(T::Boolean)) }
132
- attr_accessor :parallel_tool_calls
133
-
134
- # The unique ID of the previous response to the model. Use this to create
135
- # multi-turn conversations. Learn more about
136
- # [conversation state](https://platform.openai.com/docs/guides/conversation-state).
137
- # Cannot be used in conjunction with `conversation`.
138
- sig { returns(T.nilable(String)) }
139
- attr_accessor :previous_response_id
140
-
141
- # Reference to a prompt template and its variables.
142
- # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
143
- sig { returns(T.nilable(OpenAI::Responses::ResponsePrompt)) }
144
- attr_reader :prompt
145
-
146
- sig { params(prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash)).void }
147
- attr_writer :prompt
148
-
149
- # Used by OpenAI to cache responses for similar requests to optimize your cache
150
- # hit rates. Replaces the `user` field.
151
- # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
152
- sig { returns(T.nilable(String)) }
153
- attr_accessor :prompt_cache_key
154
-
155
- # Options for prompt caching. Supported for `gpt-5.6` and later models. By
156
- # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
157
- # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
158
- # request can write up to four breakpoints. For cache matching, OpenAI considers
159
- # up to the latest 80 breakpoints in the conversation, without a content-block
160
- # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
161
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
162
- # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
163
- # for current details.
164
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions)) }
165
- attr_reader :prompt_cache_options
166
-
167
- sig { params(prompt_cache_options: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::OrHash).void }
168
- attr_writer :prompt_cache_options
169
-
170
- # Deprecated. Use `prompt_cache_options.ttl` instead.
171
- #
172
- # The retention policy for the prompt cache. Set to `24h` to enable extended
173
- # prompt caching, which keeps cached prefixes active for longer, up to a maximum
174
- # of 24 hours.
175
- # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
176
- # This field expresses a maximum retention policy, while
177
- # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
178
- # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
179
- # models, only `24h` is supported.
180
- #
181
- # For older models that support both `in_memory` and `24h`, the default depends on
182
- # your organization's data retention policy:
183
- #
184
- # - Organizations without ZDR enabled default to `24h`.
185
- # - Organizations with ZDR enabled default to `in_memory` when
186
- # `prompt_cache_retention` is not specified.
187
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention::OrSymbol)) }
188
- attr_accessor :prompt_cache_retention
189
-
190
- # **gpt-5 and o-series models only**
191
- #
192
- # Configuration options for
193
- # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
194
- sig { returns(T.nilable(OpenAI::Reasoning)) }
195
- attr_reader :reasoning
196
-
197
- sig { params(reasoning: T.nilable(OpenAI::Reasoning::OrHash)).void }
198
- attr_writer :reasoning
199
-
200
- # A stable identifier used to help detect users of your application that may be
201
- # violating OpenAI's usage policies. The IDs should be a string that uniquely
202
- # identifies each user, with a maximum length of 64 characters. We recommend
203
- # hashing their username or email address, in order to avoid sending us any
204
- # identifying information.
205
- # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
206
- sig { returns(T.nilable(String)) }
207
- attr_accessor :safety_identifier
208
-
209
- # Specifies the processing type used for serving the request.
210
- #
211
- # - If set to 'auto', then the request will be processed with the service tier
212
- # configured in the Project settings. Unless otherwise configured, the Project
213
- # will use 'default'.
214
- # - If set to 'default', then the request will be processed with the standard
215
- # pricing and performance for the selected model.
216
- # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
217
- # then the request will be processed with the Flex Processing service tier.
218
- # - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
219
- # include the `service_tier=fast` or `service_tier=priority` parameter for
220
- # Responses or Chat Completions. The response will show `service_tier=priority`
221
- # regardless of if you specify `service_tier=fast` or `priority` in your
222
- # request.
223
- # - If set to 'ultrafast', then the request will be processed with the
224
- # access-controlled Ultrafast Processing service tier. This tier is currently
225
- # available for `gpt-5.6-sol`; a response served through it will show
226
- # `service_tier=ultrafast`.
227
- # - When not set, the default behavior is 'auto'.
228
- #
229
- # When the `service_tier` parameter is set, the response body will include the
230
- # `service_tier` value based on the processing mode actually used to serve the
231
- # request. This response value may be different from the value set in the
232
- # parameter.
233
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ServiceTier::OrSymbol)) }
234
- attr_accessor :service_tier
235
-
236
- # Whether to store the generated model response for later retrieval via API.
237
- sig { returns(T.nilable(T::Boolean)) }
238
- attr_accessor :store
239
-
240
- # If set to true, the model response data will be streamed to the client as it is
241
- # generated using
242
- # [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
243
- # See the
244
- # [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
245
- # for more information.
246
- sig { returns(T.nilable(T::Boolean)) }
247
- attr_accessor :stream
248
-
249
- # The WebSocket lane for this response. Requests with the same `stream_id` are
250
- # processed FIFO, and events for the response echo the same `stream_id`.
251
- #
252
- # `stream_id` controls routing; `previous_response_id` controls conversation
253
- # lineage, so a new lane can fork from a response created on another lane.
254
- sig { returns(T.nilable(String)) }
255
- attr_reader :stream_id
256
-
257
- sig { params(stream_id: String).void }
258
- attr_writer :stream_id
259
-
260
- # Options for streaming responses. Only set this when you set `stream: true`.
261
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::StreamOptions)) }
262
- attr_reader :stream_options
263
-
264
- sig { params(stream_options: T.nilable(OpenAI::Responses::ResponsesClientEvent::StreamOptions::OrHash)).void }
265
- attr_writer :stream_options
266
-
267
- # What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
268
- # make the output more random, while lower values like 0.2 will make it more
269
- # focused and deterministic. We generally recommend altering this or `top_p` but
270
- # not both.
271
- sig { returns(T.nilable(Float)) }
272
- attr_accessor :temperature
273
-
274
- # Configuration options for a text response from the model. Can be plain text or
275
- # structured JSON data. Learn more:
276
- #
277
- # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
278
- # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
279
- sig { returns(T.nilable(OpenAI::Responses::ResponseTextConfig)) }
280
- attr_reader :text
281
-
282
- sig { params(text: OpenAI::Responses::ResponseTextConfig::OrHash).void }
283
- attr_writer :text
284
-
285
- # How the model should select which tool (or tools) to use when generating a
286
- # response. See the `tools` parameter to see how to specify which tools the model
287
- # can call.
288
- sig {
289
- returns(
290
- T.nilable(
291
- T.any(
292
- OpenAI::Responses::ToolChoiceOptions::OrSymbol,
293
- OpenAI::Responses::ToolChoiceAllowed,
294
- OpenAI::Responses::ToolChoiceTypes,
295
- OpenAI::Responses::ToolChoiceFunction,
296
- OpenAI::Responses::ToolChoiceMcp,
297
- OpenAI::Responses::ToolChoiceCustom,
298
- OpenAI::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam,
299
- OpenAI::Responses::ToolChoiceApplyPatch,
300
- OpenAI::Responses::ToolChoiceShell
301
- )
302
- )
303
- )
304
- }
305
- attr_reader :tool_choice
306
-
307
- sig {
308
- params(
309
- tool_choice: T.any(
310
- OpenAI::Responses::ToolChoiceOptions::OrSymbol,
311
- OpenAI::Responses::ToolChoiceAllowed::OrHash,
312
- OpenAI::Responses::ToolChoiceTypes::OrHash,
313
- OpenAI::Responses::ToolChoiceFunction::OrHash,
314
- OpenAI::Responses::ToolChoiceMcp::OrHash,
315
- OpenAI::Responses::ToolChoiceCustom::OrHash,
316
- OpenAI::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam::OrHash,
317
- OpenAI::Responses::ToolChoiceApplyPatch::OrHash,
318
- OpenAI::Responses::ToolChoiceShell::OrHash
319
- )
320
- )
321
- .void
322
- }
323
- attr_writer :tool_choice
324
-
325
- # An array of tools the model may call while generating a response. You can
326
- # specify which tool to use by setting the `tool_choice` parameter.
327
- #
328
- # We support the following categories of tools:
329
- #
330
- # - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
331
- # capabilities, like
332
- # [web search](https://platform.openai.com/docs/guides/tools-web-search) or
333
- # [file search](https://platform.openai.com/docs/guides/tools-file-search).
334
- # Learn more about
335
- # [built-in tools](https://platform.openai.com/docs/guides/tools).
336
- # - **MCP Tools**: Integrations with third-party systems via custom MCP servers or
337
- # predefined connectors such as Google Drive and SharePoint. Learn more about
338
- # [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
339
- # - **Function calls (custom tools)**: Functions that are defined by you, enabling
340
- # the model to call your own code with strongly typed arguments and outputs.
341
- # Learn more about
342
- # [function calling](https://platform.openai.com/docs/guides/function-calling).
343
- # You can also use custom tools to call your own code.
344
- sig {
345
- returns(
346
- T.nilable(
347
- T::Array[
348
- T.any(
349
- OpenAI::Responses::FunctionTool,
350
- OpenAI::Responses::FileSearchTool,
351
- OpenAI::Responses::ComputerTool,
352
- OpenAI::Responses::ComputerUsePreviewTool,
353
- OpenAI::Responses::Tool::Mcp,
354
- OpenAI::Responses::Tool::CodeInterpreter,
355
- OpenAI::Responses::Tool::ProgrammaticToolCalling,
356
- OpenAI::Responses::Tool::ImageGeneration,
357
- OpenAI::Responses::Tool::LocalShell,
358
- OpenAI::Responses::FunctionShellTool,
359
- OpenAI::Responses::CustomTool,
360
- OpenAI::Responses::NamespaceTool,
361
- OpenAI::Responses::ToolSearchTool,
362
- OpenAI::Responses::ApplyPatchTool,
363
- OpenAI::Responses::WebSearchTool,
364
- OpenAI::Responses::WebSearchPreviewTool
365
- )
366
- ]
19
+ class ResponseCreate < OpenAI::Internal::Type::BaseModel
20
+ OrHash = T.type_alias do
21
+ T.any(
22
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate,
23
+ OpenAI::Internal::AnyHash
367
24
  )
368
- )
369
- }
370
- attr_reader :tools
371
-
372
- sig {
373
- params(
374
- tools: T::Array[
375
- T.any(
376
- OpenAI::Responses::FunctionTool::OrHash,
377
- OpenAI::Responses::FileSearchTool::OrHash,
378
- OpenAI::Responses::ComputerTool::OrHash,
379
- OpenAI::Responses::ComputerUsePreviewTool::OrHash,
380
- OpenAI::Responses::Tool::Mcp::OrHash,
381
- OpenAI::Responses::Tool::CodeInterpreter::OrHash,
382
- OpenAI::Responses::Tool::ProgrammaticToolCalling::OrHash,
383
- OpenAI::Responses::Tool::ImageGeneration::OrHash,
384
- OpenAI::Responses::Tool::LocalShell::OrHash,
385
- OpenAI::Responses::FunctionShellTool::OrHash,
386
- OpenAI::Responses::CustomTool::OrHash,
387
- OpenAI::Responses::NamespaceTool::OrHash,
388
- OpenAI::Responses::ToolSearchTool::OrHash,
389
- OpenAI::Responses::ApplyPatchTool::OrHash,
390
- OpenAI::Responses::WebSearchTool::OrHash,
391
- OpenAI::Responses::WebSearchPreviewTool::OrHash
392
- )
393
- ]
394
- )
395
- .void
396
- }
397
- attr_writer :tools
398
-
399
- # An integer between 0 and 20 specifying the maximum number of most likely tokens
400
- # to return at each token position, each with an associated log probability. In
401
- # some cases, the number of returned tokens may be fewer than requested.
402
- sig { returns(T.nilable(Integer)) }
403
- attr_accessor :top_logprobs
404
-
405
- # An alternative to sampling with temperature, called nucleus sampling, where the
406
- # model considers the results of the tokens with top_p probability mass. So 0.1
407
- # means only the tokens comprising the top 10% probability mass are considered.
408
- #
409
- # We generally recommend altering this or `temperature` but not both.
410
- sig { returns(T.nilable(Float)) }
411
- attr_accessor :top_p
412
-
413
- # The truncation strategy to use for the model response.
414
- #
415
- # - `auto`: If the input to this Response exceeds the model's context window size,
416
- # the model will truncate the response to fit the context window by dropping
417
- # items from the beginning of the conversation.
418
- # - `disabled` (default): If the input size will exceed the context window size
419
- # for a model, the request will fail with a 400 error.
420
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::Truncation::OrSymbol)) }
421
- attr_accessor :truncation
422
-
423
- # This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
424
- # `prompt_cache_key` instead to maintain caching optimizations. A stable
425
- # identifier for your end-users. Used to boost cache hit rates by better bucketing
426
- # similar requests and to help OpenAI detect and prevent abuse.
427
- # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
428
- sig { returns(T.nilable(String)) }
429
- attr_reader :user
430
-
431
- sig { params(user: String).void }
432
- attr_writer :user
433
-
434
- sig do
435
- params(
436
-
437
- background: T.nilable(T::Boolean),
438
-
439
- context_management: T.nilable(T::Array[OpenAI::Responses::ResponsesClientEvent::ContextManagement::OrHash]),
440
-
441
- conversation: T.nilable(T.any(String, OpenAI::Responses::ResponseConversationParam::OrHash)),
442
-
443
- include: T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]),
444
-
445
- input: OpenAI::Responses::ResponsesClientEvent::Input::Variants,
446
-
447
- instructions: T.nilable(String),
448
-
449
- max_output_tokens: T.nilable(Integer),
450
-
451
- max_tool_calls: T.nilable(Integer),
452
-
453
- metadata: T.nilable(T::Hash[Symbol, String]),
454
-
455
- model: T.any(String, OpenAI::ChatModel::OrSymbol, OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol),
456
-
457
- moderation: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::OrHash),
458
-
459
- parallel_tool_calls: T.nilable(T::Boolean),
460
-
461
- previous_response_id: T.nilable(String),
462
-
463
- prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
464
-
465
- prompt_cache_key: T.nilable(String),
466
-
467
- prompt_cache_options: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::OrHash,
468
-
469
- prompt_cache_retention: T.nilable(OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention::OrSymbol),
470
-
471
- reasoning: T.nilable(OpenAI::Reasoning::OrHash),
472
-
473
- safety_identifier: T.nilable(String),
474
-
475
- service_tier: T.nilable(OpenAI::Responses::ResponsesClientEvent::ServiceTier::OrSymbol),
476
-
477
- store: T.nilable(T::Boolean),
478
-
479
- stream: T.nilable(T::Boolean),
480
-
481
- stream_id: String,
482
-
483
- stream_options: T.nilable(OpenAI::Responses::ResponsesClientEvent::StreamOptions::OrHash),
484
-
485
- temperature: T.nilable(Float),
486
-
487
- text: OpenAI::Responses::ResponseTextConfig::OrHash,
488
-
489
- tool_choice: T.any(
490
- OpenAI::Responses::ToolChoiceOptions::OrSymbol,
491
- OpenAI::Responses::ToolChoiceAllowed::OrHash,
492
- OpenAI::Responses::ToolChoiceTypes::OrHash,
493
- OpenAI::Responses::ToolChoiceFunction::OrHash,
494
- OpenAI::Responses::ToolChoiceMcp::OrHash,
495
- OpenAI::Responses::ToolChoiceCustom::OrHash,
496
- OpenAI::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam::OrHash,
497
- OpenAI::Responses::ToolChoiceApplyPatch::OrHash,
498
- OpenAI::Responses::ToolChoiceShell::OrHash
499
- ),
500
-
501
- tools: T::Array[
502
- T.any(
503
- OpenAI::Responses::FunctionTool::OrHash,
504
- OpenAI::Responses::FileSearchTool::OrHash,
505
- OpenAI::Responses::ComputerTool::OrHash,
506
- OpenAI::Responses::ComputerUsePreviewTool::OrHash,
507
- OpenAI::Responses::Tool::Mcp::OrHash,
508
- OpenAI::Responses::Tool::CodeInterpreter::OrHash,
509
- OpenAI::Responses::Tool::ProgrammaticToolCalling::OrHash,
510
- OpenAI::Responses::Tool::ImageGeneration::OrHash,
511
- OpenAI::Responses::Tool::LocalShell::OrHash,
512
- OpenAI::Responses::FunctionShellTool::OrHash,
513
- OpenAI::Responses::CustomTool::OrHash,
514
- OpenAI::Responses::NamespaceTool::OrHash,
515
- OpenAI::Responses::ToolSearchTool::OrHash,
516
- OpenAI::Responses::ApplyPatchTool::OrHash,
517
- OpenAI::Responses::WebSearchTool::OrHash,
518
- OpenAI::Responses::WebSearchPreviewTool::OrHash
519
- )
520
- ],
521
-
522
- top_logprobs: T.nilable(Integer),
523
-
524
- top_p: T.nilable(Float),
525
-
526
- truncation: T.nilable(OpenAI::Responses::ResponsesClientEvent::Truncation::OrSymbol),
527
-
528
- user: String,
25
+ end
529
26
 
530
- type: Symbol
531
- )
532
- .returns(T.attached_class)
533
- end
534
- def self.new(
27
+ # The type of the client event. Always `response.create`.
28
+ sig { returns(Symbol) }
29
+ attr_accessor :type
535
30
 
536
31
  # Whether to run the model response in the background.
537
32
  # [Learn more](https://platform.openai.com/docs/guides/background).
538
- background: nil,
33
+ sig { returns(T.nilable(T::Boolean)) }
34
+ attr_accessor :background
539
35
 
540
36
  # Context management configuration for this request.
541
- context_management: nil,
37
+ sig {
38
+ returns(T.nilable(T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement]))
39
+ }
40
+ attr_accessor :context_management
542
41
 
543
42
  # The conversation that this response belongs to. Items from this conversation are
544
43
  # prepended to `input_items` for this response request. Input items and output
545
44
  # items from this response are automatically added to this conversation after this
546
45
  # response completes.
547
- conversation: nil,
46
+ sig { returns(T.nilable(T.any(String, OpenAI::Responses::ResponseConversationParam))) }
47
+ attr_accessor :conversation
548
48
 
549
49
  # Specify additional output data to include in the model response. Currently
550
50
  # supported values are:
@@ -564,7 +64,8 @@ module OpenAI
564
64
  # multi-turn conversations when using the Responses API statelessly (like when
565
65
  # the `store` parameter is set to `false`, or when an organization is enrolled
566
66
  # in the zero data retention program).
567
- include: nil,
67
+ sig { returns(T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol])) }
68
+ attr_accessor :include
568
69
 
569
70
  # Text, image, or file inputs to the model, used to generate a response.
570
71
  #
@@ -575,25 +76,32 @@ module OpenAI
575
76
  # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
576
77
  # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
577
78
  # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
578
- input: nil,
79
+ sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Input::Variants)) }
80
+ attr_reader :input
81
+
82
+ sig { params(input: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Input::Variants).void }
83
+ attr_writer :input
579
84
 
580
85
  # A system (or developer) message inserted into the model's context.
581
86
  #
582
87
  # When using along with `previous_response_id`, the instructions from a previous
583
88
  # response will not be carried over to the next response. This makes it simple to
584
89
  # swap out system (or developer) messages in new responses.
585
- instructions: nil,
90
+ sig { returns(T.nilable(String)) }
91
+ attr_accessor :instructions
586
92
 
587
93
  # An upper bound for the number of tokens that can be generated for a response,
588
94
  # including visible output tokens and
589
95
  # [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
590
- max_output_tokens: nil,
96
+ sig { returns(T.nilable(Integer)) }
97
+ attr_accessor :max_output_tokens
591
98
 
592
99
  # The maximum number of total calls to built-in tools that can be processed in a
593
100
  # response. This maximum number applies across all built-in tool calls, not per
594
101
  # individual tool. Any further attempts to call a tool by the model will be
595
102
  # ignored.
596
- max_tool_calls: nil,
103
+ sig { returns(T.nilable(Integer)) }
104
+ attr_accessor :max_tool_calls
597
105
 
598
106
  # Set of 16 key-value pairs that can be attached to an object. This can be useful
599
107
  # for storing additional information about the object in a structured format, and
@@ -601,35 +109,65 @@ module OpenAI
601
109
  #
602
110
  # Keys are strings with a maximum length of 64 characters. Values are strings with
603
111
  # a maximum length of 512 characters.
604
- metadata: nil,
112
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
113
+ attr_accessor :metadata
605
114
 
606
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
607
- # wide range of models with different capabilities, performance characteristics,
608
- # and price points. Refer to the
115
+ # Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide
116
+ # range of models with different capabilities, performance characteristics, and
117
+ # price points. Refer to the
609
118
  # [model guide](https://platform.openai.com/docs/models) to browse and compare
610
119
  # available models.
611
- model: nil,
120
+ sig {
121
+ returns(
122
+ T.nilable(
123
+ T.any(String, OpenAI::ChatModel::OrSymbol, OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol)
124
+ )
125
+ )
126
+ }
127
+ attr_reader :model
128
+
129
+ sig {
130
+ params(
131
+ model: T.any(String, OpenAI::ChatModel::OrSymbol, OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol)
132
+ )
133
+ .void
134
+ }
135
+ attr_writer :model
612
136
 
613
137
  # Configuration for running moderation on the input and output of this response.
614
- moderation: nil,
138
+ sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation)) }
139
+ attr_reader :moderation
140
+
141
+ sig {
142
+ params(moderation: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::OrHash))
143
+ .void
144
+ }
145
+ attr_writer :moderation
615
146
 
616
147
  # Whether to allow the model to run tool calls in parallel.
617
- parallel_tool_calls: nil,
148
+ sig { returns(T.nilable(T::Boolean)) }
149
+ attr_accessor :parallel_tool_calls
618
150
 
619
151
  # The unique ID of the previous response to the model. Use this to create
620
152
  # multi-turn conversations. Learn more about
621
153
  # [conversation state](https://platform.openai.com/docs/guides/conversation-state).
622
154
  # Cannot be used in conjunction with `conversation`.
623
- previous_response_id: nil,
155
+ sig { returns(T.nilable(String)) }
156
+ attr_accessor :previous_response_id
624
157
 
625
158
  # Reference to a prompt template and its variables.
626
159
  # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
627
- prompt: nil,
160
+ sig { returns(T.nilable(OpenAI::Responses::ResponsePrompt)) }
161
+ attr_reader :prompt
162
+
163
+ sig { params(prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash)).void }
164
+ attr_writer :prompt
628
165
 
629
166
  # Used by OpenAI to cache responses for similar requests to optimize your cache
630
167
  # hit rates. Replaces the `user` field.
631
168
  # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
632
- prompt_cache_key: nil,
169
+ sig { returns(T.nilable(String)) }
170
+ attr_accessor :prompt_cache_key
633
171
 
634
172
  # Options for prompt caching. Supported for `gpt-5.6` and later models. By
635
173
  # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
@@ -640,7 +178,16 @@ module OpenAI
640
178
  # `ttl` defaults to `30m`, which is currently the only supported value. See the
641
179
  # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
642
180
  # for current details.
643
- prompt_cache_options: nil,
181
+ sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions)) }
182
+ attr_reader :prompt_cache_options
183
+
184
+ sig {
185
+ params(
186
+ prompt_cache_options: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::OrHash
187
+ )
188
+ .void
189
+ }
190
+ attr_writer :prompt_cache_options
644
191
 
645
192
  # Deprecated. Use `prompt_cache_options.ttl` instead.
646
193
  #
@@ -659,13 +206,18 @@ module OpenAI
659
206
  # - Organizations without ZDR enabled default to `24h`.
660
207
  # - Organizations with ZDR enabled default to `in_memory` when
661
208
  # `prompt_cache_retention` is not specified.
662
- prompt_cache_retention: nil,
209
+ sig {
210
+ returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention::OrSymbol))
211
+ }
212
+ attr_accessor :prompt_cache_retention
663
213
 
664
- # **gpt-5 and o-series models only**
665
- #
666
214
  # Configuration options for
667
215
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
668
- reasoning: nil,
216
+ sig { returns(T.nilable(OpenAI::Reasoning)) }
217
+ attr_reader :reasoning
218
+
219
+ sig { params(reasoning: T.nilable(OpenAI::Reasoning::OrHash)).void }
220
+ attr_writer :reasoning
669
221
 
670
222
  # A stable identifier used to help detect users of your application that may be
671
223
  # violating OpenAI's usage policies. The IDs should be a string that uniquely
@@ -673,7 +225,8 @@ module OpenAI
673
225
  # hashing their username or email address, in order to avoid sending us any
674
226
  # identifying information.
675
227
  # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
676
- safety_identifier: nil,
228
+ sig { returns(T.nilable(String)) }
229
+ attr_accessor :safety_identifier
677
230
 
678
231
  # Specifies the processing type used for serving the request.
679
232
  #
@@ -699,10 +252,12 @@ module OpenAI
699
252
  # `service_tier` value based on the processing mode actually used to serve the
700
253
  # request. This response value may be different from the value set in the
701
254
  # parameter.
702
- service_tier: nil,
255
+ sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::OrSymbol)) }
256
+ attr_accessor :service_tier
703
257
 
704
258
  # Whether to store the generated model response for later retrieval via API.
705
- store: nil,
259
+ sig { returns(T.nilable(T::Boolean)) }
260
+ attr_accessor :store
706
261
 
707
262
  # If set to true, the model response data will be streamed to the client as it is
708
263
  # generated using
@@ -710,35 +265,89 @@ module OpenAI
710
265
  # See the
711
266
  # [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
712
267
  # for more information.
713
- stream: nil,
268
+ sig { returns(T.nilable(T::Boolean)) }
269
+ attr_accessor :stream
714
270
 
715
271
  # The WebSocket lane for this response. Requests with the same `stream_id` are
716
272
  # processed FIFO, and events for the response echo the same `stream_id`.
717
273
  #
718
274
  # `stream_id` controls routing; `previous_response_id` controls conversation
719
275
  # lineage, so a new lane can fork from a response created on another lane.
720
- stream_id: nil,
276
+ sig { returns(T.nilable(String)) }
277
+ attr_reader :stream_id
278
+
279
+ sig { params(stream_id: String).void }
280
+ attr_writer :stream_id
721
281
 
722
282
  # Options for streaming responses. Only set this when you set `stream: true`.
723
- stream_options: nil,
283
+ sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions)) }
284
+ attr_reader :stream_options
285
+
286
+ sig {
287
+ params(
288
+ stream_options: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions::OrHash)
289
+ )
290
+ .void
291
+ }
292
+ attr_writer :stream_options
724
293
 
725
294
  # What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
726
295
  # make the output more random, while lower values like 0.2 will make it more
727
296
  # focused and deterministic. We generally recommend altering this or `top_p` but
728
297
  # not both.
729
- temperature: nil,
298
+ sig { returns(T.nilable(Float)) }
299
+ attr_accessor :temperature
730
300
 
731
301
  # Configuration options for a text response from the model. Can be plain text or
732
302
  # structured JSON data. Learn more:
733
303
  #
734
304
  # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
735
305
  # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
736
- text: nil,
306
+ sig { returns(T.nilable(OpenAI::Responses::ResponseTextConfig)) }
307
+ attr_reader :text
308
+
309
+ sig { params(text: OpenAI::Responses::ResponseTextConfig::OrHash).void }
310
+ attr_writer :text
737
311
 
738
312
  # How the model should select which tool (or tools) to use when generating a
739
313
  # response. See the `tools` parameter to see how to specify which tools the model
740
314
  # can call.
741
- tool_choice: nil,
315
+ sig {
316
+ returns(
317
+ T.nilable(
318
+ T.any(
319
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
320
+ OpenAI::Responses::ToolChoiceAllowed,
321
+ OpenAI::Responses::ToolChoiceTypes,
322
+ OpenAI::Responses::ToolChoiceFunction,
323
+ OpenAI::Responses::ToolChoiceMcp,
324
+ OpenAI::Responses::ToolChoiceCustom,
325
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam,
326
+ OpenAI::Responses::ToolChoiceApplyPatch,
327
+ OpenAI::Responses::ToolChoiceShell
328
+ )
329
+ )
330
+ )
331
+ }
332
+ attr_reader :tool_choice
333
+
334
+ sig {
335
+ params(
336
+ tool_choice: T.any(
337
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
338
+ OpenAI::Responses::ToolChoiceAllowed::OrHash,
339
+ OpenAI::Responses::ToolChoiceTypes::OrHash,
340
+ OpenAI::Responses::ToolChoiceFunction::OrHash,
341
+ OpenAI::Responses::ToolChoiceMcp::OrHash,
342
+ OpenAI::Responses::ToolChoiceCustom::OrHash,
343
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam::OrHash,
344
+ OpenAI::Responses::ToolChoiceApplyPatch::OrHash,
345
+ OpenAI::Responses::ToolChoiceShell::OrHash
346
+ )
347
+ )
348
+ .void
349
+ }
350
+ attr_writer :tool_choice
742
351
 
743
352
  # An array of tools the model may call while generating a response. You can
744
353
  # specify which tool to use by setting the `tool_choice` parameter.
@@ -759,19 +368,74 @@ module OpenAI
759
368
  # Learn more about
760
369
  # [function calling](https://platform.openai.com/docs/guides/function-calling).
761
370
  # You can also use custom tools to call your own code.
762
- tools: nil,
371
+ sig {
372
+ returns(
373
+ T.nilable(
374
+ T::Array[
375
+ T.any(
376
+ OpenAI::Responses::FunctionTool,
377
+ OpenAI::Responses::FileSearchTool,
378
+ OpenAI::Responses::ComputerTool,
379
+ OpenAI::Responses::ComputerUsePreviewTool,
380
+ OpenAI::Responses::Tool::Mcp,
381
+ OpenAI::Responses::Tool::CodeInterpreter,
382
+ OpenAI::Responses::Tool::ProgrammaticToolCalling,
383
+ OpenAI::Responses::Tool::ImageGeneration,
384
+ OpenAI::Responses::Tool::LocalShell,
385
+ OpenAI::Responses::FunctionShellTool,
386
+ OpenAI::Responses::CustomTool,
387
+ OpenAI::Responses::NamespaceTool,
388
+ OpenAI::Responses::ToolSearchTool,
389
+ OpenAI::Responses::ApplyPatchTool,
390
+ OpenAI::Responses::WebSearchTool,
391
+ OpenAI::Responses::WebSearchPreviewTool
392
+ )
393
+ ]
394
+ )
395
+ )
396
+ }
397
+ attr_reader :tools
398
+
399
+ sig {
400
+ params(
401
+ tools: T::Array[
402
+ T.any(
403
+ OpenAI::Responses::FunctionTool::OrHash,
404
+ OpenAI::Responses::FileSearchTool::OrHash,
405
+ OpenAI::Responses::ComputerTool::OrHash,
406
+ OpenAI::Responses::ComputerUsePreviewTool::OrHash,
407
+ OpenAI::Responses::Tool::Mcp::OrHash,
408
+ OpenAI::Responses::Tool::CodeInterpreter::OrHash,
409
+ OpenAI::Responses::Tool::ProgrammaticToolCalling::OrHash,
410
+ OpenAI::Responses::Tool::ImageGeneration::OrHash,
411
+ OpenAI::Responses::Tool::LocalShell::OrHash,
412
+ OpenAI::Responses::FunctionShellTool::OrHash,
413
+ OpenAI::Responses::CustomTool::OrHash,
414
+ OpenAI::Responses::NamespaceTool::OrHash,
415
+ OpenAI::Responses::ToolSearchTool::OrHash,
416
+ OpenAI::Responses::ApplyPatchTool::OrHash,
417
+ OpenAI::Responses::WebSearchTool::OrHash,
418
+ OpenAI::Responses::WebSearchPreviewTool::OrHash
419
+ )
420
+ ]
421
+ )
422
+ .void
423
+ }
424
+ attr_writer :tools
763
425
 
764
426
  # An integer between 0 and 20 specifying the maximum number of most likely tokens
765
427
  # to return at each token position, each with an associated log probability. In
766
428
  # some cases, the number of returned tokens may be fewer than requested.
767
- top_logprobs: nil,
429
+ sig { returns(T.nilable(Integer)) }
430
+ attr_accessor :top_logprobs
768
431
 
769
432
  # An alternative to sampling with temperature, called nucleus sampling, where the
770
433
  # model considers the results of the tokens with top_p probability mass. So 0.1
771
434
  # means only the tokens comprising the top 10% probability mass are considered.
772
435
  #
773
436
  # We generally recommend altering this or `temperature` but not both.
774
- top_p: nil,
437
+ sig { returns(T.nilable(Float)) }
438
+ attr_accessor :top_p
775
439
 
776
440
  # The truncation strategy to use for the model response.
777
441
  #
@@ -780,452 +444,926 @@ module OpenAI
780
444
  # items from the beginning of the conversation.
781
445
  # - `disabled` (default): If the input size will exceed the context window size
782
446
  # for a model, the request will fail with a 400 error.
783
- truncation: nil,
447
+ sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation::OrSymbol)) }
448
+ attr_accessor :truncation
784
449
 
785
450
  # This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
786
451
  # `prompt_cache_key` instead to maintain caching optimizations. A stable
787
452
  # identifier for your end-users. Used to boost cache hit rates by better bucketing
788
453
  # similar requests and to help OpenAI detect and prevent abuse.
789
454
  # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
790
- user: nil,
455
+ sig { returns(T.nilable(String)) }
456
+ attr_reader :user
791
457
 
792
- # The type of the client event. Always `response.create`.
458
+ sig { params(user: String).void }
459
+ attr_writer :user
793
460
 
794
- type: :"response.create"
795
- )
796
- end
461
+ # Client event for creating a response over a persistent WebSocket connection.
462
+ # This payload uses the same top-level fields as `POST /v1/responses`, plus
463
+ # WebSocket-only envelope metadata.
464
+ #
465
+ # Notes:
466
+ #
467
+ # - `stream` is implicit over WebSocket and should not be sent.
468
+ # - `background` is not supported over WebSocket.
469
+ # - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.
470
+ sig do
471
+ params(
797
472
 
798
- sig do
799
- override.returns(
800
- {
801
- type: Symbol,
802
473
  background: T.nilable(T::Boolean),
803
- context_management: T.nilable(T::Array[OpenAI::Responses::ResponsesClientEvent::ContextManagement]),
804
- conversation: T.nilable(T.any(String, OpenAI::Responses::ResponseConversationParam)),
474
+
475
+ context_management: T.nilable(
476
+ T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement::OrHash]
477
+ ),
478
+
479
+ conversation: T.nilable(T.any(String, OpenAI::Responses::ResponseConversationParam::OrHash)),
480
+
805
481
  include: T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]),
806
- input: OpenAI::Responses::ResponsesClientEvent::Input::Variants,
482
+
483
+ input: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Input::Variants,
484
+
807
485
  instructions: T.nilable(String),
486
+
808
487
  max_output_tokens: T.nilable(Integer),
488
+
809
489
  max_tool_calls: T.nilable(Integer),
490
+
810
491
  metadata: T.nilable(T::Hash[Symbol, String]),
492
+
811
493
  model: T.any(String, OpenAI::ChatModel::OrSymbol, OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol),
812
- moderation: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation),
494
+
495
+ moderation: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::OrHash),
496
+
813
497
  parallel_tool_calls: T.nilable(T::Boolean),
498
+
814
499
  previous_response_id: T.nilable(String),
815
- prompt: T.nilable(OpenAI::Responses::ResponsePrompt),
500
+
501
+ prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
502
+
816
503
  prompt_cache_key: T.nilable(String),
817
- prompt_cache_options: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions,
818
- prompt_cache_retention: T.nilable(OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention::OrSymbol),
819
- reasoning: T.nilable(OpenAI::Reasoning),
504
+
505
+ prompt_cache_options: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::OrHash,
506
+
507
+ prompt_cache_retention: T.nilable(
508
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention::OrSymbol
509
+ ),
510
+
511
+ reasoning: T.nilable(OpenAI::Reasoning::OrHash),
512
+
820
513
  safety_identifier: T.nilable(String),
821
- service_tier: T.nilable(OpenAI::Responses::ResponsesClientEvent::ServiceTier::OrSymbol),
514
+
515
+ service_tier: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::OrSymbol),
516
+
822
517
  store: T.nilable(T::Boolean),
518
+
823
519
  stream: T.nilable(T::Boolean),
520
+
824
521
  stream_id: String,
825
- stream_options: T.nilable(OpenAI::Responses::ResponsesClientEvent::StreamOptions),
522
+
523
+ stream_options: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions::OrHash),
524
+
826
525
  temperature: T.nilable(Float),
827
- text: OpenAI::Responses::ResponseTextConfig,
526
+
527
+ text: OpenAI::Responses::ResponseTextConfig::OrHash,
528
+
828
529
  tool_choice: T.any(
829
530
  OpenAI::Responses::ToolChoiceOptions::OrSymbol,
830
- OpenAI::Responses::ToolChoiceAllowed,
831
- OpenAI::Responses::ToolChoiceTypes,
832
- OpenAI::Responses::ToolChoiceFunction,
833
- OpenAI::Responses::ToolChoiceMcp,
834
- OpenAI::Responses::ToolChoiceCustom,
835
- OpenAI::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam,
836
- OpenAI::Responses::ToolChoiceApplyPatch,
837
- OpenAI::Responses::ToolChoiceShell
531
+ OpenAI::Responses::ToolChoiceAllowed::OrHash,
532
+ OpenAI::Responses::ToolChoiceTypes::OrHash,
533
+ OpenAI::Responses::ToolChoiceFunction::OrHash,
534
+ OpenAI::Responses::ToolChoiceMcp::OrHash,
535
+ OpenAI::Responses::ToolChoiceCustom::OrHash,
536
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam::OrHash,
537
+ OpenAI::Responses::ToolChoiceApplyPatch::OrHash,
538
+ OpenAI::Responses::ToolChoiceShell::OrHash
838
539
  ),
540
+
839
541
  tools: T::Array[
840
542
  T.any(
841
- OpenAI::Responses::FunctionTool,
842
- OpenAI::Responses::FileSearchTool,
843
- OpenAI::Responses::ComputerTool,
844
- OpenAI::Responses::ComputerUsePreviewTool,
845
- OpenAI::Responses::Tool::Mcp,
846
- OpenAI::Responses::Tool::CodeInterpreter,
847
- OpenAI::Responses::Tool::ProgrammaticToolCalling,
848
- OpenAI::Responses::Tool::ImageGeneration,
849
- OpenAI::Responses::Tool::LocalShell,
850
- OpenAI::Responses::FunctionShellTool,
851
- OpenAI::Responses::CustomTool,
852
- OpenAI::Responses::NamespaceTool,
853
- OpenAI::Responses::ToolSearchTool,
854
- OpenAI::Responses::ApplyPatchTool,
855
- OpenAI::Responses::WebSearchTool,
856
- OpenAI::Responses::WebSearchPreviewTool
543
+ OpenAI::Responses::FunctionTool::OrHash,
544
+ OpenAI::Responses::FileSearchTool::OrHash,
545
+ OpenAI::Responses::ComputerTool::OrHash,
546
+ OpenAI::Responses::ComputerUsePreviewTool::OrHash,
547
+ OpenAI::Responses::Tool::Mcp::OrHash,
548
+ OpenAI::Responses::Tool::CodeInterpreter::OrHash,
549
+ OpenAI::Responses::Tool::ProgrammaticToolCalling::OrHash,
550
+ OpenAI::Responses::Tool::ImageGeneration::OrHash,
551
+ OpenAI::Responses::Tool::LocalShell::OrHash,
552
+ OpenAI::Responses::FunctionShellTool::OrHash,
553
+ OpenAI::Responses::CustomTool::OrHash,
554
+ OpenAI::Responses::NamespaceTool::OrHash,
555
+ OpenAI::Responses::ToolSearchTool::OrHash,
556
+ OpenAI::Responses::ApplyPatchTool::OrHash,
557
+ OpenAI::Responses::WebSearchTool::OrHash,
558
+ OpenAI::Responses::WebSearchPreviewTool::OrHash
857
559
  )
858
560
  ],
859
- top_logprobs: T.nilable(Integer),
860
- top_p: T.nilable(Float),
861
- truncation: T.nilable(OpenAI::Responses::ResponsesClientEvent::Truncation::OrSymbol),
862
- user: String
863
- }
864
- )
865
- end
866
- def to_hash
867
- end
868
-
869
- class ContextManagement < OpenAI::Internal::Type::BaseModel
870
- OrHash = T.type_alias do
871
- T.any(
872
- OpenAI::Responses::ResponsesClientEvent::ContextManagement,
873
- OpenAI::Internal::AnyHash
874
- )
875
- end
876
561
 
877
- # The context management entry type. Currently only 'compaction' is supported.
878
- sig { returns(String) }
879
- attr_accessor :type
562
+ top_logprobs: T.nilable(Integer),
880
563
 
881
- # Token threshold at which compaction should be triggered for this entry.
882
- sig { returns(T.nilable(Integer)) }
883
- attr_accessor :compact_threshold
564
+ top_p: T.nilable(Float),
884
565
 
885
- sig do
886
- params(
566
+ truncation: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation::OrSymbol),
887
567
 
888
- type: String,
568
+ user: String,
889
569
 
890
- compact_threshold: T.nilable(Integer)
570
+ type: Symbol
891
571
  )
892
572
  .returns(T.attached_class)
893
573
  end
894
574
  def self.new(
895
575
 
896
- # The context management entry type. Currently only 'compaction' is supported.
897
- type:,
898
-
899
- # Token threshold at which compaction should be triggered for this entry.
900
-
901
- compact_threshold: nil
576
+ # Whether to run the model response in the background.
577
+ # [Learn more](https://platform.openai.com/docs/guides/background).
578
+ background: nil,
579
+
580
+ # Context management configuration for this request.
581
+ context_management: nil,
582
+
583
+ # The conversation that this response belongs to. Items from this conversation are
584
+ # prepended to `input_items` for this response request. Input items and output
585
+ # items from this response are automatically added to this conversation after this
586
+ # response completes.
587
+ conversation: nil,
588
+
589
+ # Specify additional output data to include in the model response. Currently
590
+ # supported values are:
591
+ #
592
+ # - `web_search_call.action.sources`: Include the sources of the web search tool
593
+ # call.
594
+ # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
595
+ # in code interpreter tool call items.
596
+ # - `computer_call_output.output.image_url`: Include image urls from the computer
597
+ # call output.
598
+ # - `file_search_call.results`: Include the search results of the file search tool
599
+ # call.
600
+ # - `message.input_image.image_url`: Include image urls from the input message.
601
+ # - `message.output_text.logprobs`: Include logprobs with assistant messages.
602
+ # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
603
+ # tokens in reasoning item outputs. This enables reasoning items to be used in
604
+ # multi-turn conversations when using the Responses API statelessly (like when
605
+ # the `store` parameter is set to `false`, or when an organization is enrolled
606
+ # in the zero data retention program).
607
+ include: nil,
608
+
609
+ # Text, image, or file inputs to the model, used to generate a response.
610
+ #
611
+ # Learn more:
612
+ #
613
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
614
+ # - [Image inputs](https://platform.openai.com/docs/guides/images)
615
+ # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
616
+ # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
617
+ # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
618
+ input: nil,
619
+
620
+ # A system (or developer) message inserted into the model's context.
621
+ #
622
+ # When using along with `previous_response_id`, the instructions from a previous
623
+ # response will not be carried over to the next response. This makes it simple to
624
+ # swap out system (or developer) messages in new responses.
625
+ instructions: nil,
626
+
627
+ # An upper bound for the number of tokens that can be generated for a response,
628
+ # including visible output tokens and
629
+ # [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
630
+ max_output_tokens: nil,
631
+
632
+ # The maximum number of total calls to built-in tools that can be processed in a
633
+ # response. This maximum number applies across all built-in tool calls, not per
634
+ # individual tool. Any further attempts to call a tool by the model will be
635
+ # ignored.
636
+ max_tool_calls: nil,
637
+
638
+ # Set of 16 key-value pairs that can be attached to an object. This can be useful
639
+ # for storing additional information about the object in a structured format, and
640
+ # querying for objects via API or the dashboard.
641
+ #
642
+ # Keys are strings with a maximum length of 64 characters. Values are strings with
643
+ # a maximum length of 512 characters.
644
+ metadata: nil,
645
+
646
+ # Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide
647
+ # range of models with different capabilities, performance characteristics, and
648
+ # price points. Refer to the
649
+ # [model guide](https://platform.openai.com/docs/models) to browse and compare
650
+ # available models.
651
+ model: nil,
652
+
653
+ # Configuration for running moderation on the input and output of this response.
654
+ moderation: nil,
655
+
656
+ # Whether to allow the model to run tool calls in parallel.
657
+ parallel_tool_calls: nil,
658
+
659
+ # The unique ID of the previous response to the model. Use this to create
660
+ # multi-turn conversations. Learn more about
661
+ # [conversation state](https://platform.openai.com/docs/guides/conversation-state).
662
+ # Cannot be used in conjunction with `conversation`.
663
+ previous_response_id: nil,
664
+
665
+ # Reference to a prompt template and its variables.
666
+ # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
667
+ prompt: nil,
668
+
669
+ # Used by OpenAI to cache responses for similar requests to optimize your cache
670
+ # hit rates. Replaces the `user` field.
671
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
672
+ prompt_cache_key: nil,
673
+
674
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
675
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
676
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
677
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
678
+ # up to the latest 80 breakpoints in the conversation, without a content-block
679
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
680
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
681
+ # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
682
+ # for current details.
683
+ prompt_cache_options: nil,
684
+
685
+ # Deprecated. Use `prompt_cache_options.ttl` instead.
686
+ #
687
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
688
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
689
+ # of 24 hours.
690
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
691
+ # This field expresses a maximum retention policy, while
692
+ # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
693
+ # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
694
+ # models, only `24h` is supported.
695
+ #
696
+ # For older models that support both `in_memory` and `24h`, the default depends on
697
+ # your organization's data retention policy:
698
+ #
699
+ # - Organizations without ZDR enabled default to `24h`.
700
+ # - Organizations with ZDR enabled default to `in_memory` when
701
+ # `prompt_cache_retention` is not specified.
702
+ prompt_cache_retention: nil,
703
+
704
+ # Configuration options for
705
+ # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
706
+ reasoning: nil,
707
+
708
+ # A stable identifier used to help detect users of your application that may be
709
+ # violating OpenAI's usage policies. The IDs should be a string that uniquely
710
+ # identifies each user, with a maximum length of 64 characters. We recommend
711
+ # hashing their username or email address, in order to avoid sending us any
712
+ # identifying information.
713
+ # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
714
+ safety_identifier: nil,
715
+
716
+ # Specifies the processing type used for serving the request.
717
+ #
718
+ # - If set to 'auto', then the request will be processed with the service tier
719
+ # configured in the Project settings. Unless otherwise configured, the Project
720
+ # will use 'default'.
721
+ # - If set to 'default', then the request will be processed with the standard
722
+ # pricing and performance for the selected model.
723
+ # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
724
+ # then the request will be processed with the Flex Processing service tier.
725
+ # - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
726
+ # include the `service_tier=fast` or `service_tier=priority` parameter for
727
+ # Responses or Chat Completions. The response will show `service_tier=priority`
728
+ # regardless of if you specify `service_tier=fast` or `priority` in your
729
+ # request.
730
+ # - If set to 'ultrafast', then the request will be processed with the
731
+ # access-controlled Ultrafast Processing service tier. This tier is currently
732
+ # available for `gpt-5.6-sol`; a response served through it will show
733
+ # `service_tier=ultrafast`.
734
+ # - When not set, the default behavior is 'auto'.
735
+ #
736
+ # When the `service_tier` parameter is set, the response body will include the
737
+ # `service_tier` value based on the processing mode actually used to serve the
738
+ # request. This response value may be different from the value set in the
739
+ # parameter.
740
+ service_tier: nil,
741
+
742
+ # Whether to store the generated model response for later retrieval via API.
743
+ store: nil,
744
+
745
+ # If set to true, the model response data will be streamed to the client as it is
746
+ # generated using
747
+ # [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
748
+ # See the
749
+ # [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
750
+ # for more information.
751
+ stream: nil,
752
+
753
+ # The WebSocket lane for this response. Requests with the same `stream_id` are
754
+ # processed FIFO, and events for the response echo the same `stream_id`.
755
+ #
756
+ # `stream_id` controls routing; `previous_response_id` controls conversation
757
+ # lineage, so a new lane can fork from a response created on another lane.
758
+ stream_id: nil,
759
+
760
+ # Options for streaming responses. Only set this when you set `stream: true`.
761
+ stream_options: nil,
762
+
763
+ # What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
764
+ # make the output more random, while lower values like 0.2 will make it more
765
+ # focused and deterministic. We generally recommend altering this or `top_p` but
766
+ # not both.
767
+ temperature: nil,
768
+
769
+ # Configuration options for a text response from the model. Can be plain text or
770
+ # structured JSON data. Learn more:
771
+ #
772
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
773
+ # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
774
+ text: nil,
775
+
776
+ # How the model should select which tool (or tools) to use when generating a
777
+ # response. See the `tools` parameter to see how to specify which tools the model
778
+ # can call.
779
+ tool_choice: nil,
780
+
781
+ # An array of tools the model may call while generating a response. You can
782
+ # specify which tool to use by setting the `tool_choice` parameter.
783
+ #
784
+ # We support the following categories of tools:
785
+ #
786
+ # - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
787
+ # capabilities, like
788
+ # [web search](https://platform.openai.com/docs/guides/tools-web-search) or
789
+ # [file search](https://platform.openai.com/docs/guides/tools-file-search).
790
+ # Learn more about
791
+ # [built-in tools](https://platform.openai.com/docs/guides/tools).
792
+ # - **MCP Tools**: Integrations with third-party systems via custom MCP servers or
793
+ # predefined connectors such as Google Drive and SharePoint. Learn more about
794
+ # [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
795
+ # - **Function calls (custom tools)**: Functions that are defined by you, enabling
796
+ # the model to call your own code with strongly typed arguments and outputs.
797
+ # Learn more about
798
+ # [function calling](https://platform.openai.com/docs/guides/function-calling).
799
+ # You can also use custom tools to call your own code.
800
+ tools: nil,
801
+
802
+ # An integer between 0 and 20 specifying the maximum number of most likely tokens
803
+ # to return at each token position, each with an associated log probability. In
804
+ # some cases, the number of returned tokens may be fewer than requested.
805
+ top_logprobs: nil,
806
+
807
+ # An alternative to sampling with temperature, called nucleus sampling, where the
808
+ # model considers the results of the tokens with top_p probability mass. So 0.1
809
+ # means only the tokens comprising the top 10% probability mass are considered.
810
+ #
811
+ # We generally recommend altering this or `temperature` but not both.
812
+ top_p: nil,
813
+
814
+ # The truncation strategy to use for the model response.
815
+ #
816
+ # - `auto`: If the input to this Response exceeds the model's context window size,
817
+ # the model will truncate the response to fit the context window by dropping
818
+ # items from the beginning of the conversation.
819
+ # - `disabled` (default): If the input size will exceed the context window size
820
+ # for a model, the request will fail with a 400 error.
821
+ truncation: nil,
822
+
823
+ # This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
824
+ # `prompt_cache_key` instead to maintain caching optimizations. A stable
825
+ # identifier for your end-users. Used to boost cache hit rates by better bucketing
826
+ # similar requests and to help OpenAI detect and prevent abuse.
827
+ # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
828
+ user: nil,
829
+
830
+ # The type of the client event. Always `response.create`.
831
+
832
+ type: :"response.create"
902
833
  )
903
834
  end
904
835
 
905
836
  sig do
906
837
  override.returns(
907
- {type: String, compact_threshold: T.nilable(Integer)}
838
+ {
839
+ type: Symbol,
840
+ background: T.nilable(T::Boolean),
841
+ context_management: T.nilable(
842
+ T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement]
843
+ ),
844
+ conversation: T.nilable(T.any(String, OpenAI::Responses::ResponseConversationParam)),
845
+ include: T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]),
846
+ input: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Input::Variants,
847
+ instructions: T.nilable(String),
848
+ max_output_tokens: T.nilable(Integer),
849
+ max_tool_calls: T.nilable(Integer),
850
+ metadata: T.nilable(T::Hash[Symbol, String]),
851
+ model: T.any(String, OpenAI::ChatModel::OrSymbol, OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol),
852
+ moderation: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation),
853
+ parallel_tool_calls: T.nilable(T::Boolean),
854
+ previous_response_id: T.nilable(String),
855
+ prompt: T.nilable(OpenAI::Responses::ResponsePrompt),
856
+ prompt_cache_key: T.nilable(String),
857
+ prompt_cache_options: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions,
858
+ prompt_cache_retention: T.nilable(
859
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention::OrSymbol
860
+ ),
861
+ reasoning: T.nilable(OpenAI::Reasoning),
862
+ safety_identifier: T.nilable(String),
863
+ service_tier: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::OrSymbol),
864
+ store: T.nilable(T::Boolean),
865
+ stream: T.nilable(T::Boolean),
866
+ stream_id: String,
867
+ stream_options: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions),
868
+ temperature: T.nilable(Float),
869
+ text: OpenAI::Responses::ResponseTextConfig,
870
+ tool_choice: T.any(
871
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
872
+ OpenAI::Responses::ToolChoiceAllowed,
873
+ OpenAI::Responses::ToolChoiceTypes,
874
+ OpenAI::Responses::ToolChoiceFunction,
875
+ OpenAI::Responses::ToolChoiceMcp,
876
+ OpenAI::Responses::ToolChoiceCustom,
877
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam,
878
+ OpenAI::Responses::ToolChoiceApplyPatch,
879
+ OpenAI::Responses::ToolChoiceShell
880
+ ),
881
+ tools: T::Array[
882
+ T.any(
883
+ OpenAI::Responses::FunctionTool,
884
+ OpenAI::Responses::FileSearchTool,
885
+ OpenAI::Responses::ComputerTool,
886
+ OpenAI::Responses::ComputerUsePreviewTool,
887
+ OpenAI::Responses::Tool::Mcp,
888
+ OpenAI::Responses::Tool::CodeInterpreter,
889
+ OpenAI::Responses::Tool::ProgrammaticToolCalling,
890
+ OpenAI::Responses::Tool::ImageGeneration,
891
+ OpenAI::Responses::Tool::LocalShell,
892
+ OpenAI::Responses::FunctionShellTool,
893
+ OpenAI::Responses::CustomTool,
894
+ OpenAI::Responses::NamespaceTool,
895
+ OpenAI::Responses::ToolSearchTool,
896
+ OpenAI::Responses::ApplyPatchTool,
897
+ OpenAI::Responses::WebSearchTool,
898
+ OpenAI::Responses::WebSearchPreviewTool
899
+ )
900
+ ],
901
+ top_logprobs: T.nilable(Integer),
902
+ top_p: T.nilable(Float),
903
+ truncation: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation::OrSymbol),
904
+ user: String
905
+ }
908
906
  )
909
907
  end
910
908
  def to_hash
911
909
  end
912
910
 
913
- end
911
+ class ContextManagement < OpenAI::Internal::Type::BaseModel
912
+ OrHash = T.type_alias do
913
+ T.any(
914
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ContextManagement,
915
+ OpenAI::Internal::AnyHash
916
+ )
917
+ end
914
918
 
915
- # The conversation that this response belongs to. Items from this conversation are
916
- # prepended to `input_items` for this response request. Input items and output
917
- # items from this response are automatically added to this conversation after this
918
- # response completes.
919
- module Conversation
920
- extend OpenAI::Internal::Type::Union
919
+ # The context management entry type. Currently only 'compaction' is supported.
920
+ sig { returns(String) }
921
+ attr_accessor :type
921
922
 
922
- Variants = T.type_alias { T.any(String, OpenAI::Responses::ResponseConversationParam) }
923
+ # Token threshold at which compaction should be triggered for this entry.
924
+ sig { returns(T.nilable(Integer)) }
925
+ attr_accessor :compact_threshold
923
926
 
924
- sig { override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::Conversation::Variants]) }
925
- def self.variants
926
- end
927
+ sig do
928
+ params(
927
929
 
928
- end
930
+ type: String,
929
931
 
930
- # Text, image, or file inputs to the model, used to generate a response.
931
- #
932
- # Learn more:
933
- #
934
- # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
935
- # - [Image inputs](https://platform.openai.com/docs/guides/images)
936
- # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
937
- # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
938
- # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
939
- module Input
940
- extend OpenAI::Internal::Type::Union
941
-
942
- Variants = T.type_alias { T.any(String, T::Array[OpenAI::Responses::ResponseInputItem::Variants]) }
943
-
944
- sig { override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::Input::Variants]) }
945
- def self.variants
946
- end
932
+ compact_threshold: T.nilable(Integer)
933
+ )
934
+ .returns(T.attached_class)
935
+ end
936
+ def self.new(
947
937
 
948
- end
938
+ # The context management entry type. Currently only 'compaction' is supported.
939
+ type:,
949
940
 
950
- class Moderation < OpenAI::Internal::Type::BaseModel
951
- OrHash = T.type_alias do
952
- T.any(
953
- OpenAI::Responses::ResponsesClientEvent::Moderation,
954
- OpenAI::Internal::AnyHash
941
+ # Token threshold at which compaction should be triggered for this entry.
942
+
943
+ compact_threshold: nil
955
944
  )
956
- end
945
+ end
957
946
 
958
- # The moderation model to use for moderated completions, e.g.
959
- # 'omni-moderation-latest'.
960
- sig { returns(String) }
961
- attr_accessor :model
947
+ sig do
948
+ override.returns(
949
+ {type: String, compact_threshold: T.nilable(Integer)}
950
+ )
951
+ end
952
+ def to_hash
953
+ end
962
954
 
963
- # The policy to apply to moderated response input and output.
964
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy)) }
965
- attr_reader :policy
955
+ end
966
956
 
967
- sig { params(policy: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::OrHash)).void }
968
- attr_writer :policy
957
+ # The conversation that this response belongs to. Items from this conversation are
958
+ # prepended to `input_items` for this response request. Input items and output
959
+ # items from this response are automatically added to this conversation after this
960
+ # response completes.
961
+ module Conversation
962
+ extend OpenAI::Internal::Type::Union
969
963
 
970
- # Configuration for running moderation on the input and output of this response.
971
- sig do
972
- params(
964
+ Variants = T.type_alias { T.any(String, OpenAI::Responses::ResponseConversationParam) }
973
965
 
974
- model: String,
966
+ sig {
967
+ override.returns(
968
+ T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Conversation::Variants]
969
+ )
970
+ }
971
+ def self.variants
972
+ end
975
973
 
976
- policy: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::OrHash)
977
- )
978
- .returns(T.attached_class)
979
974
  end
980
- def self.new(
981
975
 
982
- # The moderation model to use for moderated completions, e.g.
983
- # 'omni-moderation-latest'.
984
- model:,
976
+ # Text, image, or file inputs to the model, used to generate a response.
977
+ #
978
+ # Learn more:
979
+ #
980
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
981
+ # - [Image inputs](https://platform.openai.com/docs/guides/images)
982
+ # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
983
+ # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
984
+ # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
985
+ module Input
986
+ extend OpenAI::Internal::Type::Union
985
987
 
986
- # The policy to apply to moderated response input and output.
988
+ Variants = T.type_alias { T.any(String, T::Array[OpenAI::Responses::ResponseInputItem::Variants]) }
987
989
 
988
- policy: nil
989
- )
990
- end
990
+ sig {
991
+ override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Input::Variants])
992
+ }
993
+ def self.variants
994
+ end
991
995
 
992
- sig do
993
- override.returns(
994
- {model: String, policy: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy)}
995
- )
996
- end
997
- def to_hash
998
996
  end
999
997
 
1000
- class Policy < OpenAI::Internal::Type::BaseModel
998
+ class Moderation < OpenAI::Internal::Type::BaseModel
1001
999
  OrHash = T.type_alias do
1002
1000
  T.any(
1003
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy,
1001
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation,
1004
1002
  OpenAI::Internal::AnyHash
1005
1003
  )
1006
1004
  end
1007
1005
 
1008
- # The moderation policy for the response input.
1009
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input)) }
1010
- attr_reader :input
1011
-
1012
- sig {
1013
- params(input: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::OrHash)).void
1014
- }
1015
- attr_writer :input
1006
+ # The moderation model to use for moderated completions, e.g.
1007
+ # 'omni-moderation-latest'.
1008
+ sig { returns(String) }
1009
+ attr_accessor :model
1016
1010
 
1017
- # The moderation policy for the response output.
1018
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output)) }
1019
- attr_reader :output
1011
+ # The policy to apply to moderated response input and output.
1012
+ sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy)) }
1013
+ attr_reader :policy
1020
1014
 
1021
1015
  sig {
1022
- params(output: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::OrHash))
1016
+ params(
1017
+ policy: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::OrHash)
1018
+ )
1023
1019
  .void
1024
1020
  }
1025
- attr_writer :output
1021
+ attr_writer :policy
1026
1022
 
1027
- # The policy to apply to moderated response input and output.
1023
+ # Configuration for running moderation on the input and output of this response.
1028
1024
  sig do
1029
1025
  params(
1030
1026
 
1031
- input: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::OrHash),
1027
+ model: String,
1032
1028
 
1033
- output: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::OrHash)
1029
+ policy: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::OrHash)
1034
1030
  )
1035
1031
  .returns(T.attached_class)
1036
1032
  end
1037
1033
  def self.new(
1038
1034
 
1039
- # The moderation policy for the response input.
1040
- input: nil,
1035
+ # The moderation model to use for moderated completions, e.g.
1036
+ # 'omni-moderation-latest'.
1037
+ model:,
1041
1038
 
1042
- # The moderation policy for the response output.
1039
+ # The policy to apply to moderated response input and output.
1043
1040
 
1044
- output: nil
1041
+ policy: nil
1045
1042
  )
1046
1043
  end
1047
1044
 
1048
1045
  sig do
1049
1046
  override.returns(
1050
1047
  {
1051
- input: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input),
1052
- output: T.nilable(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output)
1048
+ model: String,
1049
+ policy: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy)
1053
1050
  }
1054
1051
  )
1055
1052
  end
1056
1053
  def to_hash
1057
1054
  end
1058
1055
 
1059
- class Input < OpenAI::Internal::Type::BaseModel
1056
+ class Policy < OpenAI::Internal::Type::BaseModel
1060
1057
  OrHash = T.type_alias do
1061
1058
  T.any(
1062
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input,
1059
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy,
1063
1060
  OpenAI::Internal::AnyHash
1064
1061
  )
1065
1062
  end
1066
1063
 
1067
- sig { returns(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode::OrSymbol) }
1068
- attr_accessor :mode
1069
-
1070
1064
  # The moderation policy for the response input.
1065
+ sig {
1066
+ returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input))
1067
+ }
1068
+ attr_reader :input
1069
+
1070
+ sig {
1071
+ params(
1072
+ input: T.nilable(
1073
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::OrHash
1074
+ )
1075
+ )
1076
+ .void
1077
+ }
1078
+ attr_writer :input
1079
+
1080
+ # The moderation policy for the response output.
1081
+ sig {
1082
+ returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output))
1083
+ }
1084
+ attr_reader :output
1085
+
1086
+ sig {
1087
+ params(
1088
+ output: T.nilable(
1089
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::OrHash
1090
+ )
1091
+ )
1092
+ .void
1093
+ }
1094
+ attr_writer :output
1095
+
1096
+ # The policy to apply to moderated response input and output.
1071
1097
  sig do
1072
1098
  params(
1073
1099
 
1074
- mode: OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode::OrSymbol
1100
+ input: T.nilable(
1101
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::OrHash
1102
+ ),
1103
+
1104
+ output: T.nilable(
1105
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::OrHash
1106
+ )
1075
1107
  )
1076
1108
  .returns(T.attached_class)
1077
1109
  end
1078
1110
  def self.new(
1079
1111
 
1080
- mode:
1112
+ # The moderation policy for the response input.
1113
+ input: nil,
1114
+
1115
+ # The moderation policy for the response output.
1116
+
1117
+ output: nil
1081
1118
  )
1082
1119
  end
1083
1120
 
1084
1121
  sig do
1085
1122
  override.returns(
1086
- {mode: OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode::OrSymbol}
1123
+ {
1124
+ input: T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input),
1125
+ output: T.nilable(
1126
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output
1127
+ )
1128
+ }
1087
1129
  )
1088
1130
  end
1089
1131
  def to_hash
1090
1132
  end
1091
1133
 
1092
- module Mode
1093
- extend OpenAI::Internal::Type::Enum
1134
+ class Input < OpenAI::Internal::Type::BaseModel
1135
+ OrHash = T.type_alias do
1136
+ T.any(
1137
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input,
1138
+ OpenAI::Internal::AnyHash
1139
+ )
1140
+ end
1094
1141
 
1095
- TaggedSymbol = T.type_alias {
1096
- T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode)
1142
+ sig {
1143
+ returns(
1144
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode::OrSymbol
1145
+ )
1097
1146
  }
1098
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1147
+ attr_accessor :mode
1099
1148
 
1100
- SCORE = T.let(
1101
- :score,
1102
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode::TaggedSymbol
1103
- )
1104
- BLOCK = T.let(
1105
- :block,
1106
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode::TaggedSymbol
1107
- )
1149
+ # The moderation policy for the response input.
1150
+ sig do
1151
+ params(
1108
1152
 
1109
- sig {
1110
- override.returns(
1111
- T::Array[OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Input::Mode::TaggedSymbol]
1153
+ mode: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode::OrSymbol
1112
1154
  )
1113
- }
1114
- def self.values
1155
+ .returns(T.attached_class)
1115
1156
  end
1116
- end
1117
- end
1157
+ def self.new(
1118
1158
 
1119
- class Output < OpenAI::Internal::Type::BaseModel
1120
- OrHash = T.type_alias do
1121
- T.any(
1122
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output,
1123
- OpenAI::Internal::AnyHash
1159
+ mode:
1124
1160
  )
1125
- end
1161
+ end
1126
1162
 
1127
- sig { returns(OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode::OrSymbol) }
1128
- attr_accessor :mode
1163
+ sig do
1164
+ override.returns(
1165
+ {
1166
+ mode: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode::OrSymbol
1167
+ }
1168
+ )
1169
+ end
1170
+ def to_hash
1171
+ end
1129
1172
 
1130
- # The moderation policy for the response output.
1131
- sig do
1132
- params(
1173
+ module Mode
1174
+ extend OpenAI::Internal::Type::Enum
1133
1175
 
1134
- mode: OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode::OrSymbol
1135
- )
1136
- .returns(T.attached_class)
1137
- end
1138
- def self.new(
1176
+ TaggedSymbol = T.type_alias {
1177
+ T.all(
1178
+ Symbol,
1179
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode
1180
+ )
1181
+ }
1182
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1139
1183
 
1140
- mode:
1141
- )
1142
- end
1184
+ SCORE = T.let(
1185
+ :score,
1186
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode::TaggedSymbol
1187
+ )
1188
+ BLOCK = T.let(
1189
+ :block,
1190
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode::TaggedSymbol
1191
+ )
1143
1192
 
1144
- sig do
1145
- override.returns(
1146
- {mode: OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode::OrSymbol}
1147
- )
1148
- end
1149
- def to_hash
1193
+ sig {
1194
+ override.returns(
1195
+ T::Array[
1196
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Input::Mode::TaggedSymbol
1197
+ ]
1198
+ )
1199
+ }
1200
+ def self.values
1201
+ end
1202
+ end
1150
1203
  end
1151
1204
 
1152
- module Mode
1153
- extend OpenAI::Internal::Type::Enum
1205
+ class Output < OpenAI::Internal::Type::BaseModel
1206
+ OrHash = T.type_alias do
1207
+ T.any(
1208
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output,
1209
+ OpenAI::Internal::AnyHash
1210
+ )
1211
+ end
1154
1212
 
1155
- TaggedSymbol = T.type_alias {
1156
- T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode)
1213
+ sig {
1214
+ returns(
1215
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode::OrSymbol
1216
+ )
1157
1217
  }
1158
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1218
+ attr_accessor :mode
1159
1219
 
1160
- SCORE = T.let(
1161
- :score,
1162
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode::TaggedSymbol
1163
- )
1164
- BLOCK = T.let(
1165
- :block,
1166
- OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode::TaggedSymbol
1220
+ # The moderation policy for the response output.
1221
+ sig do
1222
+ params(
1223
+
1224
+ mode: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode::OrSymbol
1225
+ )
1226
+ .returns(T.attached_class)
1227
+ end
1228
+ def self.new(
1229
+
1230
+ mode:
1167
1231
  )
1232
+ end
1168
1233
 
1169
- sig {
1234
+ sig do
1170
1235
  override.returns(
1171
- T::Array[OpenAI::Responses::ResponsesClientEvent::Moderation::Policy::Output::Mode::TaggedSymbol]
1236
+ {
1237
+ mode: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode::OrSymbol
1238
+ }
1172
1239
  )
1173
- }
1174
- def self.values
1240
+ end
1241
+ def to_hash
1242
+ end
1243
+
1244
+ module Mode
1245
+ extend OpenAI::Internal::Type::Enum
1246
+
1247
+ TaggedSymbol = T.type_alias {
1248
+ T.all(
1249
+ Symbol,
1250
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode
1251
+ )
1252
+ }
1253
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1254
+
1255
+ SCORE = T.let(
1256
+ :score,
1257
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode::TaggedSymbol
1258
+ )
1259
+ BLOCK = T.let(
1260
+ :block,
1261
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode::TaggedSymbol
1262
+ )
1263
+
1264
+ sig {
1265
+ override.returns(
1266
+ T::Array[
1267
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Moderation::Policy::Output::Mode::TaggedSymbol
1268
+ ]
1269
+ )
1270
+ }
1271
+ def self.values
1272
+ end
1175
1273
  end
1176
1274
  end
1177
1275
  end
1178
1276
  end
1179
- end
1180
1277
 
1181
- class PromptCacheOptions < OpenAI::Internal::Type::BaseModel
1182
- OrHash = T.type_alias do
1183
- T.any(
1184
- OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions,
1185
- OpenAI::Internal::AnyHash
1186
- )
1187
- end
1278
+ class PromptCacheOptions < OpenAI::Internal::Type::BaseModel
1279
+ OrHash = T.type_alias do
1280
+ T.any(
1281
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions,
1282
+ OpenAI::Internal::AnyHash
1283
+ )
1284
+ end
1188
1285
 
1189
- # Controls whether OpenAI automatically creates an implicit cache breakpoint.
1190
- # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
1191
- # and writes up to the latest three explicit breakpoints in the request. With
1192
- # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
1193
- # latest four explicit breakpoints. If there are no explicit breakpoints, the
1194
- # request does not use prompt caching.
1195
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode::OrSymbol)) }
1196
- attr_reader :mode
1286
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
1287
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
1288
+ # and writes up to the latest three explicit breakpoints in the request. With
1289
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
1290
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
1291
+ # request does not use prompt caching.
1292
+ sig {
1293
+ returns(
1294
+ T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode::OrSymbol)
1295
+ )
1296
+ }
1297
+ attr_reader :mode
1197
1298
 
1198
- sig { params(mode: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode::OrSymbol).void }
1199
- attr_writer :mode
1299
+ sig {
1300
+ params(mode: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode::OrSymbol)
1301
+ .void
1302
+ }
1303
+ attr_writer :mode
1200
1304
 
1201
- # The minimum lifetime applied to every implicit and explicit cache breakpoint
1202
- # written by the request. Defaults to `30m`, which is currently the only supported
1203
- # value. The backend may retain cache entries for longer.
1204
- sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl::OrSymbol)) }
1205
- attr_reader :ttl
1305
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
1306
+ # written by the request. Defaults to `30m`, which is currently the only supported
1307
+ # value. The backend may retain cache entries for longer.
1308
+ sig {
1309
+ returns(
1310
+ T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::OrSymbol)
1311
+ )
1312
+ }
1313
+ attr_reader :ttl
1206
1314
 
1207
- sig { params(ttl: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl::OrSymbol).void }
1208
- attr_writer :ttl
1315
+ sig {
1316
+ params(ttl: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::OrSymbol)
1317
+ .void
1318
+ }
1319
+ attr_writer :ttl
1320
+
1321
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
1322
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
1323
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
1324
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
1325
+ # up to the latest 80 breakpoints in the conversation, without a content-block
1326
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
1327
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
1328
+ # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
1329
+ # for current details.
1330
+ sig do
1331
+ params(
1209
1332
 
1210
- # Options for prompt caching. Supported for `gpt-5.6` and later models. By
1211
- # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
1212
- # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
1213
- # request can write up to four breakpoints. For cache matching, OpenAI considers
1214
- # up to the latest 80 breakpoints in the conversation, without a content-block
1215
- # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
1216
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
1217
- # [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
1218
- # for current details.
1219
- sig do
1220
- params(
1333
+ mode: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode::OrSymbol,
1221
1334
 
1222
- mode: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode::OrSymbol,
1335
+ ttl: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::OrSymbol
1336
+ )
1337
+ .returns(T.attached_class)
1338
+ end
1339
+ def self.new(
1340
+
1341
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
1342
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
1343
+ # and writes up to the latest three explicit breakpoints in the request. With
1344
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
1345
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
1346
+ # request does not use prompt caching.
1347
+ mode: nil,
1348
+
1349
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
1350
+ # written by the request. Defaults to `30m`, which is currently the only supported
1351
+ # value. The backend may retain cache entries for longer.
1223
1352
 
1224
- ttl: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl::OrSymbol
1353
+ ttl: nil
1225
1354
  )
1226
- .returns(T.attached_class)
1227
- end
1228
- def self.new(
1355
+ end
1356
+
1357
+ sig do
1358
+ override.returns(
1359
+ {
1360
+ mode: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode::OrSymbol,
1361
+ ttl: OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::OrSymbol
1362
+ }
1363
+ )
1364
+ end
1365
+ def to_hash
1366
+ end
1229
1367
 
1230
1368
  # Controls whether OpenAI automatically creates an implicit cache breakpoint.
1231
1369
  # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
@@ -1233,182 +1371,170 @@ module OpenAI
1233
1371
  # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
1234
1372
  # latest four explicit breakpoints. If there are no explicit breakpoints, the
1235
1373
  # request does not use prompt caching.
1236
- mode: nil,
1374
+ module Mode
1375
+ extend OpenAI::Internal::Type::Enum
1376
+
1377
+ TaggedSymbol = T.type_alias {
1378
+ T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode)
1379
+ }
1380
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1381
+
1382
+ IMPLICIT = T.let(
1383
+ :implicit,
1384
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode::TaggedSymbol
1385
+ )
1386
+ EXPLICIT = T.let(
1387
+ :explicit,
1388
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode::TaggedSymbol
1389
+ )
1390
+
1391
+ sig {
1392
+ override.returns(
1393
+ T::Array[
1394
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Mode::TaggedSymbol
1395
+ ]
1396
+ )
1397
+ }
1398
+ def self.values
1399
+ end
1400
+ end
1237
1401
 
1238
1402
  # The minimum lifetime applied to every implicit and explicit cache breakpoint
1239
1403
  # written by the request. Defaults to `30m`, which is currently the only supported
1240
1404
  # value. The backend may retain cache entries for longer.
1405
+ module Ttl
1406
+ extend OpenAI::Internal::Type::Enum
1241
1407
 
1242
- ttl: nil
1243
- )
1244
- end
1408
+ TaggedSymbol = T.type_alias {
1409
+ T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl)
1410
+ }
1411
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1245
1412
 
1246
- sig do
1247
- override.returns(
1248
- {
1249
- mode: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode::OrSymbol,
1250
- ttl: OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl::OrSymbol
1413
+ TTL_30M = T.let(
1414
+ :"30m",
1415
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::TaggedSymbol
1416
+ )
1417
+
1418
+ sig {
1419
+ override.returns(
1420
+ T::Array[
1421
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::TaggedSymbol
1422
+ ]
1423
+ )
1251
1424
  }
1252
- )
1253
- end
1254
- def to_hash
1425
+ def self.values
1426
+ end
1427
+ end
1255
1428
  end
1256
1429
 
1257
- # Controls whether OpenAI automatically creates an implicit cache breakpoint.
1258
- # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
1259
- # and writes up to the latest three explicit breakpoints in the request. With
1260
- # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
1261
- # latest four explicit breakpoints. If there are no explicit breakpoints, the
1262
- # request does not use prompt caching.
1263
- module Mode
1430
+ # Deprecated. Use `prompt_cache_options.ttl` instead.
1431
+ #
1432
+ # The retention policy for the prompt cache. Set to `24h` to enable extended
1433
+ # prompt caching, which keeps cached prefixes active for longer, up to a maximum
1434
+ # of 24 hours.
1435
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
1436
+ # This field expresses a maximum retention policy, while
1437
+ # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
1438
+ # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
1439
+ # models, only `24h` is supported.
1440
+ #
1441
+ # For older models that support both `in_memory` and `24h`, the default depends on
1442
+ # your organization's data retention policy:
1443
+ #
1444
+ # - Organizations without ZDR enabled default to `24h`.
1445
+ # - Organizations with ZDR enabled default to `in_memory` when
1446
+ # `prompt_cache_retention` is not specified.
1447
+ module PromptCacheRetention
1264
1448
  extend OpenAI::Internal::Type::Enum
1265
1449
 
1266
1450
  TaggedSymbol = T.type_alias {
1267
- T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode)
1451
+ T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention)
1268
1452
  }
1269
1453
  OrSymbol = T.type_alias { T.any(Symbol, String) }
1270
1454
 
1271
- IMPLICIT = T.let(:implicit, OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode::TaggedSymbol)
1272
- EXPLICIT = T.let(:explicit, OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode::TaggedSymbol)
1455
+ IN_MEMORY = T.let(
1456
+ :in_memory,
1457
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention::TaggedSymbol
1458
+ )
1459
+ PROMPT_CACHE_RETENTION_24H = T.let(
1460
+ :"24h",
1461
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention::TaggedSymbol
1462
+ )
1273
1463
 
1274
1464
  sig {
1275
1465
  override.returns(
1276
- T::Array[OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Mode::TaggedSymbol]
1466
+ T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheRetention::TaggedSymbol]
1277
1467
  )
1278
1468
  }
1279
1469
  def self.values
1280
1470
  end
1281
1471
  end
1282
1472
 
1283
- # The minimum lifetime applied to every implicit and explicit cache breakpoint
1284
- # written by the request. Defaults to `30m`, which is currently the only supported
1285
- # value. The backend may retain cache entries for longer.
1286
- module Ttl
1473
+ # Specifies the processing type used for serving the request.
1474
+ #
1475
+ # - If set to 'auto', then the request will be processed with the service tier
1476
+ # configured in the Project settings. Unless otherwise configured, the Project
1477
+ # will use 'default'.
1478
+ # - If set to 'default', then the request will be processed with the standard
1479
+ # pricing and performance for the selected model.
1480
+ # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
1481
+ # then the request will be processed with the Flex Processing service tier.
1482
+ # - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
1483
+ # include the `service_tier=fast` or `service_tier=priority` parameter for
1484
+ # Responses or Chat Completions. The response will show `service_tier=priority`
1485
+ # regardless of if you specify `service_tier=fast` or `priority` in your
1486
+ # request.
1487
+ # - If set to 'ultrafast', then the request will be processed with the
1488
+ # access-controlled Ultrafast Processing service tier. This tier is currently
1489
+ # available for `gpt-5.6-sol`; a response served through it will show
1490
+ # `service_tier=ultrafast`.
1491
+ # - When not set, the default behavior is 'auto'.
1492
+ #
1493
+ # When the `service_tier` parameter is set, the response body will include the
1494
+ # `service_tier` value based on the processing mode actually used to serve the
1495
+ # request. This response value may be different from the value set in the
1496
+ # parameter.
1497
+ module ServiceTier
1287
1498
  extend OpenAI::Internal::Type::Enum
1288
1499
 
1289
1500
  TaggedSymbol = T.type_alias {
1290
- T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl)
1501
+ T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier)
1291
1502
  }
1292
1503
  OrSymbol = T.type_alias { T.any(Symbol, String) }
1293
1504
 
1294
- TTL_30M = T.let(:"30m", OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl::TaggedSymbol)
1505
+ AUTO = T.let(:auto, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::TaggedSymbol)
1506
+ DEFAULT = T.let(
1507
+ :default,
1508
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::TaggedSymbol
1509
+ )
1510
+ FLEX = T.let(:flex, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::TaggedSymbol)
1511
+ SCALE = T.let(:scale, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::TaggedSymbol)
1512
+ PRIORITY = T.let(
1513
+ :priority,
1514
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::TaggedSymbol
1515
+ )
1516
+ FAST = T.let(:fast, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::TaggedSymbol)
1517
+ ULTRAFAST = T.let(
1518
+ :ultrafast,
1519
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::TaggedSymbol
1520
+ )
1295
1521
 
1296
1522
  sig {
1297
- override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::PromptCacheOptions::Ttl::TaggedSymbol])
1523
+ override.returns(
1524
+ T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ServiceTier::TaggedSymbol]
1525
+ )
1298
1526
  }
1299
1527
  def self.values
1300
1528
  end
1301
1529
  end
1302
- end
1303
-
1304
- # Deprecated. Use `prompt_cache_options.ttl` instead.
1305
- #
1306
- # The retention policy for the prompt cache. Set to `24h` to enable extended
1307
- # prompt caching, which keeps cached prefixes active for longer, up to a maximum
1308
- # of 24 hours.
1309
- # [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
1310
- # This field expresses a maximum retention policy, while
1311
- # `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
1312
- # are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
1313
- # models, only `24h` is supported.
1314
- #
1315
- # For older models that support both `in_memory` and `24h`, the default depends on
1316
- # your organization's data retention policy:
1317
- #
1318
- # - Organizations without ZDR enabled default to `24h`.
1319
- # - Organizations with ZDR enabled default to `in_memory` when
1320
- # `prompt_cache_retention` is not specified.
1321
- module PromptCacheRetention
1322
- extend OpenAI::Internal::Type::Enum
1323
-
1324
- TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention) }
1325
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1326
-
1327
- IN_MEMORY = T.let(:in_memory, OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention::TaggedSymbol)
1328
- PROMPT_CACHE_RETENTION_24H = T.let(
1329
- :"24h",
1330
- OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention::TaggedSymbol
1331
- )
1332
-
1333
- sig {
1334
- override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::PromptCacheRetention::TaggedSymbol])
1335
- }
1336
- def self.values
1337
- end
1338
- end
1339
-
1340
- # Specifies the processing type used for serving the request.
1341
- #
1342
- # - If set to 'auto', then the request will be processed with the service tier
1343
- # configured in the Project settings. Unless otherwise configured, the Project
1344
- # will use 'default'.
1345
- # - If set to 'default', then the request will be processed with the standard
1346
- # pricing and performance for the selected model.
1347
- # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)',
1348
- # then the request will be processed with the Flex Processing service tier.
1349
- # - To opt-in to [Fast mode](/api/docs/guides/fast-mode) at the request level,
1350
- # include the `service_tier=fast` or `service_tier=priority` parameter for
1351
- # Responses or Chat Completions. The response will show `service_tier=priority`
1352
- # regardless of if you specify `service_tier=fast` or `priority` in your
1353
- # request.
1354
- # - If set to 'ultrafast', then the request will be processed with the
1355
- # access-controlled Ultrafast Processing service tier. This tier is currently
1356
- # available for `gpt-5.6-sol`; a response served through it will show
1357
- # `service_tier=ultrafast`.
1358
- # - When not set, the default behavior is 'auto'.
1359
- #
1360
- # When the `service_tier` parameter is set, the response body will include the
1361
- # `service_tier` value based on the processing mode actually used to serve the
1362
- # request. This response value may be different from the value set in the
1363
- # parameter.
1364
- module ServiceTier
1365
- extend OpenAI::Internal::Type::Enum
1366
-
1367
- TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::ServiceTier) }
1368
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1369
-
1370
- AUTO = T.let(:auto, OpenAI::Responses::ResponsesClientEvent::ServiceTier::TaggedSymbol)
1371
- DEFAULT = T.let(:default, OpenAI::Responses::ResponsesClientEvent::ServiceTier::TaggedSymbol)
1372
- FLEX = T.let(:flex, OpenAI::Responses::ResponsesClientEvent::ServiceTier::TaggedSymbol)
1373
- SCALE = T.let(:scale, OpenAI::Responses::ResponsesClientEvent::ServiceTier::TaggedSymbol)
1374
- PRIORITY = T.let(:priority, OpenAI::Responses::ResponsesClientEvent::ServiceTier::TaggedSymbol)
1375
- FAST = T.let(:fast, OpenAI::Responses::ResponsesClientEvent::ServiceTier::TaggedSymbol)
1376
- ULTRAFAST = T.let(:ultrafast, OpenAI::Responses::ResponsesClientEvent::ServiceTier::TaggedSymbol)
1377
-
1378
- sig { override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::ServiceTier::TaggedSymbol]) }
1379
- def self.values
1380
- end
1381
- end
1382
1530
 
1383
- class StreamOptions < OpenAI::Internal::Type::BaseModel
1384
- OrHash = T.type_alias do
1385
- T.any(
1386
- OpenAI::Responses::ResponsesClientEvent::StreamOptions,
1387
- OpenAI::Internal::AnyHash
1388
- )
1389
- end
1390
-
1391
- # When true, stream obfuscation will be enabled. Stream obfuscation adds random
1392
- # characters to an `obfuscation` field on streaming delta events to normalize
1393
- # payload sizes as a mitigation to certain side-channel attacks. These obfuscation
1394
- # fields are included by default, but add a small amount of overhead to the data
1395
- # stream. You can set `include_obfuscation` to false to optimize for bandwidth if
1396
- # you trust the network links between your application and the OpenAI API.
1397
- sig { returns(T.nilable(T::Boolean)) }
1398
- attr_reader :include_obfuscation
1399
-
1400
- sig { params(include_obfuscation: T::Boolean).void }
1401
- attr_writer :include_obfuscation
1402
-
1403
- # Options for streaming responses. Only set this when you set `stream: true`.
1404
- sig do
1405
- params(
1406
-
1407
- include_obfuscation: T::Boolean
1408
- )
1409
- .returns(T.attached_class)
1410
- end
1411
- def self.new(
1531
+ class StreamOptions < OpenAI::Internal::Type::BaseModel
1532
+ OrHash = T.type_alias do
1533
+ T.any(
1534
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::StreamOptions,
1535
+ OpenAI::Internal::AnyHash
1536
+ )
1537
+ end
1412
1538
 
1413
1539
  # When true, stream obfuscation will be enabled. Stream obfuscation adds random
1414
1540
  # characters to an `obfuscation` field on streaming delta events to normalize
@@ -1416,71 +1542,36 @@ module OpenAI
1416
1542
  # fields are included by default, but add a small amount of overhead to the data
1417
1543
  # stream. You can set `include_obfuscation` to false to optimize for bandwidth if
1418
1544
  # you trust the network links between your application and the OpenAI API.
1545
+ sig { returns(T.nilable(T::Boolean)) }
1546
+ attr_reader :include_obfuscation
1419
1547
 
1420
- include_obfuscation: nil
1421
- )
1422
- end
1423
-
1424
- sig do
1425
- override.returns(
1426
- {include_obfuscation: T::Boolean}
1427
- )
1428
- end
1429
- def to_hash
1430
- end
1431
-
1432
- end
1433
-
1434
- # How the model should select which tool (or tools) to use when generating a
1435
- # response. See the `tools` parameter to see how to specify which tools the model
1436
- # can call.
1437
- module ToolChoice
1438
- extend OpenAI::Internal::Type::Union
1439
-
1440
- Variants = T.type_alias {
1441
- T.any(
1442
- OpenAI::Responses::ToolChoiceOptions::TaggedSymbol,
1443
- OpenAI::Responses::ToolChoiceAllowed,
1444
- OpenAI::Responses::ToolChoiceTypes,
1445
- OpenAI::Responses::ToolChoiceFunction,
1446
- OpenAI::Responses::ToolChoiceMcp,
1447
- OpenAI::Responses::ToolChoiceCustom,
1448
- OpenAI::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam,
1449
- OpenAI::Responses::ToolChoiceApplyPatch,
1450
- OpenAI::Responses::ToolChoiceShell
1451
- )
1452
- }
1453
-
1454
- class SpecificProgrammaticToolCallingParam < OpenAI::Internal::Type::BaseModel
1455
- OrHash = T.type_alias do
1456
- T.any(
1457
- OpenAI::Responses::ResponsesClientEvent::ToolChoice::SpecificProgrammaticToolCallingParam,
1458
- OpenAI::Internal::AnyHash
1459
- )
1460
- end
1461
-
1462
- # The tool to call. Always `programmatic_tool_calling`.
1463
- sig { returns(Symbol) }
1464
- attr_accessor :type
1548
+ sig { params(include_obfuscation: T::Boolean).void }
1549
+ attr_writer :include_obfuscation
1465
1550
 
1551
+ # Options for streaming responses. Only set this when you set `stream: true`.
1466
1552
  sig do
1467
1553
  params(
1468
1554
 
1469
- type: Symbol
1555
+ include_obfuscation: T::Boolean
1470
1556
  )
1471
1557
  .returns(T.attached_class)
1472
1558
  end
1473
1559
  def self.new(
1474
1560
 
1475
- # The tool to call. Always `programmatic_tool_calling`.
1561
+ # When true, stream obfuscation will be enabled. Stream obfuscation adds random
1562
+ # characters to an `obfuscation` field on streaming delta events to normalize
1563
+ # payload sizes as a mitigation to certain side-channel attacks. These obfuscation
1564
+ # fields are included by default, but add a small amount of overhead to the data
1565
+ # stream. You can set `include_obfuscation` to false to optimize for bandwidth if
1566
+ # you trust the network links between your application and the OpenAI API.
1476
1567
 
1477
- type: :programmatic_tool_calling
1568
+ include_obfuscation: nil
1478
1569
  )
1479
1570
  end
1480
1571
 
1481
1572
  sig do
1482
1573
  override.returns(
1483
- {type: Symbol}
1574
+ {include_obfuscation: T::Boolean}
1484
1575
  )
1485
1576
  end
1486
1577
  def to_hash
@@ -1488,33 +1579,106 @@ module OpenAI
1488
1579
 
1489
1580
  end
1490
1581
 
1491
- sig { override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::ToolChoice::Variants]) }
1492
- def self.variants
1493
- end
1582
+ # How the model should select which tool (or tools) to use when generating a
1583
+ # response. See the `tools` parameter to see how to specify which tools the model
1584
+ # can call.
1585
+ module ToolChoice
1586
+ extend OpenAI::Internal::Type::Union
1494
1587
 
1495
- end
1588
+ Variants = T.type_alias {
1589
+ T.any(
1590
+ OpenAI::Responses::ToolChoiceOptions::TaggedSymbol,
1591
+ OpenAI::Responses::ToolChoiceAllowed,
1592
+ OpenAI::Responses::ToolChoiceTypes,
1593
+ OpenAI::Responses::ToolChoiceFunction,
1594
+ OpenAI::Responses::ToolChoiceMcp,
1595
+ OpenAI::Responses::ToolChoiceCustom,
1596
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam,
1597
+ OpenAI::Responses::ToolChoiceApplyPatch,
1598
+ OpenAI::Responses::ToolChoiceShell
1599
+ )
1600
+ }
1496
1601
 
1497
- # The truncation strategy to use for the model response.
1498
- #
1499
- # - `auto`: If the input to this Response exceeds the model's context window size,
1500
- # the model will truncate the response to fit the context window by dropping
1501
- # items from the beginning of the conversation.
1502
- # - `disabled` (default): If the input size will exceed the context window size
1503
- # for a model, the request will fail with a 400 error.
1504
- module Truncation
1505
- extend OpenAI::Internal::Type::Enum
1602
+ class SpecificProgrammaticToolCallingParam < OpenAI::Internal::Type::BaseModel
1603
+ OrHash = T.type_alias do
1604
+ T.any(
1605
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::SpecificProgrammaticToolCallingParam,
1606
+ OpenAI::Internal::AnyHash
1607
+ )
1608
+ end
1506
1609
 
1507
- TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::Truncation) }
1508
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1610
+ # The tool to call. Always `programmatic_tool_calling`.
1611
+ sig { returns(Symbol) }
1612
+ attr_accessor :type
1509
1613
 
1510
- AUTO = T.let(:auto, OpenAI::Responses::ResponsesClientEvent::Truncation::TaggedSymbol)
1511
- DISABLED = T.let(:disabled, OpenAI::Responses::ResponsesClientEvent::Truncation::TaggedSymbol)
1614
+ sig do
1615
+ params(
1512
1616
 
1513
- sig { override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::Truncation::TaggedSymbol]) }
1514
- def self.values
1617
+ type: Symbol
1618
+ )
1619
+ .returns(T.attached_class)
1620
+ end
1621
+ def self.new(
1622
+
1623
+ # The tool to call. Always `programmatic_tool_calling`.
1624
+
1625
+ type: :programmatic_tool_calling
1626
+ )
1627
+ end
1628
+
1629
+ sig do
1630
+ override.returns(
1631
+ {type: Symbol}
1632
+ )
1633
+ end
1634
+ def to_hash
1635
+ end
1636
+
1637
+ end
1638
+
1639
+ sig {
1640
+ override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::ToolChoice::Variants])
1641
+ }
1642
+ def self.variants
1643
+ end
1644
+
1645
+ end
1646
+
1647
+ # The truncation strategy to use for the model response.
1648
+ #
1649
+ # - `auto`: If the input to this Response exceeds the model's context window size,
1650
+ # the model will truncate the response to fit the context window by dropping
1651
+ # items from the beginning of the conversation.
1652
+ # - `disabled` (default): If the input size will exceed the context window size
1653
+ # for a model, the request will fail with a 400 error.
1654
+ module Truncation
1655
+ extend OpenAI::Internal::Type::Enum
1656
+
1657
+ TaggedSymbol = T.type_alias {
1658
+ T.all(Symbol, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation)
1659
+ }
1660
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1661
+
1662
+ AUTO = T.let(:auto, OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation::TaggedSymbol)
1663
+ DISABLED = T.let(
1664
+ :disabled,
1665
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation::TaggedSymbol
1666
+ )
1667
+
1668
+ sig {
1669
+ override.returns(
1670
+ T::Array[OpenAI::Responses::ResponsesClientEvent::ResponseCreate::Truncation::TaggedSymbol]
1671
+ )
1672
+ }
1673
+ def self.values
1674
+ end
1515
1675
  end
1516
1676
  end
1517
1677
 
1678
+ sig { override.returns(T::Array[OpenAI::Responses::ResponsesClientEvent::Variants]) }
1679
+ def self.variants
1680
+ end
1681
+
1518
1682
  end
1519
1683
 
1520
1684
  end