openai 0.39.0 → 0.41.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 +24 -0
- data/README.md +1 -1
- data/lib/openai/internal/transport/pooled_net_requester.rb +12 -10
- data/lib/openai/models/eval_create_params.rb +12 -13
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +12 -13
- data/lib/openai/models/evals/run_cancel_response.rb +12 -13
- data/lib/openai/models/evals/run_create_params.rb +12 -13
- data/lib/openai/models/evals/run_create_response.rb +12 -13
- data/lib/openai/models/evals/run_list_response.rb +12 -13
- data/lib/openai/models/evals/run_retrieve_response.rb +12 -13
- data/lib/openai/models/graders/grader_input_item.rb +87 -0
- data/lib/openai/models/graders/grader_inputs.rb +13 -0
- data/lib/openai/models/graders/label_model_grader.rb +12 -13
- data/lib/openai/models/graders/score_model_grader.rb +12 -13
- data/lib/openai/models/image.rb +6 -6
- data/lib/openai/models/image_edit_completed_event.rb +5 -3
- data/lib/openai/models/image_edit_params.rb +34 -32
- data/lib/openai/models/image_gen_completed_event.rb +5 -3
- data/lib/openai/models/image_generate_params.rb +38 -36
- data/lib/openai/models/image_model.rb +1 -0
- data/lib/openai/models/images_response.rb +31 -1
- data/lib/openai/models/responses/tool.rb +22 -8
- data/lib/openai/models/video_model.rb +3 -0
- data/lib/openai/resources/images.rb +6 -6
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +2 -0
- data/rbi/openai/models/eval_create_params.rbi +35 -16
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +35 -16
- data/rbi/openai/models/evals/run_cancel_response.rbi +17 -14
- data/rbi/openai/models/evals/run_create_params.rbi +35 -16
- data/rbi/openai/models/evals/run_create_response.rbi +17 -14
- data/rbi/openai/models/evals/run_list_response.rbi +17 -14
- data/rbi/openai/models/evals/run_retrieve_response.rbi +17 -14
- data/rbi/openai/models/graders/grader_input_item.rbi +112 -0
- data/rbi/openai/models/graders/grader_inputs.rbi +18 -0
- data/rbi/openai/models/graders/label_model_grader.rbi +35 -16
- data/rbi/openai/models/graders/score_model_grader.rbi +35 -16
- data/rbi/openai/models/image.rbi +10 -10
- data/rbi/openai/models/image_edit_completed_event.rbi +6 -3
- data/rbi/openai/models/image_edit_params.rbi +49 -46
- data/rbi/openai/models/image_gen_completed_event.rbi +6 -3
- data/rbi/openai/models/image_generate_params.rbi +54 -51
- data/rbi/openai/models/image_model.rbi +1 -0
- data/rbi/openai/models/images_response.rbi +61 -3
- data/rbi/openai/models/responses/tool.rbi +38 -16
- data/rbi/openai/models/video_model.rbi +6 -0
- data/rbi/openai/resources/images.rbi +72 -68
- data/sig/openai/models/eval_create_params.rbs +1 -3
- data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +1 -3
- data/sig/openai/models/evals/run_cancel_response.rbs +1 -3
- data/sig/openai/models/evals/run_create_params.rbs +1 -3
- data/sig/openai/models/evals/run_create_response.rbs +1 -3
- data/sig/openai/models/evals/run_list_response.rbs +1 -3
- data/sig/openai/models/evals/run_retrieve_response.rbs +1 -3
- data/sig/openai/models/graders/grader_input_item.rbs +55 -0
- data/sig/openai/models/graders/grader_inputs.rbs +11 -0
- data/sig/openai/models/graders/label_model_grader.rbs +1 -3
- data/sig/openai/models/graders/score_model_grader.rbs +1 -3
- data/sig/openai/models/image_model.rbs +6 -1
- data/sig/openai/models/images_response.rbs +25 -3
- data/sig/openai/models/responses/tool.rbs +4 -4
- data/sig/openai/models/video_model.rbs +9 -1
- metadata +8 -2
|
@@ -11,17 +11,17 @@ module OpenAI
|
|
|
11
11
|
|
|
12
12
|
# @!attribute prompt
|
|
13
13
|
# A text description of the desired image(s). The maximum length is 32000
|
|
14
|
-
# characters for
|
|
15
|
-
# for `dall-e-3`.
|
|
14
|
+
# characters for the GPT image models, 1000 characters for `dall-e-2` and 4000
|
|
15
|
+
# characters for `dall-e-3`.
|
|
16
16
|
#
|
|
17
17
|
# @return [String]
|
|
18
18
|
required :prompt, String
|
|
19
19
|
|
|
20
20
|
# @!attribute background
|
|
21
21
|
# Allows to set transparency for the background of the generated image(s). This
|
|
22
|
-
# parameter is only supported for
|
|
23
|
-
# `opaque` or `auto` (default value). When `auto` is used, the
|
|
24
|
-
# automatically determine the best background for the image.
|
|
22
|
+
# parameter is only supported for the GPT image models. Must be one of
|
|
23
|
+
# `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
|
|
24
|
+
# model will automatically determine the best background for the image.
|
|
25
25
|
#
|
|
26
26
|
# If `transparent`, the output format needs to support transparency, so it should
|
|
27
27
|
# be set to either `png` (default value) or `webp`.
|
|
@@ -30,16 +30,17 @@ module OpenAI
|
|
|
30
30
|
optional :background, enum: -> { OpenAI::ImageGenerateParams::Background }, nil?: true
|
|
31
31
|
|
|
32
32
|
# @!attribute model
|
|
33
|
-
# The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or
|
|
34
|
-
# `gpt-image-1
|
|
35
|
-
# `
|
|
33
|
+
# The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
|
|
34
|
+
# image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to
|
|
35
|
+
# `dall-e-2` unless a parameter specific to the GPT image models is used.
|
|
36
36
|
#
|
|
37
37
|
# @return [String, Symbol, OpenAI::Models::ImageModel, nil]
|
|
38
38
|
optional :model, union: -> { OpenAI::ImageGenerateParams::Model }, nil?: true
|
|
39
39
|
|
|
40
40
|
# @!attribute moderation
|
|
41
|
-
# Control the content-moderation level for images generated by
|
|
42
|
-
# be either `low` for less restrictive filtering or `auto` (default
|
|
41
|
+
# Control the content-moderation level for images generated by the GPT image
|
|
42
|
+
# models. Must be either `low` for less restrictive filtering or `auto` (default
|
|
43
|
+
# value).
|
|
43
44
|
#
|
|
44
45
|
# @return [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil]
|
|
45
46
|
optional :moderation, enum: -> { OpenAI::ImageGenerateParams::Moderation }, nil?: true
|
|
@@ -53,7 +54,7 @@ module OpenAI
|
|
|
53
54
|
|
|
54
55
|
# @!attribute output_compression
|
|
55
56
|
# The compression level (0-100%) for the generated images. This parameter is only
|
|
56
|
-
# supported for
|
|
57
|
+
# supported for the GPT image models with the `webp` or `jpeg` output formats, and
|
|
57
58
|
# defaults to 100.
|
|
58
59
|
#
|
|
59
60
|
# @return [Integer, nil]
|
|
@@ -61,7 +62,7 @@ module OpenAI
|
|
|
61
62
|
|
|
62
63
|
# @!attribute output_format
|
|
63
64
|
# The format in which the generated images are returned. This parameter is only
|
|
64
|
-
# supported for
|
|
65
|
+
# supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
|
|
65
66
|
#
|
|
66
67
|
# @return [Symbol, OpenAI::Models::ImageGenerateParams::OutputFormat, nil]
|
|
67
68
|
optional :output_format, enum: -> { OpenAI::ImageGenerateParams::OutputFormat }, nil?: true
|
|
@@ -82,7 +83,7 @@ module OpenAI
|
|
|
82
83
|
#
|
|
83
84
|
# - `auto` (default value) will automatically select the best quality for the
|
|
84
85
|
# given model.
|
|
85
|
-
# - `high`, `medium` and `low` are supported for
|
|
86
|
+
# - `high`, `medium` and `low` are supported for the GPT image models.
|
|
86
87
|
# - `hd` and `standard` are supported for `dall-e-3`.
|
|
87
88
|
# - `standard` is the only option for `dall-e-2`.
|
|
88
89
|
#
|
|
@@ -92,17 +93,17 @@ module OpenAI
|
|
|
92
93
|
# @!attribute response_format
|
|
93
94
|
# The format in which generated images with `dall-e-2` and `dall-e-3` are
|
|
94
95
|
# returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
|
|
95
|
-
# after the image has been generated. This parameter isn't supported for
|
|
96
|
-
#
|
|
96
|
+
# after the image has been generated. This parameter isn't supported for the GPT
|
|
97
|
+
# image models, which always return base64-encoded images.
|
|
97
98
|
#
|
|
98
99
|
# @return [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil]
|
|
99
100
|
optional :response_format, enum: -> { OpenAI::ImageGenerateParams::ResponseFormat }, nil?: true
|
|
100
101
|
|
|
101
102
|
# @!attribute size
|
|
102
103
|
# The size of the generated images. Must be one of `1024x1024`, `1536x1024`
|
|
103
|
-
# (landscape), `1024x1536` (portrait), or `auto` (default value) for
|
|
104
|
-
#
|
|
105
|
-
#
|
|
104
|
+
# (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
|
|
105
|
+
# models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of
|
|
106
|
+
# `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.
|
|
106
107
|
#
|
|
107
108
|
# @return [Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
|
|
108
109
|
optional :size, enum: -> { OpenAI::ImageGenerateParams::Size }, nil?: true
|
|
@@ -132,9 +133,9 @@ module OpenAI
|
|
|
132
133
|
#
|
|
133
134
|
# @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil] Allows to set transparency for the background of the generated image(s).
|
|
134
135
|
#
|
|
135
|
-
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or
|
|
136
|
+
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT i
|
|
136
137
|
#
|
|
137
|
-
# @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil] Control the content-moderation level for images generated by
|
|
138
|
+
# @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil] Control the content-moderation level for images generated by the GPT image model
|
|
138
139
|
#
|
|
139
140
|
# @param n [Integer, nil] The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
|
|
140
141
|
#
|
|
@@ -157,9 +158,9 @@ module OpenAI
|
|
|
157
158
|
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
|
|
158
159
|
|
|
159
160
|
# Allows to set transparency for the background of the generated image(s). This
|
|
160
|
-
# parameter is only supported for
|
|
161
|
-
# `opaque` or `auto` (default value). When `auto` is used, the
|
|
162
|
-
# automatically determine the best background for the image.
|
|
161
|
+
# parameter is only supported for the GPT image models. Must be one of
|
|
162
|
+
# `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
|
|
163
|
+
# model will automatically determine the best background for the image.
|
|
163
164
|
#
|
|
164
165
|
# If `transparent`, the output format needs to support transparency, so it should
|
|
165
166
|
# be set to either `png` (default value) or `webp`.
|
|
@@ -174,23 +175,24 @@ module OpenAI
|
|
|
174
175
|
# @return [Array<Symbol>]
|
|
175
176
|
end
|
|
176
177
|
|
|
177
|
-
# The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or
|
|
178
|
-
# `gpt-image-1
|
|
179
|
-
# `
|
|
178
|
+
# The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
|
|
179
|
+
# image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to
|
|
180
|
+
# `dall-e-2` unless a parameter specific to the GPT image models is used.
|
|
180
181
|
module Model
|
|
181
182
|
extend OpenAI::Internal::Type::Union
|
|
182
183
|
|
|
183
184
|
variant String
|
|
184
185
|
|
|
185
|
-
# The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or `gpt-image-1
|
|
186
|
+
# The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used.
|
|
186
187
|
variant enum: -> { OpenAI::ImageModel }
|
|
187
188
|
|
|
188
189
|
# @!method self.variants
|
|
189
190
|
# @return [Array(String, Symbol, OpenAI::Models::ImageModel)]
|
|
190
191
|
end
|
|
191
192
|
|
|
192
|
-
# Control the content-moderation level for images generated by
|
|
193
|
-
# be either `low` for less restrictive filtering or `auto` (default
|
|
193
|
+
# Control the content-moderation level for images generated by the GPT image
|
|
194
|
+
# models. Must be either `low` for less restrictive filtering or `auto` (default
|
|
195
|
+
# value).
|
|
194
196
|
module Moderation
|
|
195
197
|
extend OpenAI::Internal::Type::Enum
|
|
196
198
|
|
|
@@ -202,7 +204,7 @@ module OpenAI
|
|
|
202
204
|
end
|
|
203
205
|
|
|
204
206
|
# The format in which the generated images are returned. This parameter is only
|
|
205
|
-
# supported for
|
|
207
|
+
# supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
|
|
206
208
|
module OutputFormat
|
|
207
209
|
extend OpenAI::Internal::Type::Enum
|
|
208
210
|
|
|
@@ -218,7 +220,7 @@ module OpenAI
|
|
|
218
220
|
#
|
|
219
221
|
# - `auto` (default value) will automatically select the best quality for the
|
|
220
222
|
# given model.
|
|
221
|
-
# - `high`, `medium` and `low` are supported for
|
|
223
|
+
# - `high`, `medium` and `low` are supported for the GPT image models.
|
|
222
224
|
# - `hd` and `standard` are supported for `dall-e-3`.
|
|
223
225
|
# - `standard` is the only option for `dall-e-2`.
|
|
224
226
|
module Quality
|
|
@@ -237,8 +239,8 @@ module OpenAI
|
|
|
237
239
|
|
|
238
240
|
# The format in which generated images with `dall-e-2` and `dall-e-3` are
|
|
239
241
|
# returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
|
|
240
|
-
# after the image has been generated. This parameter isn't supported for
|
|
241
|
-
#
|
|
242
|
+
# after the image has been generated. This parameter isn't supported for the GPT
|
|
243
|
+
# image models, which always return base64-encoded images.
|
|
242
244
|
module ResponseFormat
|
|
243
245
|
extend OpenAI::Internal::Type::Enum
|
|
244
246
|
|
|
@@ -250,9 +252,9 @@ module OpenAI
|
|
|
250
252
|
end
|
|
251
253
|
|
|
252
254
|
# The size of the generated images. Must be one of `1024x1024`, `1536x1024`
|
|
253
|
-
# (landscape), `1024x1536` (portrait), or `auto` (default value) for
|
|
254
|
-
#
|
|
255
|
-
#
|
|
255
|
+
# (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
|
|
256
|
+
# models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of
|
|
257
|
+
# `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.
|
|
256
258
|
module Size
|
|
257
259
|
extend OpenAI::Internal::Type::Enum
|
|
258
260
|
|
|
@@ -151,7 +151,13 @@ module OpenAI
|
|
|
151
151
|
# @return [Integer]
|
|
152
152
|
required :total_tokens, Integer
|
|
153
153
|
|
|
154
|
-
# @!
|
|
154
|
+
# @!attribute output_tokens_details
|
|
155
|
+
# The output token details for the image generation.
|
|
156
|
+
#
|
|
157
|
+
# @return [OpenAI::Models::ImagesResponse::Usage::OutputTokensDetails, nil]
|
|
158
|
+
optional :output_tokens_details, -> { OpenAI::ImagesResponse::Usage::OutputTokensDetails }
|
|
159
|
+
|
|
160
|
+
# @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, total_tokens:, output_tokens_details: nil)
|
|
155
161
|
# For `gpt-image-1` only, the token usage information for the image generation.
|
|
156
162
|
#
|
|
157
163
|
# @param input_tokens [Integer] The number of tokens (images and text) in the input prompt.
|
|
@@ -161,6 +167,8 @@ module OpenAI
|
|
|
161
167
|
# @param output_tokens [Integer] The number of output tokens generated by the model.
|
|
162
168
|
#
|
|
163
169
|
# @param total_tokens [Integer] The total number of tokens (images and text) used for the image generation.
|
|
170
|
+
#
|
|
171
|
+
# @param output_tokens_details [OpenAI::Models::ImagesResponse::Usage::OutputTokensDetails] The output token details for the image generation.
|
|
164
172
|
|
|
165
173
|
# @see OpenAI::Models::ImagesResponse::Usage#input_tokens_details
|
|
166
174
|
class InputTokensDetails < OpenAI::Internal::Type::BaseModel
|
|
@@ -183,6 +191,28 @@ module OpenAI
|
|
|
183
191
|
#
|
|
184
192
|
# @param text_tokens [Integer] The number of text tokens in the input prompt.
|
|
185
193
|
end
|
|
194
|
+
|
|
195
|
+
# @see OpenAI::Models::ImagesResponse::Usage#output_tokens_details
|
|
196
|
+
class OutputTokensDetails < OpenAI::Internal::Type::BaseModel
|
|
197
|
+
# @!attribute image_tokens
|
|
198
|
+
# The number of image output tokens generated by the model.
|
|
199
|
+
#
|
|
200
|
+
# @return [Integer]
|
|
201
|
+
required :image_tokens, Integer
|
|
202
|
+
|
|
203
|
+
# @!attribute text_tokens
|
|
204
|
+
# The number of text output tokens generated by the model.
|
|
205
|
+
#
|
|
206
|
+
# @return [Integer]
|
|
207
|
+
required :text_tokens, Integer
|
|
208
|
+
|
|
209
|
+
# @!method initialize(image_tokens:, text_tokens:)
|
|
210
|
+
# The output token details for the image generation.
|
|
211
|
+
#
|
|
212
|
+
# @param image_tokens [Integer] The number of image output tokens generated by the model.
|
|
213
|
+
#
|
|
214
|
+
# @param text_tokens [Integer] The number of text output tokens generated by the model.
|
|
215
|
+
end
|
|
186
216
|
end
|
|
187
217
|
end
|
|
188
218
|
end
|
|
@@ -27,7 +27,7 @@ module OpenAI
|
|
|
27
27
|
# A tool that runs Python code to help generate a response to a prompt.
|
|
28
28
|
variant :code_interpreter, -> { OpenAI::Responses::Tool::CodeInterpreter }
|
|
29
29
|
|
|
30
|
-
# A tool that generates images using
|
|
30
|
+
# A tool that generates images using the GPT image models.
|
|
31
31
|
variant :image_generation, -> { OpenAI::Responses::Tool::ImageGeneration }
|
|
32
32
|
|
|
33
33
|
# A tool that allows the model to execute shell commands in a local environment.
|
|
@@ -473,8 +473,8 @@ module OpenAI
|
|
|
473
473
|
# @!attribute model
|
|
474
474
|
# The image generation model to use. Default: `gpt-image-1`.
|
|
475
475
|
#
|
|
476
|
-
# @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Model, nil]
|
|
477
|
-
optional :model,
|
|
476
|
+
# @return [String, Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Model, nil]
|
|
477
|
+
optional :model, union: -> { OpenAI::Responses::Tool::ImageGeneration::Model }
|
|
478
478
|
|
|
479
479
|
# @!attribute moderation
|
|
480
480
|
# Moderation level for the generated image. Default: `auto`.
|
|
@@ -520,7 +520,7 @@ module OpenAI
|
|
|
520
520
|
# Some parameter documentations has been truncated, see
|
|
521
521
|
# {OpenAI::Models::Responses::Tool::ImageGeneration} for more details.
|
|
522
522
|
#
|
|
523
|
-
# A tool that generates images using
|
|
523
|
+
# A tool that generates images using the GPT image models.
|
|
524
524
|
#
|
|
525
525
|
# @param background [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Background] Background type for the generated image. One of `transparent`,
|
|
526
526
|
#
|
|
@@ -528,7 +528,7 @@ module OpenAI
|
|
|
528
528
|
#
|
|
529
529
|
# @param input_image_mask [OpenAI::Models::Responses::Tool::ImageGeneration::InputImageMask] Optional mask for inpainting. Contains `image_url`
|
|
530
530
|
#
|
|
531
|
-
# @param model [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Model] The image generation model to use. Default: `gpt-image-1`.
|
|
531
|
+
# @param model [String, Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Model] The image generation model to use. Default: `gpt-image-1`.
|
|
532
532
|
#
|
|
533
533
|
# @param moderation [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Moderation] Moderation level for the generated image. Default: `auto`.
|
|
534
534
|
#
|
|
@@ -606,13 +606,27 @@ module OpenAI
|
|
|
606
606
|
#
|
|
607
607
|
# @see OpenAI::Models::Responses::Tool::ImageGeneration#model
|
|
608
608
|
module Model
|
|
609
|
-
extend OpenAI::Internal::Type::
|
|
609
|
+
extend OpenAI::Internal::Type::Union
|
|
610
|
+
|
|
611
|
+
variant String
|
|
612
|
+
|
|
613
|
+
variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Model::GPT_IMAGE_1 }
|
|
614
|
+
|
|
615
|
+
variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Model::GPT_IMAGE_1_MINI }
|
|
616
|
+
|
|
617
|
+
# @!method self.variants
|
|
618
|
+
# @return [Array(String, Symbol)]
|
|
619
|
+
|
|
620
|
+
define_sorbet_constant!(:Variants) do
|
|
621
|
+
T.type_alias { T.any(String, OpenAI::Responses::Tool::ImageGeneration::Model::TaggedSymbol) }
|
|
622
|
+
end
|
|
623
|
+
|
|
624
|
+
# @!group
|
|
610
625
|
|
|
611
626
|
GPT_IMAGE_1 = :"gpt-image-1"
|
|
612
627
|
GPT_IMAGE_1_MINI = :"gpt-image-1-mini"
|
|
613
628
|
|
|
614
|
-
# @!
|
|
615
|
-
# @return [Array<Symbol>]
|
|
629
|
+
# @!endgroup
|
|
616
630
|
end
|
|
617
631
|
|
|
618
632
|
# Moderation level for the generated image. Default: `auto`.
|
|
@@ -7,6 +7,9 @@ module OpenAI
|
|
|
7
7
|
|
|
8
8
|
SORA_2 = :"sora-2"
|
|
9
9
|
SORA_2_PRO = :"sora-2-pro"
|
|
10
|
+
SORA_2_2025_10_06 = :"sora-2-2025-10-06"
|
|
11
|
+
SORA_2_PRO_2025_10_06 = :"sora-2-pro-2025-10-06"
|
|
12
|
+
SORA_2_2025_12_08 = :"sora-2-2025-12-08"
|
|
10
13
|
|
|
11
14
|
# @!method self.values
|
|
12
15
|
# @return [Array<Symbol>]
|
|
@@ -59,7 +59,7 @@ module OpenAI
|
|
|
59
59
|
#
|
|
60
60
|
# @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind
|
|
61
61
|
#
|
|
62
|
-
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Only `dall-e-2` and
|
|
62
|
+
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Only `dall-e-2` and the GPT image models
|
|
63
63
|
#
|
|
64
64
|
# @param n [Integer, nil] The number of images to generate. Must be between 1 and 10.
|
|
65
65
|
#
|
|
@@ -118,7 +118,7 @@ module OpenAI
|
|
|
118
118
|
#
|
|
119
119
|
# @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind
|
|
120
120
|
#
|
|
121
|
-
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Only `dall-e-2` and
|
|
121
|
+
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Only `dall-e-2` and the GPT image models
|
|
122
122
|
#
|
|
123
123
|
# @param n [Integer, nil] The number of images to generate. Must be between 1 and 10.
|
|
124
124
|
#
|
|
@@ -173,9 +173,9 @@ module OpenAI
|
|
|
173
173
|
#
|
|
174
174
|
# @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil] Allows to set transparency for the background of the generated image(s).
|
|
175
175
|
#
|
|
176
|
-
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or
|
|
176
|
+
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT i
|
|
177
177
|
#
|
|
178
|
-
# @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil] Control the content-moderation level for images generated by
|
|
178
|
+
# @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil] Control the content-moderation level for images generated by the GPT image model
|
|
179
179
|
#
|
|
180
180
|
# @param n [Integer, nil] The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
|
|
181
181
|
#
|
|
@@ -229,9 +229,9 @@ module OpenAI
|
|
|
229
229
|
#
|
|
230
230
|
# @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil] Allows to set transparency for the background of the generated image(s).
|
|
231
231
|
#
|
|
232
|
-
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or
|
|
232
|
+
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT i
|
|
233
233
|
#
|
|
234
|
-
# @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil] Control the content-moderation level for images generated by
|
|
234
|
+
# @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil] Control the content-moderation level for images generated by the GPT image model
|
|
235
235
|
#
|
|
236
236
|
# @param n [Integer, nil] The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
|
|
237
237
|
#
|
data/lib/openai/version.rb
CHANGED
data/lib/openai.rb
CHANGED
|
@@ -385,6 +385,8 @@ require_relative "openai/models/fine_tuning/supervised_hyperparameters"
|
|
|
385
385
|
require_relative "openai/models/fine_tuning/supervised_method"
|
|
386
386
|
require_relative "openai/models/function_definition"
|
|
387
387
|
require_relative "openai/models/function_parameters"
|
|
388
|
+
require_relative "openai/models/graders/grader_input_item"
|
|
389
|
+
require_relative "openai/models/graders/grader_inputs"
|
|
388
390
|
require_relative "openai/models/graders/label_model_grader"
|
|
389
391
|
require_relative "openai/models/graders/multi_grader"
|
|
390
392
|
require_relative "openai/models/graders/string_check_grader"
|
|
@@ -474,7 +474,8 @@ module OpenAI
|
|
|
474
474
|
)
|
|
475
475
|
end
|
|
476
476
|
|
|
477
|
-
# Inputs to the model - can contain template strings.
|
|
477
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
478
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
478
479
|
sig do
|
|
479
480
|
returns(
|
|
480
481
|
T.any(
|
|
@@ -483,7 +484,15 @@ module OpenAI
|
|
|
483
484
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText,
|
|
484
485
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage,
|
|
485
486
|
OpenAI::Responses::ResponseInputAudio,
|
|
486
|
-
T::Array[
|
|
487
|
+
T::Array[
|
|
488
|
+
T.any(
|
|
489
|
+
String,
|
|
490
|
+
OpenAI::Responses::ResponseInputText,
|
|
491
|
+
OpenAI::Graders::GraderInputItem::OutputText,
|
|
492
|
+
OpenAI::Graders::GraderInputItem::InputImage,
|
|
493
|
+
OpenAI::Responses::ResponseInputAudio
|
|
494
|
+
)
|
|
495
|
+
]
|
|
487
496
|
)
|
|
488
497
|
)
|
|
489
498
|
end
|
|
@@ -530,7 +539,15 @@ module OpenAI
|
|
|
530
539
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText::OrHash,
|
|
531
540
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage::OrHash,
|
|
532
541
|
OpenAI::Responses::ResponseInputAudio::OrHash,
|
|
533
|
-
T::Array[
|
|
542
|
+
T::Array[
|
|
543
|
+
T.any(
|
|
544
|
+
String,
|
|
545
|
+
OpenAI::Responses::ResponseInputText::OrHash,
|
|
546
|
+
OpenAI::Graders::GraderInputItem::OutputText::OrHash,
|
|
547
|
+
OpenAI::Graders::GraderInputItem::InputImage::OrHash,
|
|
548
|
+
OpenAI::Responses::ResponseInputAudio::OrHash
|
|
549
|
+
)
|
|
550
|
+
]
|
|
534
551
|
),
|
|
535
552
|
role:
|
|
536
553
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Role::OrSymbol,
|
|
@@ -539,7 +556,8 @@ module OpenAI
|
|
|
539
556
|
).returns(T.attached_class)
|
|
540
557
|
end
|
|
541
558
|
def self.new(
|
|
542
|
-
# Inputs to the model - can contain template strings.
|
|
559
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
560
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
543
561
|
content:,
|
|
544
562
|
# The role of the message input. One of `user`, `assistant`, `system`, or
|
|
545
563
|
# `developer`.
|
|
@@ -559,7 +577,15 @@ module OpenAI
|
|
|
559
577
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText,
|
|
560
578
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage,
|
|
561
579
|
OpenAI::Responses::ResponseInputAudio,
|
|
562
|
-
T::Array[
|
|
580
|
+
T::Array[
|
|
581
|
+
T.any(
|
|
582
|
+
String,
|
|
583
|
+
OpenAI::Responses::ResponseInputText,
|
|
584
|
+
OpenAI::Graders::GraderInputItem::OutputText,
|
|
585
|
+
OpenAI::Graders::GraderInputItem::InputImage,
|
|
586
|
+
OpenAI::Responses::ResponseInputAudio
|
|
587
|
+
)
|
|
588
|
+
]
|
|
563
589
|
),
|
|
564
590
|
role:
|
|
565
591
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Role::OrSymbol,
|
|
@@ -571,7 +597,8 @@ module OpenAI
|
|
|
571
597
|
def to_hash
|
|
572
598
|
end
|
|
573
599
|
|
|
574
|
-
# Inputs to the model - can contain template strings.
|
|
600
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
601
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
575
602
|
module Content
|
|
576
603
|
extend OpenAI::Internal::Type::Union
|
|
577
604
|
|
|
@@ -583,7 +610,7 @@ module OpenAI
|
|
|
583
610
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::OutputText,
|
|
584
611
|
OpenAI::EvalCreateParams::TestingCriterion::LabelModel::Input::EvalItem::Content::InputImage,
|
|
585
612
|
OpenAI::Responses::ResponseInputAudio,
|
|
586
|
-
T::Array[
|
|
613
|
+
T::Array[OpenAI::Graders::GraderInputItem::Variants]
|
|
587
614
|
)
|
|
588
615
|
end
|
|
589
616
|
|
|
@@ -646,7 +673,7 @@ module OpenAI
|
|
|
646
673
|
sig { params(detail: String).void }
|
|
647
674
|
attr_writer :detail
|
|
648
675
|
|
|
649
|
-
# An image input
|
|
676
|
+
# An image input block used within EvalItem content arrays.
|
|
650
677
|
sig do
|
|
651
678
|
params(
|
|
652
679
|
image_url: String,
|
|
@@ -683,14 +710,6 @@ module OpenAI
|
|
|
683
710
|
end
|
|
684
711
|
def self.variants
|
|
685
712
|
end
|
|
686
|
-
|
|
687
|
-
AnArrayOfInputTextInputImageAndInputAudioArray =
|
|
688
|
-
T.let(
|
|
689
|
-
OpenAI::Internal::Type::ArrayOf[
|
|
690
|
-
OpenAI::Internal::Type::Unknown
|
|
691
|
-
],
|
|
692
|
-
OpenAI::Internal::Type::Converter
|
|
693
|
-
)
|
|
694
713
|
end
|
|
695
714
|
|
|
696
715
|
# The role of the message input. One of `user`, `assistant`, `system`, or
|
|
@@ -515,7 +515,8 @@ module OpenAI
|
|
|
515
515
|
)
|
|
516
516
|
end
|
|
517
517
|
|
|
518
|
-
# Inputs to the model - can contain template strings.
|
|
518
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
519
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
519
520
|
sig do
|
|
520
521
|
returns(
|
|
521
522
|
T.any(
|
|
@@ -524,7 +525,15 @@ module OpenAI
|
|
|
524
525
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText,
|
|
525
526
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage,
|
|
526
527
|
OpenAI::Responses::ResponseInputAudio,
|
|
527
|
-
T::Array[
|
|
528
|
+
T::Array[
|
|
529
|
+
T.any(
|
|
530
|
+
String,
|
|
531
|
+
OpenAI::Responses::ResponseInputText,
|
|
532
|
+
OpenAI::Graders::GraderInputItem::OutputText,
|
|
533
|
+
OpenAI::Graders::GraderInputItem::InputImage,
|
|
534
|
+
OpenAI::Responses::ResponseInputAudio
|
|
535
|
+
)
|
|
536
|
+
]
|
|
528
537
|
)
|
|
529
538
|
)
|
|
530
539
|
end
|
|
@@ -571,7 +580,15 @@ module OpenAI
|
|
|
571
580
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText::OrHash,
|
|
572
581
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage::OrHash,
|
|
573
582
|
OpenAI::Responses::ResponseInputAudio::OrHash,
|
|
574
|
-
T::Array[
|
|
583
|
+
T::Array[
|
|
584
|
+
T.any(
|
|
585
|
+
String,
|
|
586
|
+
OpenAI::Responses::ResponseInputText::OrHash,
|
|
587
|
+
OpenAI::Graders::GraderInputItem::OutputText::OrHash,
|
|
588
|
+
OpenAI::Graders::GraderInputItem::InputImage::OrHash,
|
|
589
|
+
OpenAI::Responses::ResponseInputAudio::OrHash
|
|
590
|
+
)
|
|
591
|
+
]
|
|
575
592
|
),
|
|
576
593
|
role:
|
|
577
594
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Role::OrSymbol,
|
|
@@ -580,7 +597,8 @@ module OpenAI
|
|
|
580
597
|
).returns(T.attached_class)
|
|
581
598
|
end
|
|
582
599
|
def self.new(
|
|
583
|
-
# Inputs to the model - can contain template strings.
|
|
600
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
601
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
584
602
|
content:,
|
|
585
603
|
# The role of the message input. One of `user`, `assistant`, `system`, or
|
|
586
604
|
# `developer`.
|
|
@@ -600,7 +618,15 @@ module OpenAI
|
|
|
600
618
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText,
|
|
601
619
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage,
|
|
602
620
|
OpenAI::Responses::ResponseInputAudio,
|
|
603
|
-
T::Array[
|
|
621
|
+
T::Array[
|
|
622
|
+
T.any(
|
|
623
|
+
String,
|
|
624
|
+
OpenAI::Responses::ResponseInputText,
|
|
625
|
+
OpenAI::Graders::GraderInputItem::OutputText,
|
|
626
|
+
OpenAI::Graders::GraderInputItem::InputImage,
|
|
627
|
+
OpenAI::Responses::ResponseInputAudio
|
|
628
|
+
)
|
|
629
|
+
]
|
|
604
630
|
),
|
|
605
631
|
role:
|
|
606
632
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Role::OrSymbol,
|
|
@@ -612,7 +638,8 @@ module OpenAI
|
|
|
612
638
|
def to_hash
|
|
613
639
|
end
|
|
614
640
|
|
|
615
|
-
# Inputs to the model - can contain template strings.
|
|
641
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
642
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
616
643
|
module Content
|
|
617
644
|
extend OpenAI::Internal::Type::Union
|
|
618
645
|
|
|
@@ -624,7 +651,7 @@ module OpenAI
|
|
|
624
651
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText,
|
|
625
652
|
OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage,
|
|
626
653
|
OpenAI::Responses::ResponseInputAudio,
|
|
627
|
-
T::Array[
|
|
654
|
+
T::Array[OpenAI::Graders::GraderInputItem::Variants]
|
|
628
655
|
)
|
|
629
656
|
end
|
|
630
657
|
|
|
@@ -689,7 +716,7 @@ module OpenAI
|
|
|
689
716
|
sig { params(detail: String).void }
|
|
690
717
|
attr_writer :detail
|
|
691
718
|
|
|
692
|
-
# An image input
|
|
719
|
+
# An image input block used within EvalItem content arrays.
|
|
693
720
|
sig do
|
|
694
721
|
params(
|
|
695
722
|
image_url: String,
|
|
@@ -726,14 +753,6 @@ module OpenAI
|
|
|
726
753
|
end
|
|
727
754
|
def self.variants
|
|
728
755
|
end
|
|
729
|
-
|
|
730
|
-
AnArrayOfInputTextInputImageAndInputAudioArray =
|
|
731
|
-
T.let(
|
|
732
|
-
OpenAI::Internal::Type::ArrayOf[
|
|
733
|
-
OpenAI::Internal::Type::Unknown
|
|
734
|
-
],
|
|
735
|
-
OpenAI::Internal::Type::Converter
|
|
736
|
-
)
|
|
737
756
|
end
|
|
738
757
|
|
|
739
758
|
# The role of the message input. One of `user`, `assistant`, `system`, or
|