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