openai 0.9.0 → 0.11.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 (164) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -0
  3. data/README.md +79 -1
  4. data/lib/openai/client.rb +11 -0
  5. data/lib/openai/errors.rb +25 -0
  6. data/lib/openai/internal/type/array_of.rb +6 -1
  7. data/lib/openai/internal/type/base_model.rb +76 -24
  8. data/lib/openai/internal/type/boolean.rb +7 -1
  9. data/lib/openai/internal/type/converter.rb +42 -34
  10. data/lib/openai/internal/type/enum.rb +10 -2
  11. data/lib/openai/internal/type/file_input.rb +6 -1
  12. data/lib/openai/internal/type/hash_of.rb +6 -1
  13. data/lib/openai/internal/type/union.rb +12 -7
  14. data/lib/openai/internal/type/unknown.rb +7 -1
  15. data/lib/openai/models/all_models.rb +4 -0
  16. data/lib/openai/models/audio/speech_create_params.rb +23 -2
  17. data/lib/openai/models/audio/transcription.rb +118 -1
  18. data/lib/openai/models/audio/transcription_text_done_event.rb +80 -1
  19. data/lib/openai/models/audio/transcription_verbose.rb +31 -1
  20. data/lib/openai/models/chat/chat_completion.rb +32 -31
  21. data/lib/openai/models/chat/chat_completion_chunk.rb +30 -29
  22. data/lib/openai/models/chat/completion_create_params.rb +34 -31
  23. data/lib/openai/models/fine_tuning/checkpoints/permission_retrieve_response.rb +60 -25
  24. data/lib/openai/models/images_response.rb +92 -1
  25. data/lib/openai/models/responses/response.rb +59 -35
  26. data/lib/openai/models/responses/response_code_interpreter_call_code_delta_event.rb +17 -8
  27. data/lib/openai/models/responses/response_code_interpreter_call_code_done_event.rb +14 -10
  28. data/lib/openai/models/responses/response_code_interpreter_call_completed_event.rb +11 -10
  29. data/lib/openai/models/responses/response_code_interpreter_call_in_progress_event.rb +11 -10
  30. data/lib/openai/models/responses/response_code_interpreter_call_interpreting_event.rb +11 -10
  31. data/lib/openai/models/responses/response_code_interpreter_tool_call.rb +49 -78
  32. data/lib/openai/models/responses/response_create_params.rb +92 -67
  33. data/lib/openai/models/responses/response_function_web_search.rb +115 -1
  34. data/lib/openai/models/responses/response_includable.rb +8 -6
  35. data/lib/openai/models/responses/response_output_text.rb +18 -2
  36. data/lib/openai/models/responses/response_stream_event.rb +2 -2
  37. data/lib/openai/models/responses/tool_choice_mcp.rb +40 -0
  38. data/lib/openai/models/responses/tool_choice_types.rb +0 -3
  39. data/lib/openai/models/responses_model.rb +4 -0
  40. data/lib/openai/models/webhooks/batch_cancelled_webhook_event.rb +84 -0
  41. data/lib/openai/models/webhooks/batch_completed_webhook_event.rb +84 -0
  42. data/lib/openai/models/webhooks/batch_expired_webhook_event.rb +84 -0
  43. data/lib/openai/models/webhooks/batch_failed_webhook_event.rb +84 -0
  44. data/lib/openai/models/webhooks/eval_run_canceled_webhook_event.rb +84 -0
  45. data/lib/openai/models/webhooks/eval_run_failed_webhook_event.rb +84 -0
  46. data/lib/openai/models/webhooks/eval_run_succeeded_webhook_event.rb +84 -0
  47. data/lib/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rb +85 -0
  48. data/lib/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rb +85 -0
  49. data/lib/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rb +85 -0
  50. data/lib/openai/models/webhooks/response_cancelled_webhook_event.rb +85 -0
  51. data/lib/openai/models/webhooks/response_completed_webhook_event.rb +85 -0
  52. data/lib/openai/models/webhooks/response_failed_webhook_event.rb +84 -0
  53. data/lib/openai/models/webhooks/response_incomplete_webhook_event.rb +85 -0
  54. data/lib/openai/models/webhooks/unwrap_webhook_event.rb +59 -0
  55. data/lib/openai/models/webhooks/webhook_unwrap_params.rb +16 -0
  56. data/lib/openai/models.rb +2 -0
  57. data/lib/openai/resources/audio/speech.rb +3 -1
  58. data/lib/openai/resources/chat/completions.rb +10 -2
  59. data/lib/openai/resources/fine_tuning/checkpoints/permissions.rb +1 -2
  60. data/lib/openai/resources/responses.rb +24 -16
  61. data/lib/openai/resources/webhooks.rb +124 -0
  62. data/lib/openai/version.rb +1 -1
  63. data/lib/openai.rb +18 -0
  64. data/rbi/openai/client.rbi +3 -0
  65. data/rbi/openai/errors.rbi +16 -0
  66. data/rbi/openai/internal/type/boolean.rbi +2 -0
  67. data/rbi/openai/internal/type/converter.rbi +15 -15
  68. data/rbi/openai/internal/type/union.rbi +5 -0
  69. data/rbi/openai/internal/type/unknown.rbi +2 -0
  70. data/rbi/openai/models/all_models.rbi +20 -0
  71. data/rbi/openai/models/audio/speech_create_params.rbi +59 -2
  72. data/rbi/openai/models/audio/transcription.rbi +213 -3
  73. data/rbi/openai/models/audio/transcription_text_done_event.rbi +146 -1
  74. data/rbi/openai/models/audio/transcription_verbose.rbi +47 -0
  75. data/rbi/openai/models/chat/chat_completion.rbi +47 -42
  76. data/rbi/openai/models/chat/chat_completion_chunk.rbi +47 -42
  77. data/rbi/openai/models/chat/completion_create_params.rbi +51 -42
  78. data/rbi/openai/models/fine_tuning/checkpoints/permission_retrieve_response.rbi +95 -26
  79. data/rbi/openai/models/images_response.rbi +146 -0
  80. data/rbi/openai/models/responses/response.rbi +75 -44
  81. data/rbi/openai/models/responses/response_code_interpreter_call_code_delta_event.rbi +17 -7
  82. data/rbi/openai/models/responses/response_code_interpreter_call_code_done_event.rbi +13 -5
  83. data/rbi/openai/models/responses/response_code_interpreter_call_completed_event.rbi +13 -21
  84. data/rbi/openai/models/responses/response_code_interpreter_call_in_progress_event.rbi +13 -21
  85. data/rbi/openai/models/responses/response_code_interpreter_call_interpreting_event.rbi +13 -21
  86. data/rbi/openai/models/responses/response_code_interpreter_tool_call.rbi +83 -125
  87. data/rbi/openai/models/responses/response_create_params.rbi +174 -115
  88. data/rbi/openai/models/responses/response_function_web_search.rbi +163 -0
  89. data/rbi/openai/models/responses/response_includable.rbi +17 -11
  90. data/rbi/openai/models/responses/response_output_text.rbi +26 -4
  91. data/rbi/openai/models/responses/tool_choice_mcp.rbi +53 -0
  92. data/rbi/openai/models/responses/tool_choice_types.rbi +0 -5
  93. data/rbi/openai/models/responses_model.rbi +20 -0
  94. data/rbi/openai/models/webhooks/batch_cancelled_webhook_event.rbi +154 -0
  95. data/rbi/openai/models/webhooks/batch_completed_webhook_event.rbi +154 -0
  96. data/rbi/openai/models/webhooks/batch_expired_webhook_event.rbi +150 -0
  97. data/rbi/openai/models/webhooks/batch_failed_webhook_event.rbi +149 -0
  98. data/rbi/openai/models/webhooks/eval_run_canceled_webhook_event.rbi +154 -0
  99. data/rbi/openai/models/webhooks/eval_run_failed_webhook_event.rbi +151 -0
  100. data/rbi/openai/models/webhooks/eval_run_succeeded_webhook_event.rbi +154 -0
  101. data/rbi/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rbi +158 -0
  102. data/rbi/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rbi +156 -0
  103. data/rbi/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rbi +158 -0
  104. data/rbi/openai/models/webhooks/response_cancelled_webhook_event.rbi +154 -0
  105. data/rbi/openai/models/webhooks/response_completed_webhook_event.rbi +154 -0
  106. data/rbi/openai/models/webhooks/response_failed_webhook_event.rbi +154 -0
  107. data/rbi/openai/models/webhooks/response_incomplete_webhook_event.rbi +155 -0
  108. data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +40 -0
  109. data/rbi/openai/models/webhooks/webhook_unwrap_params.rbi +32 -0
  110. data/rbi/openai/models.rbi +2 -0
  111. data/rbi/openai/resources/audio/speech.rbi +6 -1
  112. data/rbi/openai/resources/chat/completions.rbi +34 -30
  113. data/rbi/openai/resources/fine_tuning/checkpoints/permissions.rbi +1 -3
  114. data/rbi/openai/resources/responses.rbi +108 -84
  115. data/rbi/openai/resources/webhooks.rbi +68 -0
  116. data/sig/openai/client.rbs +2 -0
  117. data/sig/openai/errors.rbs +9 -0
  118. data/sig/openai/internal/type/converter.rbs +7 -1
  119. data/sig/openai/models/all_models.rbs +8 -0
  120. data/sig/openai/models/audio/speech_create_params.rbs +21 -1
  121. data/sig/openai/models/audio/transcription.rbs +95 -3
  122. data/sig/openai/models/audio/transcription_text_done_event.rbs +72 -2
  123. data/sig/openai/models/audio/transcription_verbose.rbs +21 -0
  124. data/sig/openai/models/chat/chat_completion.rbs +2 -1
  125. data/sig/openai/models/chat/chat_completion_chunk.rbs +2 -1
  126. data/sig/openai/models/chat/completion_create_params.rbs +2 -1
  127. data/sig/openai/models/fine_tuning/checkpoints/permission_retrieve_response.rbs +53 -16
  128. data/sig/openai/models/images_response.rbs +83 -0
  129. data/sig/openai/models/responses/response.rbs +13 -1
  130. data/sig/openai/models/responses/response_code_interpreter_call_code_delta_event.rbs +5 -0
  131. data/sig/openai/models/responses/response_code_interpreter_call_code_done_event.rbs +5 -0
  132. data/sig/openai/models/responses/response_code_interpreter_call_completed_event.rbs +4 -4
  133. data/sig/openai/models/responses/response_code_interpreter_call_in_progress_event.rbs +4 -4
  134. data/sig/openai/models/responses/response_code_interpreter_call_interpreting_event.rbs +4 -4
  135. data/sig/openai/models/responses/response_code_interpreter_tool_call.rbs +31 -52
  136. data/sig/openai/models/responses/response_create_params.rbs +31 -11
  137. data/sig/openai/models/responses/response_function_web_search.rbs +54 -0
  138. data/sig/openai/models/responses/response_includable.rbs +7 -5
  139. data/sig/openai/models/responses/response_output_text.rbs +15 -1
  140. data/sig/openai/models/responses/tool_choice_mcp.rbs +23 -0
  141. data/sig/openai/models/responses/tool_choice_types.rbs +0 -2
  142. data/sig/openai/models/responses_model.rbs +8 -0
  143. data/sig/openai/models/webhooks/batch_cancelled_webhook_event.rbs +66 -0
  144. data/sig/openai/models/webhooks/batch_completed_webhook_event.rbs +66 -0
  145. data/sig/openai/models/webhooks/batch_expired_webhook_event.rbs +66 -0
  146. data/sig/openai/models/webhooks/batch_failed_webhook_event.rbs +66 -0
  147. data/sig/openai/models/webhooks/eval_run_canceled_webhook_event.rbs +66 -0
  148. data/sig/openai/models/webhooks/eval_run_failed_webhook_event.rbs +66 -0
  149. data/sig/openai/models/webhooks/eval_run_succeeded_webhook_event.rbs +66 -0
  150. data/sig/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rbs +66 -0
  151. data/sig/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rbs +66 -0
  152. data/sig/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rbs +66 -0
  153. data/sig/openai/models/webhooks/response_cancelled_webhook_event.rbs +66 -0
  154. data/sig/openai/models/webhooks/response_completed_webhook_event.rbs +66 -0
  155. data/sig/openai/models/webhooks/response_failed_webhook_event.rbs +66 -0
  156. data/sig/openai/models/webhooks/response_incomplete_webhook_event.rbs +66 -0
  157. data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +27 -0
  158. data/sig/openai/models/webhooks/webhook_unwrap_params.rbs +17 -0
  159. data/sig/openai/models.rbs +2 -0
  160. data/sig/openai/resources/audio/speech.rbs +1 -0
  161. data/sig/openai/resources/fine_tuning/checkpoints/permissions.rbs +1 -1
  162. data/sig/openai/resources/responses.rbs +8 -4
  163. data/sig/openai/resources/webhooks.rbs +33 -0
  164. metadata +56 -2
