openai 0.15.0 → 0.17.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 (174) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -0
  3. data/README.md +14 -20
  4. data/lib/openai/helpers/structured_output/json_schema_converter.rb +20 -21
  5. data/lib/openai/helpers/structured_output/union_of.rb +11 -1
  6. data/lib/openai/internal/transport/base_client.rb +1 -1
  7. data/lib/openai/internal/type/enum.rb +6 -6
  8. data/lib/openai/internal/type/union.rb +13 -17
  9. data/lib/openai/models/beta/assistant_create_params.rb +4 -5
  10. data/lib/openai/models/beta/assistant_update_params.rb +22 -5
  11. data/lib/openai/models/beta/threads/run_create_params.rb +4 -5
  12. data/lib/openai/models/chat/chat_completion_allowed_tool_choice.rb +33 -0
  13. data/lib/openai/models/chat/chat_completion_allowed_tools.rb +64 -0
  14. data/lib/openai/models/chat/chat_completion_assistant_message_param.rb +3 -5
  15. data/lib/openai/models/chat/chat_completion_custom_tool.rb +163 -0
  16. data/lib/openai/models/chat/chat_completion_function_tool.rb +29 -0
  17. data/lib/openai/models/chat/chat_completion_message.rb +3 -5
  18. data/lib/openai/models/chat/chat_completion_message_custom_tool_call.rb +60 -0
  19. data/lib/openai/models/chat/chat_completion_message_function_tool_call.rb +73 -0
  20. data/lib/openai/models/chat/chat_completion_message_tool_call.rb +10 -56
  21. data/lib/openai/models/chat/chat_completion_named_tool_choice.rb +2 -2
  22. data/lib/openai/models/chat/chat_completion_named_tool_choice_custom.rb +42 -0
  23. data/lib/openai/models/chat/chat_completion_store_message.rb +32 -1
  24. data/lib/openai/models/chat/chat_completion_stream_options.rb +14 -1
  25. data/lib/openai/models/chat/chat_completion_tool.rb +12 -14
  26. data/lib/openai/models/chat/chat_completion_tool_choice_option.rb +7 -1
  27. data/lib/openai/models/chat/completion_create_params.rb +65 -16
  28. data/lib/openai/models/chat_model.rb +7 -0
  29. data/lib/openai/models/custom_tool_input_format.rb +76 -0
  30. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +3 -3
  31. data/lib/openai/models/evals/run_cancel_response.rb +2 -2
  32. data/lib/openai/models/evals/run_create_params.rb +2 -2
  33. data/lib/openai/models/evals/run_create_response.rb +2 -2
  34. data/lib/openai/models/evals/run_list_response.rb +2 -2
  35. data/lib/openai/models/evals/run_retrieve_response.rb +2 -2
  36. data/lib/openai/models/reasoning.rb +4 -5
  37. data/lib/openai/models/reasoning_effort.rb +4 -4
  38. data/lib/openai/models/response_format_text_grammar.rb +27 -0
  39. data/lib/openai/models/response_format_text_python.rb +20 -0
  40. data/lib/openai/models/responses/custom_tool.rb +48 -0
  41. data/lib/openai/models/responses/response.rb +70 -16
  42. data/lib/openai/models/responses/response_create_params.rb +78 -14
  43. data/lib/openai/models/responses/response_custom_tool_call.rb +55 -0
  44. data/lib/openai/models/responses/response_custom_tool_call_input_delta_event.rb +52 -0
  45. data/lib/openai/models/responses/response_custom_tool_call_input_done_event.rb +52 -0
  46. data/lib/openai/models/responses/response_custom_tool_call_output.rb +47 -0
  47. data/lib/openai/models/responses/response_input_item.rb +7 -1
  48. data/lib/openai/models/responses/response_output_item.rb +4 -1
  49. data/lib/openai/models/responses/response_output_item_added_event.rb +2 -2
  50. data/lib/openai/models/responses/response_output_item_done_event.rb +2 -2
  51. data/lib/openai/models/responses/response_reasoning_item.rb +36 -5
  52. data/lib/openai/models/responses/response_reasoning_text_delta_event.rb +63 -0
  53. data/lib/openai/models/responses/response_reasoning_text_done_event.rb +63 -0
  54. data/lib/openai/models/responses/response_retrieve_params.rb +14 -1
  55. data/lib/openai/models/responses/response_stream_event.rb +13 -11
  56. data/lib/openai/models/responses/response_text_config.rb +27 -1
  57. data/lib/openai/models/responses/tool.rb +5 -1
  58. data/lib/openai/models/responses/tool_choice_allowed.rb +73 -0
  59. data/lib/openai/models/responses/tool_choice_custom.rb +28 -0
  60. data/lib/openai/models/vector_store_search_params.rb +6 -1
  61. data/lib/openai/models.rb +6 -0
  62. data/lib/openai/resources/beta/assistants.rb +2 -2
  63. data/lib/openai/resources/beta/threads/runs.rb +2 -2
  64. data/lib/openai/resources/chat/completions.rb +26 -12
  65. data/lib/openai/resources/responses.rb +77 -36
  66. data/lib/openai/version.rb +1 -1
  67. data/lib/openai.rb +19 -2
  68. data/rbi/openai/internal/transport/base_client.rbi +1 -1
  69. data/rbi/openai/models/beta/assistant_create_params.rbi +6 -8
  70. data/rbi/openai/models/beta/assistant_update_params.rbi +36 -8
  71. data/rbi/openai/models/beta/threads/run_create_params.rbi +6 -8
  72. data/rbi/openai/models/chat/chat_completion_allowed_tool_choice.rbi +60 -0
  73. data/rbi/openai/models/chat/chat_completion_allowed_tools.rbi +118 -0
  74. data/rbi/openai/models/chat/chat_completion_assistant_message_param.rbi +27 -4
  75. data/rbi/openai/models/chat/chat_completion_custom_tool.rbi +335 -0
  76. data/rbi/openai/models/chat/chat_completion_function_tool.rbi +51 -0
  77. data/rbi/openai/models/chat/chat_completion_message.rbi +17 -4
  78. data/rbi/openai/models/chat/chat_completion_message_custom_tool_call.rbi +105 -0
  79. data/rbi/openai/models/chat/chat_completion_message_function_tool_call.rbi +118 -0
  80. data/rbi/openai/models/chat/chat_completion_message_tool_call.rbi +9 -92
  81. data/rbi/openai/models/chat/chat_completion_named_tool_choice.rbi +2 -2
  82. data/rbi/openai/models/chat/chat_completion_named_tool_choice_custom.rbi +89 -0
  83. data/rbi/openai/models/chat/chat_completion_store_message.rbi +68 -3
  84. data/rbi/openai/models/chat/chat_completion_stream_options.rbi +30 -2
  85. data/rbi/openai/models/chat/chat_completion_tool.rbi +11 -30
  86. data/rbi/openai/models/chat/chat_completion_tool_choice_option.rbi +3 -1
  87. data/rbi/openai/models/chat/completion_create_params.rbi +150 -31
  88. data/rbi/openai/models/chat_model.rbi +11 -0
  89. data/rbi/openai/models/custom_tool_input_format.rbi +136 -0
  90. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +8 -4
  91. data/rbi/openai/models/evals/run_cancel_response.rbi +2 -0
  92. data/rbi/openai/models/evals/run_create_params.rbi +4 -0
  93. data/rbi/openai/models/evals/run_create_response.rbi +2 -0
  94. data/rbi/openai/models/evals/run_list_response.rbi +2 -0
  95. data/rbi/openai/models/evals/run_retrieve_response.rbi +2 -0
  96. data/rbi/openai/models/reasoning.rbi +6 -8
  97. data/rbi/openai/models/reasoning_effort.rbi +4 -4
  98. data/rbi/openai/models/response_format_text_grammar.rbi +35 -0
  99. data/rbi/openai/models/response_format_text_python.rbi +30 -0
  100. data/rbi/openai/models/responses/custom_tool.rbi +96 -0
  101. data/rbi/openai/models/responses/response.rbi +59 -11
  102. data/rbi/openai/models/responses/response_create_params.rbi +138 -13
  103. data/rbi/openai/models/responses/response_custom_tool_call.rbi +78 -0
  104. data/rbi/openai/models/responses/response_custom_tool_call_input_delta_event.rbi +75 -0
  105. data/rbi/openai/models/responses/response_custom_tool_call_input_done_event.rbi +75 -0
  106. data/rbi/openai/models/responses/response_custom_tool_call_output.rbi +65 -0
  107. data/rbi/openai/models/responses/response_input_item.rbi +2 -0
  108. data/rbi/openai/models/responses/response_output_item.rbi +2 -1
  109. data/rbi/openai/models/responses/response_output_item_added_event.rbi +2 -1
  110. data/rbi/openai/models/responses/response_output_item_done_event.rbi +2 -1
  111. data/rbi/openai/models/responses/response_reasoning_item.rbi +63 -4
  112. data/rbi/openai/models/responses/response_reasoning_text_delta_event.rbi +83 -0
  113. data/rbi/openai/models/responses/{response_reasoning_summary_done_event.rbi → response_reasoning_text_done_event.rbi} +20 -20
  114. data/rbi/openai/models/responses/response_retrieve_params.rbi +21 -0
  115. data/rbi/openai/models/responses/response_stream_event.rbi +4 -2
  116. data/rbi/openai/models/responses/response_text_config.rbi +64 -1
  117. data/rbi/openai/models/responses/tool.rbi +1 -0
  118. data/rbi/openai/models/responses/tool_choice_allowed.rbi +124 -0
  119. data/rbi/openai/models/responses/tool_choice_custom.rbi +39 -0
  120. data/rbi/openai/models/vector_store_search_params.rbi +12 -1
  121. data/rbi/openai/models.rbi +6 -0
  122. data/rbi/openai/resources/beta/assistants.rbi +6 -8
  123. data/rbi/openai/resources/beta/threads/runs.rbi +8 -10
  124. data/rbi/openai/resources/chat/completions.rbi +78 -25
  125. data/rbi/openai/resources/responses.rbi +249 -47
  126. data/sig/openai/internal/transport/base_client.rbs +1 -1
  127. data/sig/openai/models/beta/assistant_update_params.rbs +12 -0
  128. data/sig/openai/models/chat/chat_completion_allowed_tool_choice.rbs +29 -0
  129. data/sig/openai/models/chat/chat_completion_allowed_tools.rbs +38 -0
  130. data/sig/openai/models/chat/chat_completion_assistant_message_param.rbs +6 -6
  131. data/sig/openai/models/chat/chat_completion_custom_tool.rbs +137 -0
  132. data/sig/openai/models/chat/chat_completion_function_tool.rbs +26 -0
  133. data/sig/openai/models/chat/chat_completion_message.rbs +6 -6
  134. data/sig/openai/models/chat/chat_completion_message_custom_tool_call.rbs +46 -0
  135. data/sig/openai/models/chat/chat_completion_message_function_tool_call.rbs +46 -0
  136. data/sig/openai/models/chat/chat_completion_message_tool_call.rbs +6 -35
  137. data/sig/openai/models/chat/chat_completion_named_tool_choice_custom.rbs +39 -0
  138. data/sig/openai/models/chat/chat_completion_store_message.rbs +29 -3
  139. data/sig/openai/models/chat/chat_completion_stream_options.rbs +11 -3
  140. data/sig/openai/models/chat/chat_completion_tool.rbs +6 -15
  141. data/sig/openai/models/chat/chat_completion_tool_choice_option.rbs +2 -0
  142. data/sig/openai/models/chat/completion_create_params.rbs +37 -6
  143. data/sig/openai/models/chat_model.rbs +15 -1
  144. data/sig/openai/models/custom_tool_input_format.rbs +61 -0
  145. data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +6 -6
  146. data/sig/openai/models/reasoning_effort.rbs +2 -1
  147. data/sig/openai/models/response_format_text_grammar.rbs +15 -0
  148. data/sig/openai/models/response_format_text_python.rbs +13 -0
  149. data/sig/openai/models/responses/custom_tool.rbs +43 -0
  150. data/sig/openai/models/responses/response.rbs +16 -0
  151. data/sig/openai/models/responses/response_create_params.rbs +33 -0
  152. data/sig/openai/models/responses/response_custom_tool_call.rbs +44 -0
  153. data/sig/openai/models/responses/response_custom_tool_call_input_delta_event.rbs +42 -0
  154. data/sig/openai/models/responses/response_custom_tool_call_input_done_event.rbs +42 -0
  155. data/sig/openai/models/responses/response_custom_tool_call_output.rbs +39 -0
  156. data/sig/openai/models/responses/response_input_item.rbs +2 -0
  157. data/sig/openai/models/responses/response_output_item.rbs +1 -0
  158. data/sig/openai/models/responses/response_reasoning_item.rbs +21 -0
  159. data/sig/openai/models/responses/{response_reasoning_summary_delta_event.rbs → response_reasoning_text_delta_event.rbs} +15 -15
  160. data/sig/openai/models/responses/{response_reasoning_summary_done_event.rbs → response_reasoning_text_done_event.rbs} +11 -11
  161. data/sig/openai/models/responses/response_retrieve_params.rbs +7 -0
  162. data/sig/openai/models/responses/response_stream_event.rbs +4 -2
  163. data/sig/openai/models/responses/response_text_config.rbs +22 -3
  164. data/sig/openai/models/responses/tool.rbs +1 -0
  165. data/sig/openai/models/responses/tool_choice_allowed.rbs +43 -0
  166. data/sig/openai/models/responses/tool_choice_custom.rbs +17 -0
  167. data/sig/openai/models/vector_store_search_params.rbs +2 -1
  168. data/sig/openai/models.rbs +6 -0
  169. data/sig/openai/resources/chat/completions.rbs +8 -2
  170. data/sig/openai/resources/responses.rbs +36 -0
  171. metadata +59 -8
  172. data/lib/openai/models/responses/response_reasoning_summary_delta_event.rb +0 -65
  173. data/lib/openai/models/responses/response_reasoning_summary_done_event.rb +0 -60
  174. data/rbi/openai/models/responses/response_reasoning_summary_delta_event.rbi +0 -85
