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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/README.md +79 -1
- data/lib/openai/client.rb +11 -0
- data/lib/openai/errors.rb +25 -0
- data/lib/openai/internal/type/array_of.rb +6 -1
- data/lib/openai/internal/type/base_model.rb +76 -24
- data/lib/openai/internal/type/boolean.rb +7 -1
- data/lib/openai/internal/type/converter.rb +42 -34
- data/lib/openai/internal/type/enum.rb +10 -2
- data/lib/openai/internal/type/file_input.rb +6 -1
- data/lib/openai/internal/type/hash_of.rb +6 -1
- data/lib/openai/internal/type/union.rb +12 -7
- data/lib/openai/internal/type/unknown.rb +7 -1
- data/lib/openai/models/all_models.rb +4 -0
- data/lib/openai/models/audio/speech_create_params.rb +23 -2
- data/lib/openai/models/audio/transcription.rb +118 -1
- data/lib/openai/models/audio/transcription_text_done_event.rb +80 -1
- data/lib/openai/models/audio/transcription_verbose.rb +31 -1
- data/lib/openai/models/chat/chat_completion.rb +32 -31
- data/lib/openai/models/chat/chat_completion_chunk.rb +30 -29
- data/lib/openai/models/chat/completion_create_params.rb +34 -31
- data/lib/openai/models/fine_tuning/checkpoints/permission_retrieve_response.rb +60 -25
- data/lib/openai/models/images_response.rb +92 -1
- data/lib/openai/models/responses/response.rb +59 -35
- data/lib/openai/models/responses/response_code_interpreter_call_code_delta_event.rb +17 -8
- data/lib/openai/models/responses/response_code_interpreter_call_code_done_event.rb +14 -10
- data/lib/openai/models/responses/response_code_interpreter_call_completed_event.rb +11 -10
- data/lib/openai/models/responses/response_code_interpreter_call_in_progress_event.rb +11 -10
- data/lib/openai/models/responses/response_code_interpreter_call_interpreting_event.rb +11 -10
- data/lib/openai/models/responses/response_code_interpreter_tool_call.rb +49 -78
- data/lib/openai/models/responses/response_create_params.rb +92 -67
- data/lib/openai/models/responses/response_function_web_search.rb +115 -1
- data/lib/openai/models/responses/response_includable.rb +8 -6
- data/lib/openai/models/responses/response_output_text.rb +18 -2
- data/lib/openai/models/responses/response_stream_event.rb +2 -2
- data/lib/openai/models/responses/tool_choice_mcp.rb +40 -0
- data/lib/openai/models/responses/tool_choice_types.rb +0 -3
- data/lib/openai/models/responses_model.rb +4 -0
- data/lib/openai/models/webhooks/batch_cancelled_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/batch_completed_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/batch_expired_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/batch_failed_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/eval_run_canceled_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/eval_run_failed_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/eval_run_succeeded_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/response_cancelled_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/response_completed_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/response_failed_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/response_incomplete_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/unwrap_webhook_event.rb +59 -0
- data/lib/openai/models/webhooks/webhook_unwrap_params.rb +16 -0
- data/lib/openai/models.rb +2 -0
- data/lib/openai/resources/audio/speech.rb +3 -1
- data/lib/openai/resources/chat/completions.rb +10 -2
- data/lib/openai/resources/fine_tuning/checkpoints/permissions.rb +1 -2
- data/lib/openai/resources/responses.rb +24 -16
- data/lib/openai/resources/webhooks.rb +124 -0
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +18 -0
- data/rbi/openai/client.rbi +3 -0
- data/rbi/openai/errors.rbi +16 -0
- data/rbi/openai/internal/type/boolean.rbi +2 -0
- data/rbi/openai/internal/type/converter.rbi +15 -15
- data/rbi/openai/internal/type/union.rbi +5 -0
- data/rbi/openai/internal/type/unknown.rbi +2 -0
- data/rbi/openai/models/all_models.rbi +20 -0
- data/rbi/openai/models/audio/speech_create_params.rbi +59 -2
- data/rbi/openai/models/audio/transcription.rbi +213 -3
- data/rbi/openai/models/audio/transcription_text_done_event.rbi +146 -1
- data/rbi/openai/models/audio/transcription_verbose.rbi +47 -0
- data/rbi/openai/models/chat/chat_completion.rbi +47 -42
- data/rbi/openai/models/chat/chat_completion_chunk.rbi +47 -42
- data/rbi/openai/models/chat/completion_create_params.rbi +51 -42
- data/rbi/openai/models/fine_tuning/checkpoints/permission_retrieve_response.rbi +95 -26
- data/rbi/openai/models/images_response.rbi +146 -0
- data/rbi/openai/models/responses/response.rbi +75 -44
- data/rbi/openai/models/responses/response_code_interpreter_call_code_delta_event.rbi +17 -7
- data/rbi/openai/models/responses/response_code_interpreter_call_code_done_event.rbi +13 -5
- data/rbi/openai/models/responses/response_code_interpreter_call_completed_event.rbi +13 -21
- data/rbi/openai/models/responses/response_code_interpreter_call_in_progress_event.rbi +13 -21
- data/rbi/openai/models/responses/response_code_interpreter_call_interpreting_event.rbi +13 -21
- data/rbi/openai/models/responses/response_code_interpreter_tool_call.rbi +83 -125
- data/rbi/openai/models/responses/response_create_params.rbi +174 -115
- data/rbi/openai/models/responses/response_function_web_search.rbi +163 -0
- data/rbi/openai/models/responses/response_includable.rbi +17 -11
- data/rbi/openai/models/responses/response_output_text.rbi +26 -4
- data/rbi/openai/models/responses/tool_choice_mcp.rbi +53 -0
- data/rbi/openai/models/responses/tool_choice_types.rbi +0 -5
- data/rbi/openai/models/responses_model.rbi +20 -0
- data/rbi/openai/models/webhooks/batch_cancelled_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/batch_completed_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/batch_expired_webhook_event.rbi +150 -0
- data/rbi/openai/models/webhooks/batch_failed_webhook_event.rbi +149 -0
- data/rbi/openai/models/webhooks/eval_run_canceled_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/eval_run_failed_webhook_event.rbi +151 -0
- data/rbi/openai/models/webhooks/eval_run_succeeded_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rbi +158 -0
- data/rbi/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rbi +156 -0
- data/rbi/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rbi +158 -0
- data/rbi/openai/models/webhooks/response_cancelled_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/response_completed_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/response_failed_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/response_incomplete_webhook_event.rbi +155 -0
- data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +40 -0
- data/rbi/openai/models/webhooks/webhook_unwrap_params.rbi +32 -0
- data/rbi/openai/models.rbi +2 -0
- data/rbi/openai/resources/audio/speech.rbi +6 -1
- data/rbi/openai/resources/chat/completions.rbi +34 -30
- data/rbi/openai/resources/fine_tuning/checkpoints/permissions.rbi +1 -3
- data/rbi/openai/resources/responses.rbi +108 -84
- data/rbi/openai/resources/webhooks.rbi +68 -0
- data/sig/openai/client.rbs +2 -0
- data/sig/openai/errors.rbs +9 -0
- data/sig/openai/internal/type/converter.rbs +7 -1
- data/sig/openai/models/all_models.rbs +8 -0
- data/sig/openai/models/audio/speech_create_params.rbs +21 -1
- data/sig/openai/models/audio/transcription.rbs +95 -3
- data/sig/openai/models/audio/transcription_text_done_event.rbs +72 -2
- data/sig/openai/models/audio/transcription_verbose.rbs +21 -0
- data/sig/openai/models/chat/chat_completion.rbs +2 -1
- data/sig/openai/models/chat/chat_completion_chunk.rbs +2 -1
- data/sig/openai/models/chat/completion_create_params.rbs +2 -1
- data/sig/openai/models/fine_tuning/checkpoints/permission_retrieve_response.rbs +53 -16
- data/sig/openai/models/images_response.rbs +83 -0
- data/sig/openai/models/responses/response.rbs +13 -1
- data/sig/openai/models/responses/response_code_interpreter_call_code_delta_event.rbs +5 -0
- data/sig/openai/models/responses/response_code_interpreter_call_code_done_event.rbs +5 -0
- data/sig/openai/models/responses/response_code_interpreter_call_completed_event.rbs +4 -4
- data/sig/openai/models/responses/response_code_interpreter_call_in_progress_event.rbs +4 -4
- data/sig/openai/models/responses/response_code_interpreter_call_interpreting_event.rbs +4 -4
- data/sig/openai/models/responses/response_code_interpreter_tool_call.rbs +31 -52
- data/sig/openai/models/responses/response_create_params.rbs +31 -11
- data/sig/openai/models/responses/response_function_web_search.rbs +54 -0
- data/sig/openai/models/responses/response_includable.rbs +7 -5
- data/sig/openai/models/responses/response_output_text.rbs +15 -1
- data/sig/openai/models/responses/tool_choice_mcp.rbs +23 -0
- data/sig/openai/models/responses/tool_choice_types.rbs +0 -2
- data/sig/openai/models/responses_model.rbs +8 -0
- data/sig/openai/models/webhooks/batch_cancelled_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/batch_completed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/batch_expired_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/batch_failed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/eval_run_canceled_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/eval_run_failed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/eval_run_succeeded_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/response_cancelled_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/response_completed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/response_failed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/response_incomplete_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +27 -0
- data/sig/openai/models/webhooks/webhook_unwrap_params.rbs +17 -0
- data/sig/openai/models.rbs +2 -0
- data/sig/openai/resources/audio/speech.rbs +1 -0
- data/sig/openai/resources/fine_tuning/checkpoints/permissions.rbs +1 -1
- data/sig/openai/resources/responses.rbs +8 -4
- data/sig/openai/resources/webhooks.rbs +33 -0
- 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
|
-
# - `
|
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
|
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',
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
# - If set to '
|
139
|
-
#
|
140
|
-
# -
|
141
|
-
#
|
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
|
146
|
-
#
|
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
|
-
# - `
|
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
|
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',
|
427
|
-
#
|
428
|
-
#
|
429
|
-
#
|
430
|
-
#
|
431
|
-
# - If set to '
|
432
|
-
#
|
433
|
-
# -
|
434
|
-
#
|
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
|
439
|
-
#
|
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
|
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',
|
589
|
-
#
|
590
|
-
#
|
591
|
-
#
|
592
|
-
#
|
593
|
-
# - If set to '
|
594
|
-
#
|
595
|
-
# -
|
596
|
-
#
|
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
|
601
|
-
#
|
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
|
|