@@ -15,36 +15,6 @@ module OpenAI
15
15
  )
16
16
  end
17
17
 
18
- # Text, image, or file inputs to the model, used to generate a response.
19
- #
20
- # Learn more:
21
- #
22
- # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
23
- # - [Image inputs](https://platform.openai.com/docs/guides/images)
24
- # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
25
- # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
26
- # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
27
- sig do
28
- returns(OpenAI::Responses::ResponseCreateParams::Input::Variants)
29
- end
30
- attr_accessor :input
31
-
32
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
33
- # wide range of models with different capabilities, performance characteristics,
34
- # and price points. Refer to the
35
- # [model guide](https://platform.openai.com/docs/models) to browse and compare
36
- # available models.
37
- sig do
38
- returns(
39
- T.any(
40
- String,
41
- OpenAI::ChatModel::OrSymbol,
42
- OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
43
- )
44
- )
45
- end
46
- attr_accessor :model
47
-
48
18
  # Whether to run the model response in the background.
49
19
  # [Learn more](https://platform.openai.com/docs/guides/background).
50
20
  sig { returns(T.nilable(T::Boolean)) }
@@ -53,18 +23,19 @@ module OpenAI
53
23
  # Specify additional output data to include in the model response. Currently
54
24
  # supported values are:
55
25
  #