@@ -55,6 +55,8 @@ module OpenAI
55
55
 
56
56
  CreateEmbeddingResponse = OpenAI::Models::CreateEmbeddingResponse
57
57
 
58
+ CustomToolInputFormat = OpenAI::Models::CustomToolInputFormat
59
+
58
60
  Embedding = OpenAI::Models::Embedding
59
61
 
60
62
  EmbeddingCreateParams = OpenAI::Models::EmbeddingCreateParams
@@ -172,6 +174,10 @@ module OpenAI
172
174
 
173
175
  ResponseFormatText = OpenAI::Models::ResponseFormatText
174
176
 
177
+ ResponseFormatTextGrammar = OpenAI::Models::ResponseFormatTextGrammar
178
+
179
+ ResponseFormatTextPython = OpenAI::Models::ResponseFormatTextPython
180
+
175
181
  Responses = OpenAI::Models::Responses
176
182
 
177
183
  ResponsesModel = OpenAI::Models::ResponsesModel
@@ -60,12 +60,11 @@ module OpenAI
60
60
  metadata: nil,
61
61
  # The name of the assistant. The maximum length is 256 characters.
62
62
  name: nil,
63
- # **o-series models only**
64
- #
65
63
  # Constrains effort on reasoning for
66
64
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
67
- # supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
68
- # result in faster responses and fewer tokens used on reasoning in a response.
65
+ # supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
66
+ # effort can result in faster responses and fewer tokens used on reasoning in a
67
+ # response.
69
68
  reasoning_effort: nil,
