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
|
@@ -102,7 +102,8 @@ module OpenAI
|
|
|
102
102
|
)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
# Inputs to the model - can contain template strings.
|
|
105
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
106
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
106
107
|
sig do
|
|
107
108
|
returns(
|
|
108
109
|
T.any(
|
|
@@ -111,7 +112,15 @@ module OpenAI
|
|
|
111
112
|
OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText,
|
|
112
113
|
OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage,
|
|
113
114
|
OpenAI::Responses::ResponseInputAudio,
|
|
114
|
-
T::Array[
|
|
115
|
+
T::Array[
|
|
116
|
+
T.any(
|
|
117
|
+
String,
|
|
118
|
+
OpenAI::Responses::ResponseInputText,
|
|
119
|
+
OpenAI::Graders::GraderInputItem::OutputText,
|
|
120
|
+
OpenAI::Graders::GraderInputItem::InputImage,
|
|
121
|
+
OpenAI::Responses::ResponseInputAudio
|
|
122
|
+
)
|
|
123
|
+
]
|
|
115
124
|
)
|
|
116
125
|
)
|
|
117
126
|
end
|
|
@@ -155,14 +164,23 @@ module OpenAI
|
|
|
155
164
|
OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText::OrHash,
|
|
156
165
|
OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage::OrHash,
|
|
157
166
|
OpenAI::Responses::ResponseInputAudio::OrHash,
|
|
158
|
-
T::Array[
|
|
167
|
+
T::Array[
|
|
168
|
+
T.any(
|
|
169
|
+
String,
|
|
170
|
+
OpenAI::Responses::ResponseInputText::OrHash,
|
|
171
|
+
OpenAI::Graders::GraderInputItem::OutputText::OrHash,
|
|
172
|
+
OpenAI::Graders::GraderInputItem::InputImage::OrHash,
|
|
173
|
+
OpenAI::Responses::ResponseInputAudio::OrHash
|
|
174
|
+
)
|
|
175
|
+
]
|
|
159
176
|
),
|
|
160
177
|
role: OpenAI::Graders::ScoreModelGrader::Input::Role::OrSymbol,
|
|
161
178
|
type: OpenAI::Graders::ScoreModelGrader::Input::Type::OrSymbol
|
|
162
179
|
).returns(T.attached_class)
|
|
163
180
|
end
|
|
164
181
|
def self.new(
|
|
165
|
-
# Inputs to the model - can contain template strings.
|
|
182
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
183
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
166
184
|
content:,
|
|
167
185
|
# The role of the message input. One of `user`, `assistant`, `system`, or
|
|
168
186
|
# `developer`.
|
|
@@ -182,7 +200,15 @@ module OpenAI
|
|
|
182
200
|
OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText,
|
|
183
201
|
OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage,
|
|
184
202
|
OpenAI::Responses::ResponseInputAudio,
|
|
185
|
-
T::Array[
|
|
203
|
+
T::Array[
|
|
204
|
+
T.any(
|
|
205
|
+
String,
|
|
206
|
+
OpenAI::Responses::ResponseInputText,
|
|
207
|
+
OpenAI::Graders::GraderInputItem::OutputText,
|
|
208
|
+
OpenAI::Graders::GraderInputItem::InputImage,
|
|
209
|
+
OpenAI::Responses::ResponseInputAudio
|
|
210
|
+
)
|
|
211
|
+
]
|
|
186
212
|
),
|
|
187
213
|
role: OpenAI::Graders::ScoreModelGrader::Input::Role::OrSymbol,
|
|
188
214
|
type: OpenAI::Graders::ScoreModelGrader::Input::Type::OrSymbol
|
|
@@ -192,7 +218,8 @@ module OpenAI
|
|
|
192
218
|
def to_hash
|
|
193
219
|
end
|
|
194
220
|
|
|
195
|
-
# Inputs to the model - can contain template strings.
|
|
221
|
+
# Inputs to the model - can contain template strings. Supports text, output text,
|
|
222
|
+
# input images, and input audio, either as a single item or an array of items.
|
|
196
223
|
module Content
|
|
197
224
|
extend OpenAI::Internal::Type::Union
|
|
198
225
|
|
|
@@ -204,7 +231,7 @@ module OpenAI
|
|
|
204
231
|
OpenAI::Graders::ScoreModelGrader::Input::Content::OutputText,
|
|
205
232
|
OpenAI::Graders::ScoreModelGrader::Input::Content::InputImage,
|
|
206
233
|
OpenAI::Responses::ResponseInputAudio,
|
|
207
|
-
T::Array[
|
|
234
|
+
T::Array[OpenAI::Graders::GraderInputItem::Variants]
|
|
208
235
|
)
|
|
209
236
|
end
|
|
210
237
|
|
|
@@ -267,7 +294,7 @@ module OpenAI
|
|
|
267
294
|
sig { params(detail: String).void }
|
|
268
295
|
attr_writer :detail
|
|
269
296
|
|
|
270
|
-
# An image input
|
|
297
|
+
# An image input block used within EvalItem content arrays.
|
|
271
298
|
sig do
|
|
272
299
|
params(image_url: String, detail: String, type: Symbol).returns(
|
|
273
300
|
T.attached_class
|
|
@@ -302,14 +329,6 @@ module OpenAI
|
|
|
302
329
|
end
|
|
303
330
|
def self.variants
|
|
304
331
|
end
|
|
305
|
-
|
|
306
|
-
AnArrayOfInputTextInputImageAndInputAudioArray =
|
|
307
|
-
T.let(
|
|
308
|
-
OpenAI::Internal::Type::ArrayOf[
|
|
309
|
-
OpenAI::Internal::Type::Unknown
|
|
310
|
-
],
|
|
311
|
-
OpenAI::Internal::Type::Converter
|
|
312
|
-
)
|
|
313
332
|
end
|
|
314
333
|
|
|
315
334
|
# The role of the message input. One of `user`, `assistant`, `system`, or
|
data/rbi/openai/models/image.rbi
CHANGED
|
@@ -5,9 +5,9 @@ module OpenAI
|
|
|
5
5
|
class Image < OpenAI::Internal::Type::BaseModel
|
|
6
6
|
OrHash = T.type_alias { T.any(OpenAI::Image, OpenAI::Internal::AnyHash) }
|
|
7
7
|
|
|
8
|
-
# The base64-encoded JSON of the generated image.
|
|
9
|
-
# and only present if `response_format` is set to `b64_json` for
|
|
10
|
-
# `dall-e-3`.
|
|
8
|
+
# The base64-encoded JSON of the generated image. Returned by default for the GPT
|
|
9
|
+
# image models, and only present if `response_format` is set to `b64_json` for
|
|
10
|
+
# `dall-e-2` and `dall-e-3`.
|
|
11
11
|
sig { returns(T.nilable(String)) }
|
|
12
12
|
attr_reader :b64_json
|
|
13
13
|
|
|
@@ -22,8 +22,8 @@ module OpenAI
|
|
|
22
22
|
attr_writer :revised_prompt
|
|
23
23
|
|
|
24
24
|
# When using `dall-e-2` or `dall-e-3`, the URL of the generated image if
|
|
25
|
-
# `response_format` is set to `url` (default value). Unsupported for
|
|
26
|
-
#
|
|
25
|
+
# `response_format` is set to `url` (default value). Unsupported for the GPT image
|
|
26
|
+
# models.
|
|
27
27
|
sig { returns(T.nilable(String)) }
|
|
28
28
|
attr_reader :url
|
|
29
29
|
|
|
@@ -37,15 +37,15 @@ module OpenAI
|
|
|
37
37
|
)
|
|
38
38
|
end
|
|
39
39
|
def self.new(
|
|
40
|
-
# The base64-encoded JSON of the generated image.
|
|
41
|
-
# and only present if `response_format` is set to `b64_json` for
|
|
42
|
-
# `dall-e-3`.
|
|
40
|
+
# The base64-encoded JSON of the generated image. Returned by default for the GPT
|
|
41
|
+
# image models, and only present if `response_format` is set to `b64_json` for
|
|
42
|
+
# `dall-e-2` and `dall-e-3`.
|
|
43
43
|
b64_json: nil,
|
|
44
44
|
# For `dall-e-3` only, the revised prompt that was used to generate the image.
|
|
45
45
|
revised_prompt: nil,
|
|
46
46
|
# When using `dall-e-2` or `dall-e-3`, the URL of the generated image if
|
|
47
|
-
# `response_format` is set to `url` (default value). Unsupported for
|
|
48
|
-
#
|
|
47
|
+
# `response_format` is set to `url` (default value). Unsupported for the GPT image
|
|
48
|
+
# models.
|
|
49
49
|
url: nil
|
|
50
50
|
)
|
|
51
51
|
end
|
|
@@ -38,7 +38,8 @@ module OpenAI
|
|
|
38
38
|
sig { returns(Symbol) }
|
|
39
39
|
attr_accessor :type
|
|
40
40
|
|
|
41
|
-
# For
|
|
41
|
+
# For the GPT image models only, the token usage information for the image
|
|
42
|
+
# generation.
|
|
42
43
|
sig { returns(OpenAI::ImageEditCompletedEvent::Usage) }
|
|
43
44
|
attr_reader :usage
|
|
44
45
|
|
|
@@ -72,7 +73,8 @@ module OpenAI
|
|
|
72
73
|
quality:,
|
|
73
74
|
# The size of the edited image.
|
|
74
75
|
size:,
|
|
75
|
-
# For
|
|
76
|
+
# For the GPT image models only, the token usage information for the image
|
|
77
|
+
# generation.
|
|
76
78
|
usage:,
|
|
77
79
|
# The type of the event. Always `image_edit.completed`.
|
|
78
80
|
type: :"image_edit.completed"
|
|
@@ -267,7 +269,8 @@ module OpenAI
|
|
|
267
269
|
sig { returns(Integer) }
|
|
268
270
|
attr_accessor :total_tokens
|
|
269
271
|
|
|
270
|
-
# For
|
|
272
|
+
# For the GPT image models only, the token usage information for the image
|
|
273
|
+
# generation.
|
|
271
274
|
sig do
|
|
272
275
|
params(
|
|
273
276
|
input_tokens: Integer,
|
|
@@ -13,7 +13,8 @@ module OpenAI
|
|
|
13
13
|
|
|
14
14
|
# The image(s) to edit. Must be a supported image file or an array of images.
|
|
15
15
|
#
|
|
16
|
-
# For `gpt-image-1`,
|
|
16
|
+
# For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
|
|
17
|
+
# `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
|
|
17
18
|
# 50MB. You can provide up to 16 images.
|
|
18
19
|
#
|
|
19
20
|
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
|
|
@@ -22,14 +23,14 @@ module OpenAI
|
|
|
22
23
|
attr_accessor :image
|
|
23
24
|
|
|
24
25
|
# A text description of the desired image(s). The maximum length is 1000
|
|
25
|
-
# characters for `dall-e-2`, and 32000 characters for
|
|
26
|
+
# characters for `dall-e-2`, and 32000 characters for the GPT image models.
|
|
26
27
|
sig { returns(String) }
|
|
27
28
|
attr_accessor :prompt
|
|
28
29
|
|
|
29
30
|
# Allows to set transparency for the background of the generated image(s). This
|
|
30
|
-
# parameter is only supported for
|
|
31
|
-
# `opaque` or `auto` (default value). When `auto` is used, the
|
|
32
|
-
# automatically determine the best background for the image.
|
|
31
|
+
# parameter is only supported for the GPT image models. Must be one of
|
|
32
|
+
# `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
|
|
33
|
+
# model will automatically determine the best background for the image.
|
|
33
34
|
#
|
|
34
35
|
# If `transparent`, the output format needs to support transparency, so it should
|
|
35
36
|
# be set to either `png` (default value) or `webp`.
|
|
@@ -55,9 +56,9 @@ module OpenAI
|
|
|
55
56
|
sig { params(mask: OpenAI::Internal::FileInput).void }
|
|
56
57
|
attr_writer :mask
|
|
57
58
|
|
|
58
|
-
# The model to use for image generation. Only `dall-e-2` and
|
|
59
|
-
# supported. Defaults to `dall-e-2` unless a parameter specific to
|
|
60
|
-
# is used.
|
|
59
|
+
# The model to use for image generation. Only `dall-e-2` and the GPT image models
|
|
60
|
+
# are supported. Defaults to `dall-e-2` unless a parameter specific to the GPT
|
|
61
|
+
# image models is used.
|
|
61
62
|
sig { returns(T.nilable(T.any(String, OpenAI::ImageModel::OrSymbol))) }
|
|
62
63
|
attr_accessor :model
|
|
63
64
|
|
|
@@ -66,13 +67,13 @@ module OpenAI
|
|
|
66
67
|
attr_accessor :n
|
|
67
68
|
|
|
68
69
|
# The compression level (0-100%) for the generated images. This parameter is only
|
|
69
|
-
# supported for
|
|
70
|
+
# supported for the GPT image models with the `webp` or `jpeg` output formats, and
|
|
70
71
|
# defaults to 100.
|
|
71
72
|
sig { returns(T.nilable(Integer)) }
|
|
72
73
|
attr_accessor :output_compression
|
|
73
74
|
|
|
74
75
|
# The format in which the generated images are returned. This parameter is only
|
|
75
|
-
# supported for
|
|
76
|
+
# supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
|
|
76
77
|
# default value is `png`.
|
|
77
78
|
sig do
|
|
78
79
|
returns(T.nilable(OpenAI::ImageEditParams::OutputFormat::OrSymbol))
|
|
@@ -89,23 +90,23 @@ module OpenAI
|
|
|
89
90
|
attr_accessor :partial_images
|
|
90
91
|
|
|
91
92
|
# The quality of the image that will be generated. `high`, `medium` and `low` are
|
|
92
|
-
# only supported for
|
|
93
|
-
# Defaults to `auto`.
|
|
93
|
+
# only supported for the GPT image models. `dall-e-2` only supports `standard`
|
|
94
|
+
# quality. Defaults to `auto`.
|
|
94
95
|
sig { returns(T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol)) }
|
|
95
96
|
attr_accessor :quality
|
|
96
97
|
|
|
97
98
|
# The format in which the generated images are returned. Must be one of `url` or
|
|
98
99
|
# `b64_json`. URLs are only valid for 60 minutes after the image has been
|
|
99
|
-
# generated. This parameter is only supported for `dall-e-2`, as
|
|
100
|
-
#
|
|
100
|
+
# generated. This parameter is only supported for `dall-e-2`, as the GPT image
|
|
101
|
+
# models always return base64-encoded images.
|
|
101
102
|
sig do
|
|
102
103
|
returns(T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol))
|
|
103
104
|
end
|
|
104
105
|
attr_accessor :response_format
|
|
105
106
|
|
|
106
107
|
# The size of the generated images. Must be one of `1024x1024`, `1536x1024`
|
|
107
|
-
# (landscape), `1024x1536` (portrait), or `auto` (default value) for
|
|
108
|
-
#
|
|
108
|
+
# (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
|
|
109
|
+
# models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
|
|
109
110
|
sig { returns(T.nilable(OpenAI::ImageEditParams::Size::OrSymbol)) }
|
|
110
111
|
attr_accessor :size
|
|
111
112
|
|
|
@@ -143,19 +144,20 @@ module OpenAI
|
|
|
143
144
|
def self.new(
|
|
144
145
|
# The image(s) to edit. Must be a supported image file or an array of images.
|
|
145
146
|
#
|
|
146
|
-
# For `gpt-image-1`,
|
|
147
|
+
# For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
|
|
148
|
+
# `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
|
|
147
149
|
# 50MB. You can provide up to 16 images.
|
|
148
150
|
#
|
|
149
151
|
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
|
|
150
152
|
# file less than 4MB.
|
|
151
153
|
image:,
|
|
152
154
|
# A text description of the desired image(s). The maximum length is 1000
|
|
153
|
-
# characters for `dall-e-2`, and 32000 characters for
|
|
155
|
+
# characters for `dall-e-2`, and 32000 characters for the GPT image models.
|
|
154
156
|
prompt:,
|
|
155
157
|
# Allows to set transparency for the background of the generated image(s). This
|
|
156
|
-
# parameter is only supported for
|
|
157
|
-
# `opaque` or `auto` (default value). When `auto` is used, the
|
|
158
|
-
# automatically determine the best background for the image.
|
|
158
|
+
# parameter is only supported for the GPT image models. Must be one of
|
|
159
|
+
# `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
|
|
160
|
+
# model will automatically determine the best background for the image.
|
|
159
161
|
#
|
|
160
162
|
# If `transparent`, the output format needs to support transparency, so it should
|
|
161
163
|
# be set to either `png` (default value) or `webp`.
|
|
@@ -170,18 +172,18 @@ module OpenAI
|
|
|
170
172
|
# the mask will be applied on the first image. Must be a valid PNG file, less than
|
|
171
173
|
# 4MB, and have the same dimensions as `image`.
|
|
172
174
|
mask: nil,
|
|
173
|
-
# The model to use for image generation. Only `dall-e-2` and
|
|
174
|
-
# supported. Defaults to `dall-e-2` unless a parameter specific to
|
|
175
|
-
# is used.
|
|
175
|
+
# The model to use for image generation. Only `dall-e-2` and the GPT image models
|
|
176
|
+
# are supported. Defaults to `dall-e-2` unless a parameter specific to the GPT
|
|
177
|
+
# image models is used.
|
|
176
178
|
model: nil,
|
|
177
179
|
# The number of images to generate. Must be between 1 and 10.
|
|
178
180
|
n: nil,
|
|
179
181
|
# The compression level (0-100%) for the generated images. This parameter is only
|
|
180
|
-
# supported for
|
|
182
|
+
# supported for the GPT image models with the `webp` or `jpeg` output formats, and
|
|
181
183
|
# defaults to 100.
|
|
182
184
|
output_compression: nil,
|
|
183
185
|
# The format in which the generated images are returned. This parameter is only
|
|
184
|
-
# supported for
|
|
186
|
+
# supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
|
|
185
187
|
# default value is `png`.
|
|
186
188
|
output_format: nil,
|
|
187
189
|
# The number of partial images to generate. This parameter is used for streaming
|
|
@@ -192,17 +194,17 @@ module OpenAI
|
|
|
192
194
|
# are generated if the full image is generated more quickly.
|
|
193
195
|
partial_images: nil,
|
|
194
196
|
# The quality of the image that will be generated. `high`, `medium` and `low` are
|
|
195
|
-
# only supported for
|
|
196
|
-
# Defaults to `auto`.
|
|
197
|
+
# only supported for the GPT image models. `dall-e-2` only supports `standard`
|
|
198
|
+
# quality. Defaults to `auto`.
|
|
197
199
|
quality: nil,
|
|
198
200
|
# The format in which the generated images are returned. Must be one of `url` or
|
|
199
201
|
# `b64_json`. URLs are only valid for 60 minutes after the image has been
|
|
200
|
-
# generated. This parameter is only supported for `dall-e-2`, as
|
|
201
|
-
#
|
|
202
|
+
# generated. This parameter is only supported for `dall-e-2`, as the GPT image
|
|
203
|
+
# models always return base64-encoded images.
|
|
202
204
|
response_format: nil,
|
|
203
205
|
# The size of the generated images. Must be one of `1024x1024`, `1536x1024`
|
|
204
|
-
# (landscape), `1024x1536` (portrait), or `auto` (default value) for
|
|
205
|
-
#
|
|
206
|
+
# (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
|
|
207
|
+
# models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
|
|
206
208
|
size: nil,
|
|
207
209
|
# A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
208
210
|
# and detect abuse.
|
|
@@ -242,7 +244,8 @@ module OpenAI
|
|
|
242
244
|
|
|
243
245
|
# The image(s) to edit. Must be a supported image file or an array of images.
|
|
244
246
|
#
|
|
245
|
-
# For `gpt-image-1`,
|
|
247
|
+
# For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
|
|
248
|
+
# `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
|
|
246
249
|
# 50MB. You can provide up to 16 images.
|
|
247
250
|
#
|
|
248
251
|
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
|
|
@@ -266,9 +269,9 @@ module OpenAI
|
|
|
266
269
|
end
|
|
267
270
|
|
|
268
271
|
# Allows to set transparency for the background of the generated image(s). This
|
|
269
|
-
# parameter is only supported for
|
|
270
|
-
# `opaque` or `auto` (default value). When `auto` is used, the
|
|
271
|
-
# automatically determine the best background for the image.
|
|
272
|
+
# parameter is only supported for the GPT image models. Must be one of
|
|
273
|
+
# `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
|
|
274
|
+
# model will automatically determine the best background for the image.
|
|
272
275
|
#
|
|
273
276
|
# If `transparent`, the output format needs to support transparency, so it should
|
|
274
277
|
# be set to either `png` (default value) or `webp`.
|
|
@@ -318,9 +321,9 @@ module OpenAI
|
|
|
318
321
|
end
|
|
319
322
|
end
|
|
320
323
|
|
|
321
|
-
# The model to use for image generation. Only `dall-e-2` and
|
|
322
|
-
# supported. Defaults to `dall-e-2` unless a parameter specific to
|
|
323
|
-
# is used.
|
|
324
|
+
# The model to use for image generation. Only `dall-e-2` and the GPT image models
|
|
325
|
+
# are supported. Defaults to `dall-e-2` unless a parameter specific to the GPT
|
|
326
|
+
# image models is used.
|
|
324
327
|
module Model
|
|
325
328
|
extend OpenAI::Internal::Type::Union
|
|
326
329
|
|
|
@@ -335,7 +338,7 @@ module OpenAI
|
|
|
335
338
|
end
|
|
336
339
|
|
|
337
340
|
# The format in which the generated images are returned. This parameter is only
|
|
338
|
-
# supported for
|
|
341
|
+
# supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
|
|
339
342
|
# default value is `png`.
|
|
340
343
|
module OutputFormat
|
|
341
344
|
extend OpenAI::Internal::Type::Enum
|
|
@@ -358,8 +361,8 @@ module OpenAI
|
|
|
358
361
|
end
|
|
359
362
|
|
|
360
363
|
# The quality of the image that will be generated. `high`, `medium` and `low` are
|
|
361
|
-
# only supported for
|
|
362
|
-
# Defaults to `auto`.
|
|
364
|
+
# only supported for the GPT image models. `dall-e-2` only supports `standard`
|
|
365
|
+
# quality. Defaults to `auto`.
|
|
363
366
|
module Quality
|
|
364
367
|
extend OpenAI::Internal::Type::Enum
|
|
365
368
|
|
|
@@ -385,8 +388,8 @@ module OpenAI
|
|
|
385
388
|
|
|
386
389
|
# The format in which the generated images are returned. Must be one of `url` or
|
|
387
390
|
# `b64_json`. URLs are only valid for 60 minutes after the image has been
|
|
388
|
-
# generated. This parameter is only supported for `dall-e-2`, as
|
|
389
|
-
#
|
|
391
|
+
# generated. This parameter is only supported for `dall-e-2`, as the GPT image
|
|
392
|
+
# models always return base64-encoded images.
|
|
390
393
|
module ResponseFormat
|
|
391
394
|
extend OpenAI::Internal::Type::Enum
|
|
392
395
|
|
|
@@ -413,8 +416,8 @@ module OpenAI
|
|
|
413
416
|
end
|
|
414
417
|
|
|
415
418
|
# The size of the generated images. Must be one of `1024x1024`, `1536x1024`
|
|
416
|
-
# (landscape), `1024x1536` (portrait), or `auto` (default value) for
|
|
417
|
-
#
|
|
419
|
+
# (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
|
|
420
|
+
# models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
|
|
418
421
|
module Size
|
|
419
422
|
extend OpenAI::Internal::Type::Enum
|
|
420
423
|
|
|
@@ -38,7 +38,8 @@ module OpenAI
|
|
|
38
38
|
sig { returns(Symbol) }
|
|
39
39
|
attr_accessor :type
|
|
40
40
|
|
|
41
|
-
# For
|
|
41
|
+
# For the GPT image models only, the token usage information for the image
|
|
42
|
+
# generation.
|
|
42
43
|
sig { returns(OpenAI::ImageGenCompletedEvent::Usage) }
|
|
43
44
|
attr_reader :usage
|
|
44
45
|
|
|
@@ -71,7 +72,8 @@ module OpenAI
|
|
|
71
72
|
quality:,
|
|
72
73
|
# The size of the generated image.
|
|
73
74
|
size:,
|
|
74
|
-
# For
|
|
75
|
+
# For the GPT image models only, the token usage information for the image
|
|
76
|
+
# generation.
|
|
75
77
|
usage:,
|
|
76
78
|
# The type of the event. Always `image_generation.completed`.
|
|
77
79
|
type: :"image_generation.completed"
|
|
@@ -260,7 +262,8 @@ module OpenAI
|
|
|
260
262
|
sig { returns(Integer) }
|
|
261
263
|
attr_accessor :total_tokens
|
|
262
264
|
|
|
263
|
-
# For
|
|
265
|
+
# For the GPT image models only, the token usage information for the image
|
|
266
|
+
# generation.
|
|
264
267
|
sig do
|
|
265
268
|
params(
|
|
266
269
|
input_tokens: Integer,
|