26
+ # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
27
+ # in code interpreter tool call items.
28
+ # - `computer_call_output.output.image_url`: Include image urls from the computer
29
+ # call output.
56
30
  # - `file_search_call.results`: Include the search results of the file search tool
57
31
  # call.
58
32
  # - `message.input_image.image_url`: Include image urls from the input message.
59
- # - `computer_call_output.output.image_url`: Include image urls from the computer
60
- # call output.
33
+ # - `message.output_text.logprobs`: Include logprobs with assistant messages.
61
34
  # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
62
35
  # tokens in reasoning item outputs. This enables reasoning items to be used in
63
36
  # multi-turn conversations when using the Responses API statelessly (like when
64
37
  # the `store` parameter is set to `false`, or when an organization is enrolled
65
38
  # in the zero data retention program).
66
- # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
67
- # in code interpreter tool call items.
68
39
  sig do
69
40
  returns(
70
41
  T.nilable(T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol])
@@ -72,6 +43,29 @@ module OpenAI
72
43
  end
73
44
  attr_accessor :include
74
45
 
46
+ # Text, image, or file inputs to the model, used to generate a response.
47
+ #
48
+ # Learn more:
49
+ #
50
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
51
+ # - [Image inputs](https://platform.openai.com/docs/guides/images)
52
+ # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
53
+ # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
54
+ # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
55
+ sig do
56
+ returns(
57
+ T.nilable(OpenAI::Responses::ResponseCreateParams::Input::Variants)
58
+ )
59
+ end
60
+ attr_reader :input
61
+
62
+ sig do
63
+ params(
64
+ input: OpenAI::Responses::ResponseCreateParams::Input::Variants
65
+ ).void
66
+ end
67
+ attr_writer :input
68
+
75
69
  # A system (or developer) message inserted into the model's context.