70
69
  # Specifies the format that the model must output. Compatible with
71
70
  # [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
@@ -188,12 +187,11 @@ module OpenAI
188
187
  model: nil,
189
188
  # The name of the assistant. The maximum length is 256 characters.
190
189
  name: nil,
191
- # **o-series models only**
192
- #
193
190
  # Constrains effort on reasoning for
194
191
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
195
- # supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
196
- # result in faster responses and fewer tokens used on reasoning in a response.
192
+ # supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
193
+ # effort can result in faster responses and fewer tokens used on reasoning in a
194
+ # response.
197
195
  reasoning_effort: nil,
198
196
  # Specifies the format that the model must output. Compatible with
199
197
  # [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
@@ -123,12 +123,11 @@ module OpenAI
123
123
  # [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
124
124
  # during tool use.
125
125
  parallel_tool_calls: nil,
126
- # Body param: **o-series models only**
127
- #
128
- # Constrains effort on reasoning for
126
+ # Body param: Constrains effort on reasoning for
129
127
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
130
- # supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
131
- # result in faster responses and fewer tokens used on reasoning in a response.
128
+ # supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
129
+ # effort can result in faster responses and fewer tokens used on reasoning in a
130
+ # response.
132
131
  reasoning_effort: nil,
133
132
  # Body param: Specifies the format that the model must output. Compatible with