76
70
  #
77
71
  # When using along with `previous_response_id`, the instructions from a previous
@@ -86,6 +80,13 @@ module OpenAI
86
80
  sig { returns(T.nilable(Integer)) }
87
81
  attr_accessor :max_output_tokens
88
82
 
83
+ # The maximum number of total calls to built-in tools that can be processed in a
84
+ # response. This maximum number applies across all built-in tool calls, not per
85
+ # individual tool. Any further attempts to call a tool by the model will be
86
+ # ignored.
87
+ sig { returns(T.nilable(Integer)) }
88
+ attr_accessor :max_tool_calls
89
+
89
90
  # Set of 16 key-value pairs that can be attached to an object. This can be useful
90
91
  # for storing additional information about the object in a structured format, and
91
92
  # querying for objects via API or the dashboard.
@@ -95,6 +96,36 @@ module OpenAI
95
96
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
96
97
  attr_accessor :metadata
97
98
 
99
+ # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
100
+ # wide range of models with different capabilities, performance characteristics,
101
+ # and price points. Refer to the
102
+ # [model guide](https://platform.openai.com/docs/models) to browse and compare
103
+ # available models.
104
+ sig do
105
+ returns(
106
+ T.nilable(
107
+ T.any(
108
+ String,
109
+ OpenAI::ChatModel::OrSymbol,
110
+ OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
111
+ )
112
+ )
113
+ )
114
+ end
115
+ attr_reader :model
116
+
117
+ sig do
118
+ params(
119
+ model:
120
+ T.any(
121
+ String,
122
+ OpenAI::ChatModel::OrSymbol,
123
+ OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
124
+ )
125
+ ).void
126
+ end
127
+ attr_writer :model
128
+
98
129
  # Whether to allow the model to run tool calls in parallel.