134
133
  # [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
@@ -303,12 +302,11 @@ module OpenAI
303
302
  # [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
304
303
  # during tool use.
305
304
  parallel_tool_calls: nil,
306
- # Body param: **o-series models only**
307
- #
308
- # Constrains effort on reasoning for
305
+ # Body param: Constrains effort on reasoning for
309
306
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
310
- # supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
311
- # result in faster responses and fewer tokens used on reasoning in a response.
307
+ # supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
308
+ # effort can result in faster responses and fewer tokens used on reasoning in a
309
+ # response.
312
310
  reasoning_effort: nil,
313
311
  # Body param: Specifies the format that the model must output. Compatible with
314
312
  # [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
@@ -65,6 +65,7 @@ module OpenAI
65
65
  prediction:
66
66
  T.nilable(OpenAI::Chat::ChatCompletionPredictionContent::OrHash),
67
67
  presence_penalty: T.nilable(Float),
68
+ prompt_cache_key: String,
68
69
  reasoning_effort: T.nilable(OpenAI::ReasoningEffort::OrSymbol),
69
70
  response_format:
70
71
  T.any(
@@ -73,6 +74,7 @@ module OpenAI
73
74
  OpenAI::StructuredOutput::JsonSchemaConverter,
74
75
  OpenAI::ResponseFormatJSONObject::OrHash
75
76
  ),