99
130
  sig { returns(T.nilable(T::Boolean)) }
100
131
  attr_accessor :parallel_tool_calls
@@ -127,23 +158,23 @@ module OpenAI
127
158
  sig { params(reasoning: T.nilable(OpenAI::Reasoning::OrHash)).void }
128
159
  attr_writer :reasoning
129
160
 
130
- # Specifies the latency tier to use for processing the request. This parameter is
131
- # relevant for customers subscribed to the scale tier service:
161
+ # Specifies the processing type used for serving the request.
132
162
  #
133
- # - If set to 'auto', and the Project is Scale tier enabled, the system will
134
- # utilize scale tier credits until they are exhausted.
135
- # - If set to 'auto', and the Project is not Scale tier enabled, the request will
136
- # be processed using the default service tier with a lower uptime SLA and no
137
- # latency guarantee.
138
- # - If set to 'default', the request will be processed using the default service
139
- # tier with a lower uptime SLA and no latency guarantee.
140
- # - If set to 'flex', the request will be processed with the Flex Processing
141
- # service tier.
142
- # [Learn more](https://platform.openai.com/docs/guides/flex-processing).
163
+ # - If set to 'auto', then the request will be processed with the service tier
164
+ # configured in the Project settings. Unless otherwise configured, the Project
165
+ # will use 'default'.
166
+ # - If set to 'default', then the requset will be processed with the standard
167
+ # pricing and performance for the selected model.
168
+ # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
169
+ # 'priority', then the request will be processed with the corresponding service
170
+ # tier. [Contact sales](https://openai.com/contact-sales) to learn more about
171
+ # Priority processing.
143
172
  # - When not set, the default behavior is 'auto'.
144
173
  #
145
- # When this parameter is set, the response body will include the `service_tier`
146
- # utilized.
174
+ # When the `service_tier` parameter is set, the response body will include the
175
+ # `service_tier` value based on the processing mode actually used to serve the
176
+ # request. This response value may be different from the value set in the
177
+ # parameter.
147
178
  sig do
148
179
  returns(
149
180
  T.nilable(
@@ -192,7 +223,8 @@ module OpenAI
192
223
  T.any(
193
224
  OpenAI::Responses::ToolChoiceOptions::OrSymbol,
194
225
  OpenAI::Responses::ToolChoiceTypes,
195
- OpenAI::Responses::ToolChoiceFunction
226
+ OpenAI::Responses::ToolChoiceFunction,
227
+ OpenAI::Responses::ToolChoiceMcp
196
228
  )
197
229
  )
198
230
  )
@@ -205,7 +237,8 @@ module OpenAI
205
237
  T.any(
206
238
  OpenAI::Responses::ToolChoiceOptions::OrSymbol,
207
239
  OpenAI::Responses::ToolChoiceTypes::OrHash,
208
- OpenAI::Responses::ToolChoiceFunction::OrHash
240
+ OpenAI::Responses::ToolChoiceFunction::OrHash,
241
+ OpenAI::Responses::ToolChoiceMcp::OrHash
209
242
  )
210
243
  ).void
211
244
  end
@@ -264,6 +297,11 @@ module OpenAI
264
297
  end
265
298
  attr_writer :tools
266
299
 
300
+ # An integer between 0 and 20 specifying the number of most likely tokens to
301
+ # return at each token position, each with an associated log probability.
302
+ sig { returns(T.nilable(Integer)) }
303
+ attr_accessor :top_logprobs
304
+
267
305
  # An alternative to sampling with temperature, called nucleus sampling, where the