77
+ safety_identifier: String,
76
78
  seed: T.nilable(Integer),
77
79
  service_tier:
78
80
  T.nilable(
@@ -87,18 +89,25 @@ module OpenAI
87
89
  tool_choice:
88
90
  T.any(
89
91
  OpenAI::Chat::ChatCompletionToolChoiceOption::Auto::OrSymbol,
90
- OpenAI::Chat::ChatCompletionNamedToolChoice::OrHash
92
+ OpenAI::Chat::ChatCompletionAllowedToolChoice::OrHash,
93
+ OpenAI::Chat::ChatCompletionNamedToolChoice::OrHash,
94
+ OpenAI::Chat::ChatCompletionNamedToolChoiceCustom::OrHash
91
95
  ),
92
96
  tools:
93
97
  T::Array[
94
98
  T.any(
95
- OpenAI::Chat::ChatCompletionTool::OrHash,
96
- OpenAI::StructuredOutput::JsonSchemaConverter
99
+ OpenAI::StructuredOutput::JsonSchemaConverter,
100
+ OpenAI::Chat::ChatCompletionFunctionTool::OrHash,
101
+ OpenAI::Chat::ChatCompletionCustomTool::OrHash
97
102
  )
98
103
  ],
99
104
  top_logprobs: T.nilable(Integer),
100
105
  top_p: T.nilable(Float),
101
106
  user: String,
107
+ verbosity:
108
+ T.nilable(
109
+ OpenAI::Chat::CompletionCreateParams::Verbosity::OrSymbol
110
+ ),
102
111
  web_search_options:
103
112
  OpenAI::Chat::CompletionCreateParams::WebSearchOptions::OrHash,
104
113
  stream: T.noreturn,
@@ -204,12 +213,15 @@ module OpenAI
204
213
  # whether they appear in the text so far, increasing the model's likelihood to
205
214
  # talk about new topics.
206
215
  presence_penalty: nil,
207
- # **o-series models only**
208
- #
216
+ # Used by OpenAI to cache responses for similar requests to optimize your cache
217
+ # hit rates. Replaces the `user` field.
218
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
219
+ prompt_cache_key: nil,
209
220
  # Constrains effort on reasoning for
210
221
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
211
- # supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
212
- # result in faster responses and fewer tokens used on reasoning in a response.
222
+ # supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
223
+ # effort can result in faster responses and fewer tokens used on reasoning in a
224
+ # response.
213
225
  reasoning_effort: nil,
214
226
  # An object specifying the format that the model must output.
215
227
  #
@@ -222,6 +234,12 @@ module OpenAI
222
234
  # ensures the message the model generates is valid JSON. Using `json_schema` is
223
235
  # preferred for models that support it.
224
236
  response_format: nil,
237
+ # A stable identifier used to help detect users of your application that may be
238
+ # violating OpenAI's usage policies. The IDs should be a string that uniquely
239
+ # identifies each user. We recommend hashing their username or email address, in
240
+ # order to avoid sending us any identifying information.
241
+ # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
242
+ safety_identifier: nil,
225
243
  # This feature is in Beta. If specified, our system will make a best effort to
226
244
  # sample deterministically, such that repeated requests with the same `seed` and
227
245
  # parameters should return the same result. Determinism is not guaranteed, and you
@@ -274,9 +292,9 @@ module OpenAI
274
292
  # `none` is the default when no tools are present. `auto` is the default if tools
275
293
  # are present.
276
294
  tool_choice: nil,
277
- # A list of tools the model may call. Currently, only functions are supported as a
278
- # tool. Use this to provide a list of functions the model may generate JSON inputs
279
- # for. A max of 128 functions are supported.
295
+ # A list of tools the model may call. You can provide either
296
+ # [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
297
+ # or [function tools](https://platform.openai.com/docs/guides/function-calling).
280
298
  tools: nil,
281
299
  # An integer between 0 and 20 specifying the number of most likely tokens to
282
300
  # return at each token position, each with an associated log probability.
@@ -288,10 +306,16 @@ module OpenAI
288
306
  #
289
307
  # We generally recommend altering this or `temperature` but not both.
290
308
  top_p: nil,
291
- # A stable identifier for your end-users. Used to boost cache hit rates by better
292
- # bucketing similar requests and to help OpenAI detect and prevent abuse.
293
- # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
309
+ # This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
310
+ # `prompt_cache_key` instead to maintain caching optimizations. A stable
311
+ # identifier for your end-users. Used to boost cache hit rates by better bucketing
312
+ # similar requests and to help OpenAI detect and prevent abuse.
313
+ # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
294
314
  user: nil,
315
+ # Constrains the verbosity of the model's response. Lower values will result in
316
+ # more concise responses, while higher values will result in more verbose
317
+ # responses. Currently supported values are `low`, `medium`, and `high`.
318
+ verbosity: nil,
295
319
  # This tool searches the web for relevant results to use in a response. Learn more
296
320
  # about the
297
321
  # [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).
@@ -361,6 +385,7 @@ module OpenAI
361
385
  prediction:
362
386
  T.nilable(OpenAI::Chat::ChatCompletionPredictionContent::OrHash),
363
387
  presence_penalty: T.nilable(Float),
388
+ prompt_cache_key: String,
364
389
  reasoning_effort: T.nilable(OpenAI::ReasoningEffort::OrSymbol),
365
390
  response_format:
366
391
  T.any(
@@ -368,6 +393,7 @@ module OpenAI
368
393
  OpenAI::ResponseFormatJSONSchema::OrHash,
369
394
  OpenAI::ResponseFormatJSONObject::OrHash
370
395
  ),
396
+ safety_identifier: String,
371
397
  seed: T.nilable(Integer),
372
398
  service_tier:
373
399
  T.nilable(
@@ -382,12 +408,24 @@ module OpenAI
382
408
  tool_choice:
383
409
  T.any(
384
410
  OpenAI::Chat::ChatCompletionToolChoiceOption::Auto::OrSymbol,
385
- OpenAI::Chat::ChatCompletionNamedToolChoice::OrHash
411
+ OpenAI::Chat::ChatCompletionAllowedToolChoice::OrHash,
412
+ OpenAI::Chat::ChatCompletionNamedToolChoice::OrHash,
413
+ OpenAI::Chat::ChatCompletionNamedToolChoiceCustom::OrHash
386
414
  ),
387
- tools: T::Array[OpenAI::Chat::ChatCompletionTool::OrHash],
415
+ tools:
416
+ T::Array[
417
+ T.any(
418
+ OpenAI::Chat::ChatCompletionFunctionTool::OrHash,
419
+ OpenAI::Chat::ChatCompletionCustomTool::OrHash
420
+ )
421
+ ],
388
422
  top_logprobs: T.nilable(Integer),
389
423
  top_p: T.nilable(Float),
390
424
  user: String,
425
+ verbosity:
426
+ T.nilable(
427
+ OpenAI::Chat::CompletionCreateParams::Verbosity::OrSymbol
428
+ ),
391
429
  web_search_options:
392
430
  OpenAI::Chat::CompletionCreateParams::WebSearchOptions::OrHash,
393
431
  stream: T.noreturn,
@@ -493,12 +531,15 @@ module OpenAI
493
531
  # whether they appear in the text so far, increasing the model's likelihood to
494
532
  # talk about new topics.
495
533
  presence_penalty: nil,
496
- # **o-series models only**
497
- #
534
+ # Used by OpenAI to cache responses for similar requests to optimize your cache
535
+ # hit rates. Replaces the `user` field.
536
+ # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
537
+ prompt_cache_key: nil,
498
538
  # Constrains effort on reasoning for
499
539
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
500
- # supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
501
- # result in faster responses and fewer tokens used on reasoning in a response.
540
+ # supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
541
+ # effort can result in faster responses and fewer tokens used on reasoning in a
542
+ # response.
502
543
  reasoning_effort: nil,
503
544
  # An object specifying the format that the model must output.
504
545
  #
@@ -511,6 +552,12 @@ module OpenAI
511
552
  # ensures the message the model generates is valid JSON. Using `json_schema` is
512
553
  # preferred for models that support it.
513
554
  response_format: nil,
555
+ # A stable identifier used to help detect users of your application that may be
556
+ # violating OpenAI's usage policies. The IDs should be a string that uniquely
557
+ # identifies each user. We recommend hashing their username or email address, in
558
+ # order to avoid sending us any identifying information.
559
+ # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
560
+ safety_identifier: nil,
514
561
  # This feature is in Beta. If specified, our system will make a best effort to
515
562
  # sample deterministically, such that repeated requests with the same `seed` and
516
563
  # parameters should return the same result. Determinism is not guaranteed, and you
@@ -563,9 +610,9 @@ module OpenAI
563
610
  # `none` is the default when no tools are present. `auto` is the default if tools
564
611
  # are present.
565
612
  tool_choice: nil,
566
- # A list of tools the model may call. Currently, only functions are supported as a
567
- # tool. Use this to provide a list of functions the model may generate JSON inputs
568
- # for. A max of 128 functions are supported.
613
+ # A list of tools the model may call. You can provide either
614
+ # [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
615
+ # or [function tools](https://platform.openai.com/docs/guides/function-calling).
569
616
  tools: nil,
570
617
  # An integer between 0 and 20 specifying the number of most likely tokens to
571
618
  # return at each token position, each with an associated log probability.
@@ -577,10 +624,16 @@ module OpenAI
577
624
  #
578
625
  # We generally recommend altering this or `temperature` but not both.
579
626
  top_p: nil,
580
- # A stable identifier for your end-users. Used to boost cache hit rates by better
581
- # bucketing similar requests and to help OpenAI detect and prevent abuse.
582
- # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
627
+ # This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
628
+ # `prompt_cache_key` instead to maintain caching optimizations. A stable
629
+ # identifier for your end-users. Used to boost cache hit rates by better bucketing
630
+ # similar requests and to help OpenAI detect and prevent abuse.
631
+ # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
583
632
  user: nil,
633
+ # Constrains the verbosity of the model's response. Lower values will result in
634
+ # more concise responses, while higher values will result in more verbose
635
+ # responses. Currently supported values are `low`, `medium`, and `high`.
636
+ verbosity: nil,
584
637
  # This tool searches the web for relevant results to use in a response. Learn more
585
638
  # about the
586
639
  # [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).