268
306
  # model considers the results of the tokens with top_p probability mass. So 0.1
269
307
  # means only the tokens comprising the top 10% probability mass are considered.
@@ -299,21 +337,22 @@ module OpenAI
299
337
 
300
338
  sig do
301
339
  params(
302
- input: OpenAI::Responses::ResponseCreateParams::Input::Variants,
303
- model:
304
- T.any(
305
- String,
306
- OpenAI::ChatModel::OrSymbol,
307
- OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
308
- ),
309
340
  background: T.nilable(T::Boolean),
310
341
  include:
311
342
  T.nilable(
312
343
  T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
313
344
  ),
345
+ input: OpenAI::Responses::ResponseCreateParams::Input::Variants,
314
346
  instructions: T.nilable(String),
315
347
  max_output_tokens: T.nilable(Integer),
348
+ max_tool_calls: T.nilable(Integer),
316
349
  metadata: T.nilable(T::Hash[Symbol, String]),
350
+ model:
351
+ T.any(
352
+ String,
353
+ OpenAI::ChatModel::OrSymbol,
354
+ OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
355
+ ),
317
356
  parallel_tool_calls: T.nilable(T::Boolean),
318
357
  previous_response_id: T.nilable(String),
319
358
  prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
@@ -329,7 +368,8 @@ module OpenAI
329
368
  T.any(
330
369
  OpenAI::Responses::ToolChoiceOptions::OrSymbol,
331
370
  OpenAI::Responses::ToolChoiceTypes::OrHash,
332
- OpenAI::Responses::ToolChoiceFunction::OrHash
371
+ OpenAI::Responses::ToolChoiceFunction::OrHash,
372
+ OpenAI::Responses::ToolChoiceMcp::OrHash
333
373
  ),
334
374
  tools:
335
375
  T::Array[
@@ -344,6 +384,7 @@ module OpenAI
344
384
  OpenAI::Responses::WebSearchTool::OrHash
345
385
  )
346
386
  ],
387
+ top_logprobs: T.nilable(Integer),
347
388
  top_p: T.nilable(Float),
348
389
  truncation:
349
390
  T.nilable(
@@ -354,41 +395,36 @@ module OpenAI
354
395
  ).returns(T.attached_class)
355
396
  end
356
397
  def self.new(
357
- # Text, image, or file inputs to the model, used to generate a response.
358
- #
359
- # Learn more:
360
- #
361
- # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
362
- # - [Image inputs](https://platform.openai.com/docs/guides/images)
363
- # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
364
- # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
365
- # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
366
- input:,
367
- # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
368
- # wide range of models with different capabilities, performance characteristics,
369
- # and price points. Refer to the
370
- # [model guide](https://platform.openai.com/docs/models) to browse and compare
371
- # available models.
372
- model:,
373
398
  # Whether to run the model response in the background.
374
399
  # [Learn more](https://platform.openai.com/docs/guides/background).
375
400
  background: nil,
376
401
  # Specify additional output data to include in the model response. Currently
377
402
  # supported values are:
378
403
  #
404
+ # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
405
+ # in code interpreter tool call items.
406
+ # - `computer_call_output.output.image_url`: Include image urls from the computer
407
+ # call output.
379
408
  # - `file_search_call.results`: Include the search results of the file search tool
380
409
  # call.
381
410
  # - `message.input_image.image_url`: Include image urls from the input message.
382
- # - `computer_call_output.output.image_url`: Include image urls from the computer
383
- # call output.
411
+ # - `message.output_text.logprobs`: Include logprobs with assistant messages.
384
412
  # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
385
413
  # tokens in reasoning item outputs. This enables reasoning items to be used in
386
414
  # multi-turn conversations when using the Responses API statelessly (like when
387
415
  # the `store` parameter is set to `false`, or when an organization is enrolled
388
416
  # in the zero data retention program).
389
- # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
390
- # in code interpreter tool call items.
391
417
  include: nil,
418
+ # Text, image, or file inputs to the model, used to generate a response.
419
+ #
420
+ # Learn more:
421
+ #
422
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
423
+ # - [Image inputs](https://platform.openai.com/docs/guides/images)
424
+ # - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
425
+ # - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
426
+ # - [Function calling](https://platform.openai.com/docs/guides/function-calling)
427
+ input: nil,
392
428
  # A system (or developer) message inserted into the model's context.
393
429
  #
394
430
  # When using along with `previous_response_id`, the instructions from a previous
@@ -399,6 +435,11 @@ module OpenAI
399
435
  # including visible output tokens and
400
436
  # [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
401
437
  max_output_tokens: nil,
438
+ # The maximum number of total calls to built-in tools that can be processed in a
439
+ # response. This maximum number applies across all built-in tool calls, not per
440
+ # individual tool. Any further attempts to call a tool by the model will be
441
+ # ignored.
442
+ max_tool_calls: nil,
402
443
  # Set of 16 key-value pairs that can be attached to an object. This can be useful
403
444
  # for storing additional information about the object in a structured format, and
404
445
  # querying for objects via API or the dashboard.
@@ -406,6 +447,12 @@ module OpenAI
406
447
  # Keys are strings with a maximum length of 64 characters. Values are strings with
407
448
  # a maximum length of 512 characters.
408
449
  metadata: nil,
450
+ # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
451
+ # wide range of models with different capabilities, performance characteristics,
452
+ # and price points. Refer to the
453
+ # [model guide](https://platform.openai.com/docs/models) to browse and compare
454
+ # available models.
455
+ model: nil,
409
456
  # Whether to allow the model to run tool calls in parallel.
410
457
  parallel_tool_calls: nil,
411
458
  # The unique ID of the previous response to the model. Use this to create
@@ -420,23 +467,23 @@ module OpenAI
420
467
  # Configuration options for
421
468
  # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
422
469
  reasoning: nil,
423
- # Specifies the latency tier to use for processing the request. This parameter is
424
- # relevant for customers subscribed to the scale tier service:
470
+ # Specifies the processing type used for serving the request.
425
471
  #
426
- # - If set to 'auto', and the Project is Scale tier enabled, the system will
427
- # utilize scale tier credits until they are exhausted.
428
- # - If set to 'auto', and the Project is not Scale tier enabled, the request will
429
- # be processed using the default service tier with a lower uptime SLA and no
430
- # latency guarantee.
431
- # - If set to 'default', the request will be processed using the default service
432
- # tier with a lower uptime SLA and no latency guarantee.
433
- # - If set to 'flex', the request will be processed with the Flex Processing
434
- # service tier.
435
- # [Learn more](https://platform.openai.com/docs/guides/flex-processing).
472
+ # - If set to 'auto', then the request will be processed with the service tier
473
+ # configured in the Project settings. Unless otherwise configured, the Project
474
+ # will use 'default'.
475
+ # - If set to 'default', then the requset will be processed with the standard
476
+ # pricing and performance for the selected model.
477
+ # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
478
+ # 'priority', then the request will be processed with the corresponding service
479
+ # tier. [Contact sales](https://openai.com/contact-sales) to learn more about
480
+ # Priority processing.
436
481
  # - When not set, the default behavior is 'auto'.
437
482
  #
438
- # When this parameter is set, the response body will include the `service_tier`
439
- # utilized.
483
+ # When the `service_tier` parameter is set, the response body will include the
484
+ # `service_tier` value based on the processing mode actually used to serve the
485
+ # request. This response value may be different from the value set in the
486
+ # parameter.
440
487
  service_tier: nil,
441
488
  # Whether to store the generated model response for later retrieval via API.
442
489
  store: nil,
@@ -470,6 +517,9 @@ module OpenAI
470
517
  # the model to call your own code. Learn more about
471
518
  # [function calling](https://platform.openai.com/docs/guides/function-calling).
472
519
  tools: nil,
520
+ # An integer between 0 and 20 specifying the number of most likely tokens to
521
+ # return at each token position, each with an associated log probability.
522
+ top_logprobs: nil,
473
523
  # An alternative to sampling with temperature, called nucleus sampling, where the
474
524
  # model considers the results of the tokens with top_p probability mass. So 0.1
475
525
  # means only the tokens comprising the top 10% probability mass are considered.
@@ -495,21 +545,22 @@ module OpenAI
495
545
  sig do
496
546
  override.returns(
497
547
  {
498
- input: OpenAI::Responses::ResponseCreateParams::Input::Variants,
499
- model:
500
- T.any(
501
- String,
502
- OpenAI::ChatModel::OrSymbol,
503
- OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
504
- ),
505
548
  background: T.nilable(T::Boolean),
506
549
  include:
507
550
  T.nilable(
508
551
  T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
509
552
  ),
553
+ input: OpenAI::Responses::ResponseCreateParams::Input::Variants,
510
554
  instructions: T.nilable(String),
511
555
  max_output_tokens: T.nilable(Integer),
556
+ max_tool_calls: T.nilable(Integer),
512
557
  metadata: T.nilable(T::Hash[Symbol, String]),
558
+ model:
559
+ T.any(
560
+ String,
561
+ OpenAI::ChatModel::OrSymbol,
562
+ OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
563
+ ),
513
564
  parallel_tool_calls: T.nilable(T::Boolean),
514
565
  previous_response_id: T.nilable(String),
515
566
  prompt: T.nilable(OpenAI::Responses::ResponsePrompt),
@@ -525,7 +576,8 @@ module OpenAI
525
576
  T.any(
526
577
  OpenAI::Responses::ToolChoiceOptions::OrSymbol,
527
578
  OpenAI::Responses::ToolChoiceTypes,
528
- OpenAI::Responses::ToolChoiceFunction
579
+ OpenAI::Responses::ToolChoiceFunction,
580
+ OpenAI::Responses::ToolChoiceMcp
529
581
  ),
530
582
  tools:
531
583
  T::Array[
@@ -540,6 +592,7 @@ module OpenAI
540
592
  OpenAI::Responses::WebSearchTool
541
593
  )
542
594
  ],
595
+ top_logprobs: T.nilable(Integer),
543
596
  top_p: T.nilable(Float),
544
597
  truncation:
545
598
  T.nilable(
@@ -582,23 +635,23 @@ module OpenAI
582
635
  end
583
636
  end
584
637
 
585
- # Specifies the latency tier to use for processing the request. This parameter is
586
- # relevant for customers subscribed to the scale tier service:
638
+ # Specifies the processing type used for serving the request.
587
639
  #
588
- # - If set to 'auto', and the Project is Scale tier enabled, the system will
589
- # utilize scale tier credits until they are exhausted.
590
- # - If set to 'auto', and the Project is not Scale tier enabled, the request will
591
- # be processed using the default service tier with a lower uptime SLA and no
592
- # latency guarantee.
593
- # - If set to 'default', the request will be processed using the default service
594
- # tier with a lower uptime SLA and no latency guarantee.
595
- # - If set to 'flex', the request will be processed with the Flex Processing
596
- # service tier.
597
- # [Learn more](https://platform.openai.com/docs/guides/flex-processing).
640
+ # - If set to 'auto', then the request will be processed with the service tier
641
+ # configured in the Project settings. Unless otherwise configured, the Project
642
+ # will use 'default'.
643
+ # - If set to 'default', then the requset will be processed with the standard
644
+ # pricing and performance for the selected model.
645
+ # - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
646
+ # 'priority', then the request will be processed with the corresponding service
647
+ # tier. [Contact sales](https://openai.com/contact-sales) to learn more about
648
+ # Priority processing.
598
649
  # - When not set, the default behavior is 'auto'.
599
650
  #
600
- # When this parameter is set, the response body will include the `service_tier`
601
- # utilized.
651
+ # When the `service_tier` parameter is set, the response body will include the
652
+ # `service_tier` value based on the processing mode actually used to serve the
653
+ # request. This response value may be different from the value set in the
654
+ # parameter.
602
655
  module ServiceTier
603
656
  extend OpenAI::Internal::Type::Enum
604
657
 
@@ -631,6 +684,11 @@ module OpenAI
631
684
  :scale,
632
685
  OpenAI::Responses::ResponseCreateParams::ServiceTier::TaggedSymbol
633
686
  )
687
+ PRIORITY =
688
+ T.let(
689
+ :priority,
690
+ OpenAI::Responses::ResponseCreateParams::ServiceTier::TaggedSymbol
691
+ )
634
692
 
635
693
  sig do
636
694
  override.returns(
@@ -654,7 +712,8 @@ module OpenAI
654
712
  T.any(
655
713
  OpenAI::Responses::ToolChoiceOptions::TaggedSymbol,
656
714
  OpenAI::Responses::ToolChoiceTypes,
657
- OpenAI::Responses::ToolChoiceFunction
715
+ OpenAI::Responses::ToolChoiceFunction,
716
+ OpenAI::Responses::ToolChoiceMcp
658
717
  )
659
718
  end
660
719