openai 0.13.1 → 0.14.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 +8 -0
- data/README.md +1 -1
- data/lib/openai/models/image_edit_completed_event.rb +198 -0
- data/lib/openai/models/image_edit_params.rb +36 -1
- data/lib/openai/models/image_edit_partial_image_event.rb +135 -0
- data/lib/openai/models/image_edit_stream_event.rb +21 -0
- data/lib/openai/models/image_gen_completed_event.rb +198 -0
- data/lib/openai/models/image_gen_partial_image_event.rb +135 -0
- data/lib/openai/models/image_gen_stream_event.rb +21 -0
- data/lib/openai/models/image_generate_params.rb +13 -1
- data/lib/openai/models/images_response.rb +3 -0
- data/lib/openai/models/responses/response_output_refusal.rb +2 -2
- data/lib/openai/models/responses/tool.rb +30 -1
- data/lib/openai/models.rb +12 -0
- data/lib/openai/resources/images.rb +140 -2
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +6 -0
- data/rbi/openai/models/image_edit_completed_event.rbi +346 -0
- data/rbi/openai/models/image_edit_params.rbi +51 -0
- data/rbi/openai/models/image_edit_partial_image_event.rbi +249 -0
- data/rbi/openai/models/image_edit_stream_event.rbi +22 -0
- data/rbi/openai/models/image_gen_completed_event.rbi +339 -0
- data/rbi/openai/models/image_gen_partial_image_event.rbi +243 -0
- data/rbi/openai/models/image_gen_stream_event.rbi +22 -0
- data/rbi/openai/models/image_generate_params.rbi +12 -0
- data/rbi/openai/models/responses/response_output_refusal.rbi +2 -2
- data/rbi/openai/models/responses/tool.rbi +61 -0
- data/rbi/openai/models.rbi +12 -0
- data/rbi/openai/resources/images.rbi +225 -0
- data/sig/openai/models/image_edit_completed_event.rbs +150 -0
- data/sig/openai/models/image_edit_params.rbs +21 -0
- data/sig/openai/models/image_edit_partial_image_event.rbs +105 -0
- data/sig/openai/models/image_edit_stream_event.rbs +12 -0
- data/sig/openai/models/image_gen_completed_event.rbs +150 -0
- data/sig/openai/models/image_gen_partial_image_event.rbs +105 -0
- data/sig/openai/models/image_gen_stream_event.rbs +12 -0
- data/sig/openai/models/image_generate_params.rbs +5 -0
- data/sig/openai/models/responses/tool.rbs +16 -0
- data/sig/openai/models.rbs +12 -0
- data/sig/openai/resources/images.rbs +38 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 587849393c8641bc5b059ed67e67f4120602c00b390850aab0d1b4907b3efadb
|
4
|
+
data.tar.gz: bee86e5269aa8d64b4ddcda8bc8397bf00fa9ea0582b0dadd5c7b9ddb62f6d37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51e7b1be33acdfcb0f3f2a51c3ef99dcb8e563e39eff974d14143e77576c74a6dae46a301817cd25a3179a2ea8a1d995d0bfee2169ad7798c3a2bb5e4635f6d9
|
7
|
+
data.tar.gz: aae8aad8f1b91ccf0d7b9b970fe43b3a04fb1a830fee1d22395ac95a74bc2940bef4279b869ccb6aa2a103f8171cd63ce2a887891b58d8ae79281477422f7ff4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.14.0 (2025-07-16)
|
4
|
+
|
5
|
+
Full Changelog: [v0.13.1...v0.14.0](https://github.com/openai/openai-ruby/compare/v0.13.1...v0.14.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** manual updates ([b749baf](https://github.com/openai/openai-ruby/commit/b749baf0d1b52c35ff6e50b889301aa7b8ee2ba1))
|
10
|
+
|
3
11
|
## 0.13.1 (2025-07-15)
|
4
12
|
|
5
13
|
Full Changelog: [v0.13.0...v0.13.1](https://github.com/openai/openai-ruby/compare/v0.13.0...v0.13.1)
|
data/README.md
CHANGED
@@ -0,0 +1,198 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
class ImageEditCompletedEvent < OpenAI::Internal::Type::BaseModel
|
6
|
+
# @!attribute b64_json
|
7
|
+
# Base64-encoded final edited image data, suitable for rendering as an image.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
required :b64_json, String
|
11
|
+
|
12
|
+
# @!attribute background
|
13
|
+
# The background setting for the edited image.
|
14
|
+
#
|
15
|
+
# @return [Symbol, OpenAI::Models::ImageEditCompletedEvent::Background]
|
16
|
+
required :background, enum: -> { OpenAI::ImageEditCompletedEvent::Background }
|
17
|
+
|
18
|
+
# @!attribute created_at
|
19
|
+
# The Unix timestamp when the event was created.
|
20
|
+
#
|
21
|
+
# @return [Integer]
|
22
|
+
required :created_at, Integer
|
23
|
+
|
24
|
+
# @!attribute output_format
|
25
|
+
# The output format for the edited image.
|
26
|
+
#
|
27
|
+
# @return [Symbol, OpenAI::Models::ImageEditCompletedEvent::OutputFormat]
|
28
|
+
required :output_format, enum: -> { OpenAI::ImageEditCompletedEvent::OutputFormat }
|
29
|
+
|
30
|
+
# @!attribute quality
|
31
|
+
# The quality setting for the edited image.
|
32
|
+
#
|
33
|
+
# @return [Symbol, OpenAI::Models::ImageEditCompletedEvent::Quality]
|
34
|
+
required :quality, enum: -> { OpenAI::ImageEditCompletedEvent::Quality }
|
35
|
+
|
36
|
+
# @!attribute size
|
37
|
+
# The size of the edited image.
|
38
|
+
#
|
39
|
+
# @return [Symbol, OpenAI::Models::ImageEditCompletedEvent::Size]
|
40
|
+
required :size, enum: -> { OpenAI::ImageEditCompletedEvent::Size }
|
41
|
+
|
42
|
+
# @!attribute type
|
43
|
+
# The type of the event. Always `image_edit.completed`.
|
44
|
+
#
|
45
|
+
# @return [Symbol, :"image_edit.completed"]
|
46
|
+
required :type, const: :"image_edit.completed"
|
47
|
+
|
48
|
+
# @!attribute usage
|
49
|
+
# For `gpt-image-1` only, the token usage information for the image generation.
|
50
|
+
#
|
51
|
+
# @return [OpenAI::Models::ImageEditCompletedEvent::Usage]
|
52
|
+
required :usage, -> { OpenAI::ImageEditCompletedEvent::Usage }
|
53
|
+
|
54
|
+
# @!method initialize(b64_json:, background:, created_at:, output_format:, quality:, size:, usage:, type: :"image_edit.completed")
|
55
|
+
# Some parameter documentations has been truncated, see
|
56
|
+
# {OpenAI::Models::ImageEditCompletedEvent} for more details.
|
57
|
+
#
|
58
|
+
# Emitted when image editing has completed and the final image is available.
|
59
|
+
#
|
60
|
+
# @param b64_json [String] Base64-encoded final edited image data, suitable for rendering as an image.
|
61
|
+
#
|
62
|
+
# @param background [Symbol, OpenAI::Models::ImageEditCompletedEvent::Background] The background setting for the edited image.
|
63
|
+
#
|
64
|
+
# @param created_at [Integer] The Unix timestamp when the event was created.
|
65
|
+
#
|
66
|
+
# @param output_format [Symbol, OpenAI::Models::ImageEditCompletedEvent::OutputFormat] The output format for the edited image.
|
67
|
+
#
|
68
|
+
# @param quality [Symbol, OpenAI::Models::ImageEditCompletedEvent::Quality] The quality setting for the edited image.
|
69
|
+
#
|
70
|
+
# @param size [Symbol, OpenAI::Models::ImageEditCompletedEvent::Size] The size of the edited image.
|
71
|
+
#
|
72
|
+
# @param usage [OpenAI::Models::ImageEditCompletedEvent::Usage] For `gpt-image-1` only, the token usage information for the image generation.
|
73
|
+
#
|
74
|
+
# @param type [Symbol, :"image_edit.completed"] The type of the event. Always `image_edit.completed`.
|
75
|
+
|
76
|
+
# The background setting for the edited image.
|
77
|
+
#
|
78
|
+
# @see OpenAI::Models::ImageEditCompletedEvent#background
|
79
|
+
module Background
|
80
|
+
extend OpenAI::Internal::Type::Enum
|
81
|
+
|
82
|
+
TRANSPARENT = :transparent
|
83
|
+
OPAQUE = :opaque
|
84
|
+
AUTO = :auto
|
85
|
+
|
86
|
+
# @!method self.values
|
87
|
+
# @return [Array<Symbol>]
|
88
|
+
end
|
89
|
+
|
90
|
+
# The output format for the edited image.
|
91
|
+
#
|
92
|
+
# @see OpenAI::Models::ImageEditCompletedEvent#output_format
|
93
|
+
module OutputFormat
|
94
|
+
extend OpenAI::Internal::Type::Enum
|
95
|
+
|
96
|
+
PNG = :png
|
97
|
+
WEBP = :webp
|
98
|
+
JPEG = :jpeg
|
99
|
+
|
100
|
+
# @!method self.values
|
101
|
+
# @return [Array<Symbol>]
|
102
|
+
end
|
103
|
+
|
104
|
+
# The quality setting for the edited image.
|
105
|
+
#
|
106
|
+
# @see OpenAI::Models::ImageEditCompletedEvent#quality
|
107
|
+
module Quality
|
108
|
+
extend OpenAI::Internal::Type::Enum
|
109
|
+
|
110
|
+
LOW = :low
|
111
|
+
MEDIUM = :medium
|
112
|
+
HIGH = :high
|
113
|
+
AUTO = :auto
|
114
|
+
|
115
|
+
# @!method self.values
|
116
|
+
# @return [Array<Symbol>]
|
117
|
+
end
|
118
|
+
|
119
|
+
# The size of the edited image.
|
120
|
+
#
|
121
|
+
# @see OpenAI::Models::ImageEditCompletedEvent#size
|
122
|
+
module Size
|
123
|
+
extend OpenAI::Internal::Type::Enum
|
124
|
+
|
125
|
+
SIZE_1024X1024 = :"1024x1024"
|
126
|
+
SIZE_1024X1536 = :"1024x1536"
|
127
|
+
SIZE_1536X1024 = :"1536x1024"
|
128
|
+
AUTO = :auto
|
129
|
+
|
130
|
+
# @!method self.values
|
131
|
+
# @return [Array<Symbol>]
|
132
|
+
end
|
133
|
+
|
134
|
+
# @see OpenAI::Models::ImageEditCompletedEvent#usage
|
135
|
+
class Usage < OpenAI::Internal::Type::BaseModel
|
136
|
+
# @!attribute input_tokens
|
137
|
+
# The number of tokens (images and text) in the input prompt.
|
138
|
+
#
|
139
|
+
# @return [Integer]
|
140
|
+
required :input_tokens, Integer
|
141
|
+
|
142
|
+
# @!attribute input_tokens_details
|
143
|
+
# The input tokens detailed information for the image generation.
|
144
|
+
#
|
145
|
+
# @return [OpenAI::Models::ImageEditCompletedEvent::Usage::InputTokensDetails]
|
146
|
+
required :input_tokens_details, -> { OpenAI::ImageEditCompletedEvent::Usage::InputTokensDetails }
|
147
|
+
|
148
|
+
# @!attribute output_tokens
|
149
|
+
# The number of image tokens in the output image.
|
150
|
+
#
|
151
|
+
# @return [Integer]
|
152
|
+
required :output_tokens, Integer
|
153
|
+
|
154
|
+
# @!attribute total_tokens
|
155
|
+
# The total number of tokens (images and text) used for the image generation.
|
156
|
+
#
|
157
|
+
# @return [Integer]
|
158
|
+
required :total_tokens, Integer
|
159
|
+
|
160
|
+
# @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, total_tokens:)
|
161
|
+
# Some parameter documentations has been truncated, see
|
162
|
+
# {OpenAI::Models::ImageEditCompletedEvent::Usage} for more details.
|
163
|
+
#
|
164
|
+
# For `gpt-image-1` only, the token usage information for the image generation.
|
165
|
+
#
|
166
|
+
# @param input_tokens [Integer] The number of tokens (images and text) in the input prompt.
|
167
|
+
#
|
168
|
+
# @param input_tokens_details [OpenAI::Models::ImageEditCompletedEvent::Usage::InputTokensDetails] The input tokens detailed information for the image generation.
|
169
|
+
#
|
170
|
+
# @param output_tokens [Integer] The number of image tokens in the output image.
|
171
|
+
#
|
172
|
+
# @param total_tokens [Integer] The total number of tokens (images and text) used for the image generation.
|
173
|
+
|
174
|
+
# @see OpenAI::Models::ImageEditCompletedEvent::Usage#input_tokens_details
|
175
|
+
class InputTokensDetails < OpenAI::Internal::Type::BaseModel
|
176
|
+
# @!attribute image_tokens
|
177
|
+
# The number of image tokens in the input prompt.
|
178
|
+
#
|
179
|
+
# @return [Integer]
|
180
|
+
required :image_tokens, Integer
|
181
|
+
|
182
|
+
# @!attribute text_tokens
|
183
|
+
# The number of text tokens in the input prompt.
|
184
|
+
#
|
185
|
+
# @return [Integer]
|
186
|
+
required :text_tokens, Integer
|
187
|
+
|
188
|
+
# @!method initialize(image_tokens:, text_tokens:)
|
189
|
+
# The input tokens detailed information for the image generation.
|
190
|
+
#
|
191
|
+
# @param image_tokens [Integer] The number of image tokens in the input prompt.
|
192
|
+
#
|
193
|
+
# @param text_tokens [Integer] The number of text tokens in the input prompt.
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
5
|
# @see OpenAI::Resources::Images#edit
|
6
|
+
#
|
7
|
+
# @see OpenAI::Resources::Images#stream_raw
|
6
8
|
class ImageEditParams < OpenAI::Internal::Type::BaseModel
|
7
9
|
extend OpenAI::Internal::Type::RequestParameters::Converter
|
8
10
|
include OpenAI::Internal::Type::RequestParameters
|
@@ -38,6 +40,14 @@ module OpenAI
|
|
38
40
|
# @return [Symbol, OpenAI::Models::ImageEditParams::Background, nil]
|
39
41
|
optional :background, enum: -> { OpenAI::ImageEditParams::Background }, nil?: true
|
40
42
|
|
43
|
+
# @!attribute input_fidelity
|
44
|
+
# Control how much effort the model will exert to match the style and features,
|
45
|
+
# especially facial features, of input images. This parameter is only supported
|
46
|
+
# for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`.
|
47
|
+
#
|
48
|
+
# @return [Symbol, OpenAI::Models::ImageEditParams::InputFidelity, nil]
|
49
|
+
optional :input_fidelity, enum: -> { OpenAI::ImageEditParams::InputFidelity }, nil?: true
|
50
|
+
|
41
51
|
# @!attribute mask
|
42
52
|
# An additional image whose fully transparent areas (e.g. where alpha is zero)
|
43
53
|
# indicate where `image` should be edited. If there are multiple images provided,
|
@@ -77,6 +87,14 @@ module OpenAI
|
|
77
87
|
# @return [Symbol, OpenAI::Models::ImageEditParams::OutputFormat, nil]
|
78
88
|
optional :output_format, enum: -> { OpenAI::ImageEditParams::OutputFormat }, nil?: true
|
79
89
|
|
90
|
+
# @!attribute partial_images
|
91
|
+
# The number of partial images to generate. This parameter is used for streaming
|
92
|
+
# responses that return partial images. Value must be between 0 and 3. When set to
|
93
|
+
# 0, the response will be a single image sent in one streaming event.
|
94
|
+
#
|
95
|
+
# @return [Integer, nil]
|
96
|
+
optional :partial_images, Integer, nil?: true
|
97
|
+
|
80
98
|
# @!attribute quality
|
81
99
|
# The quality of the image that will be generated. `high`, `medium` and `low` are
|
82
100
|
# only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
|
@@ -110,7 +128,7 @@ module OpenAI
|
|
110
128
|
# @return [String, nil]
|
111
129
|
optional :user, String
|
112
130
|
|
113
|
-
# @!method initialize(image:, prompt:, background: nil, mask: nil, model: nil, n: nil, output_compression: nil, output_format: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {})
|
131
|
+
# @!method initialize(image:, prompt:, background: nil, input_fidelity: nil, mask: nil, model: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {})
|
114
132
|
# Some parameter documentations has been truncated, see
|
115
133
|
# {OpenAI::Models::ImageEditParams} for more details.
|
116
134
|
#
|
@@ -120,6 +138,8 @@ module OpenAI
|
|
120
138
|
#
|
121
139
|
# @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil] Allows to set transparency for the background of the generated image(s).
|
122
140
|
#
|
141
|
+
# @param input_fidelity [Symbol, OpenAI::Models::ImageEditParams::InputFidelity, nil] Control how much effort the model will exert to match the style and features,
|
142
|
+
#
|
123
143
|
# @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind
|
124
144
|
#
|
125
145
|
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are sup
|
@@ -130,6 +150,8 @@ module OpenAI
|
|
130
150
|
#
|
131
151
|
# @param output_format [Symbol, OpenAI::Models::ImageEditParams::OutputFormat, nil] The format in which the generated images are returned. This parameter is
|
132
152
|
#
|
153
|
+
# @param partial_images [Integer, nil] The number of partial images to generate. This parameter is used for
|
154
|
+
#
|
133
155
|
# @param quality [Symbol, OpenAI::Models::ImageEditParams::Quality, nil] The quality of the image that will be generated. `high`, `medium` and `low` are
|
134
156
|
#
|
135
157
|
# @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil] The format in which the generated images are returned. Must be one of `url` or `
|
@@ -179,6 +201,19 @@ module OpenAI
|
|
179
201
|
# @return [Array<Symbol>]
|
180
202
|
end
|
181
203
|
|
204
|
+
# Control how much effort the model will exert to match the style and features,
|
205
|
+
# especially facial features, of input images. This parameter is only supported
|
206
|
+
# for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`.
|
207
|
+
module InputFidelity
|
208
|
+
extend OpenAI::Internal::Type::Enum
|
209
|
+
|
210
|
+
HIGH = :high
|
211
|
+
LOW = :low
|
212
|
+
|
213
|
+
# @!method self.values
|
214
|
+
# @return [Array<Symbol>]
|
215
|
+
end
|
216
|
+
|
182
217
|
# The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are
|
183
218
|
# supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1`
|
184
219
|
# is used.
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
class ImageEditPartialImageEvent < OpenAI::Internal::Type::BaseModel
|
6
|
+
# @!attribute b64_json
|
7
|
+
# Base64-encoded partial image data, suitable for rendering as an image.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
required :b64_json, String
|
11
|
+
|
12
|
+
# @!attribute background
|
13
|
+
# The background setting for the requested edited image.
|
14
|
+
#
|
15
|
+
# @return [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Background]
|
16
|
+
required :background, enum: -> { OpenAI::ImageEditPartialImageEvent::Background }
|
17
|
+
|
18
|
+
# @!attribute created_at
|
19
|
+
# The Unix timestamp when the event was created.
|
20
|
+
#
|
21
|
+
# @return [Integer]
|
22
|
+
required :created_at, Integer
|
23
|
+
|
24
|
+
# @!attribute output_format
|
25
|
+
# The output format for the requested edited image.
|
26
|
+
#
|
27
|
+
# @return [Symbol, OpenAI::Models::ImageEditPartialImageEvent::OutputFormat]
|
28
|
+
required :output_format, enum: -> { OpenAI::ImageEditPartialImageEvent::OutputFormat }
|
29
|
+
|
30
|
+
# @!attribute partial_image_index
|
31
|
+
# 0-based index for the partial image (streaming).
|
32
|
+
#
|
33
|
+
# @return [Integer]
|
34
|
+
required :partial_image_index, Integer
|
35
|
+
|
36
|
+
# @!attribute quality
|
37
|
+
# The quality setting for the requested edited image.
|
38
|
+
#
|
39
|
+
# @return [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Quality]
|
40
|
+
required :quality, enum: -> { OpenAI::ImageEditPartialImageEvent::Quality }
|
41
|
+
|
42
|
+
# @!attribute size
|
43
|
+
# The size of the requested edited image.
|
44
|
+
#
|
45
|
+
# @return [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Size]
|
46
|
+
required :size, enum: -> { OpenAI::ImageEditPartialImageEvent::Size }
|
47
|
+
|
48
|
+
# @!attribute type
|
49
|
+
# The type of the event. Always `image_edit.partial_image`.
|
50
|
+
#
|
51
|
+
# @return [Symbol, :"image_edit.partial_image"]
|
52
|
+
required :type, const: :"image_edit.partial_image"
|
53
|
+
|
54
|
+
# @!method initialize(b64_json:, background:, created_at:, output_format:, partial_image_index:, quality:, size:, type: :"image_edit.partial_image")
|
55
|
+
# Some parameter documentations has been truncated, see
|
56
|
+
# {OpenAI::Models::ImageEditPartialImageEvent} for more details.
|
57
|
+
#
|
58
|
+
# Emitted when a partial image is available during image editing streaming.
|
59
|
+
#
|
60
|
+
# @param b64_json [String] Base64-encoded partial image data, suitable for rendering as an image.
|
61
|
+
#
|
62
|
+
# @param background [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Background] The background setting for the requested edited image.
|
63
|
+
#
|
64
|
+
# @param created_at [Integer] The Unix timestamp when the event was created.
|
65
|
+
#
|
66
|
+
# @param output_format [Symbol, OpenAI::Models::ImageEditPartialImageEvent::OutputFormat] The output format for the requested edited image.
|
67
|
+
#
|
68
|
+
# @param partial_image_index [Integer] 0-based index for the partial image (streaming).
|
69
|
+
#
|
70
|
+
# @param quality [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Quality] The quality setting for the requested edited image.
|
71
|
+
#
|
72
|
+
# @param size [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Size] The size of the requested edited image.
|
73
|
+
#
|
74
|
+
# @param type [Symbol, :"image_edit.partial_image"] The type of the event. Always `image_edit.partial_image`.
|
75
|
+
|
76
|
+
# The background setting for the requested edited image.
|
77
|
+
#
|
78
|
+
# @see OpenAI::Models::ImageEditPartialImageEvent#background
|
79
|
+
module Background
|
80
|
+
extend OpenAI::Internal::Type::Enum
|
81
|
+
|
82
|
+
TRANSPARENT = :transparent
|
83
|
+
OPAQUE = :opaque
|
84
|
+
AUTO = :auto
|
85
|
+
|
86
|
+
# @!method self.values
|
87
|
+
# @return [Array<Symbol>]
|
88
|
+
end
|
89
|
+
|
90
|
+
# The output format for the requested edited image.
|
91
|
+
#
|
92
|
+
# @see OpenAI::Models::ImageEditPartialImageEvent#output_format
|
93
|
+
module OutputFormat
|
94
|
+
extend OpenAI::Internal::Type::Enum
|
95
|
+
|
96
|
+
PNG = :png
|
97
|
+
WEBP = :webp
|
98
|
+
JPEG = :jpeg
|
99
|
+
|
100
|
+
# @!method self.values
|
101
|
+
# @return [Array<Symbol>]
|
102
|
+
end
|
103
|
+
|
104
|
+
# The quality setting for the requested edited image.
|
105
|
+
#
|
106
|
+
# @see OpenAI::Models::ImageEditPartialImageEvent#quality
|
107
|
+
module Quality
|
108
|
+
extend OpenAI::Internal::Type::Enum
|
109
|
+
|
110
|
+
LOW = :low
|
111
|
+
MEDIUM = :medium
|
112
|
+
HIGH = :high
|
113
|
+
AUTO = :auto
|
114
|
+
|
115
|
+
# @!method self.values
|
116
|
+
# @return [Array<Symbol>]
|
117
|
+
end
|
118
|
+
|
119
|
+
# The size of the requested edited image.
|
120
|
+
#
|
121
|
+
# @see OpenAI::Models::ImageEditPartialImageEvent#size
|
122
|
+
module Size
|
123
|
+
extend OpenAI::Internal::Type::Enum
|
124
|
+
|
125
|
+
SIZE_1024X1024 = :"1024x1024"
|
126
|
+
SIZE_1024X1536 = :"1024x1536"
|
127
|
+
SIZE_1536X1024 = :"1536x1024"
|
128
|
+
AUTO = :auto
|
129
|
+
|
130
|
+
# @!method self.values
|
131
|
+
# @return [Array<Symbol>]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
# Emitted when a partial image is available during image editing streaming.
|
6
|
+
module ImageEditStreamEvent
|
7
|
+
extend OpenAI::Internal::Type::Union
|
8
|
+
|
9
|
+
discriminator :type
|
10
|
+
|
11
|
+
# Emitted when a partial image is available during image editing streaming.
|
12
|
+
variant :"image_edit.partial_image", -> { OpenAI::ImageEditPartialImageEvent }
|
13
|
+
|
14
|
+
# Emitted when image editing has completed and the final image is available.
|
15
|
+
variant :"image_edit.completed", -> { OpenAI::ImageEditCompletedEvent }
|
16
|
+
|
17
|
+
# @!method self.variants
|
18
|
+
# @return [Array(OpenAI::Models::ImageEditPartialImageEvent, OpenAI::Models::ImageEditCompletedEvent)]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,198 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
class ImageGenCompletedEvent < OpenAI::Internal::Type::BaseModel
|
6
|
+
# @!attribute b64_json
|
7
|
+
# Base64-encoded image data, suitable for rendering as an image.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
required :b64_json, String
|
11
|
+
|
12
|
+
# @!attribute background
|
13
|
+
# The background setting for the generated image.
|
14
|
+
#
|
15
|
+
# @return [Symbol, OpenAI::Models::ImageGenCompletedEvent::Background]
|
16
|
+
required :background, enum: -> { OpenAI::ImageGenCompletedEvent::Background }
|
17
|
+
|
18
|
+
# @!attribute created_at
|
19
|
+
# The Unix timestamp when the event was created.
|
20
|
+
#
|
21
|
+
# @return [Integer]
|
22
|
+
required :created_at, Integer
|
23
|
+
|
24
|
+
# @!attribute output_format
|
25
|
+
# The output format for the generated image.
|
26
|
+
#
|
27
|
+
# @return [Symbol, OpenAI::Models::ImageGenCompletedEvent::OutputFormat]
|
28
|
+
required :output_format, enum: -> { OpenAI::ImageGenCompletedEvent::OutputFormat }
|
29
|
+
|
30
|
+
# @!attribute quality
|
31
|
+
# The quality setting for the generated image.
|
32
|
+
#
|
33
|
+
# @return [Symbol, OpenAI::Models::ImageGenCompletedEvent::Quality]
|
34
|
+
required :quality, enum: -> { OpenAI::ImageGenCompletedEvent::Quality }
|
35
|
+
|
36
|
+
# @!attribute size
|
37
|
+
# The size of the generated image.
|
38
|
+
#
|
39
|
+
# @return [Symbol, OpenAI::Models::ImageGenCompletedEvent::Size]
|
40
|
+
required :size, enum: -> { OpenAI::ImageGenCompletedEvent::Size }
|
41
|
+
|
42
|
+
# @!attribute type
|
43
|
+
# The type of the event. Always `image_generation.completed`.
|
44
|
+
#
|
45
|
+
# @return [Symbol, :"image_generation.completed"]
|
46
|
+
required :type, const: :"image_generation.completed"
|
47
|
+
|
48
|
+
# @!attribute usage
|
49
|
+
# For `gpt-image-1` only, the token usage information for the image generation.
|
50
|
+
#
|
51
|
+
# @return [OpenAI::Models::ImageGenCompletedEvent::Usage]
|
52
|
+
required :usage, -> { OpenAI::ImageGenCompletedEvent::Usage }
|
53
|
+
|
54
|
+
# @!method initialize(b64_json:, background:, created_at:, output_format:, quality:, size:, usage:, type: :"image_generation.completed")
|
55
|
+
# Some parameter documentations has been truncated, see
|
56
|
+
# {OpenAI::Models::ImageGenCompletedEvent} for more details.
|
57
|
+
#
|
58
|
+
# Emitted when image generation has completed and the final image is available.
|
59
|
+
#
|
60
|
+
# @param b64_json [String] Base64-encoded image data, suitable for rendering as an image.
|
61
|
+
#
|
62
|
+
# @param background [Symbol, OpenAI::Models::ImageGenCompletedEvent::Background] The background setting for the generated image.
|
63
|
+
#
|
64
|
+
# @param created_at [Integer] The Unix timestamp when the event was created.
|
65
|
+
#
|
66
|
+
# @param output_format [Symbol, OpenAI::Models::ImageGenCompletedEvent::OutputFormat] The output format for the generated image.
|
67
|
+
#
|
68
|
+
# @param quality [Symbol, OpenAI::Models::ImageGenCompletedEvent::Quality] The quality setting for the generated image.
|
69
|
+
#
|
70
|
+
# @param size [Symbol, OpenAI::Models::ImageGenCompletedEvent::Size] The size of the generated image.
|
71
|
+
#
|
72
|
+
# @param usage [OpenAI::Models::ImageGenCompletedEvent::Usage] For `gpt-image-1` only, the token usage information for the image generation.
|
73
|
+
#
|
74
|
+
# @param type [Symbol, :"image_generation.completed"] The type of the event. Always `image_generation.completed`.
|
75
|
+
|
76
|
+
# The background setting for the generated image.
|
77
|
+
#
|
78
|
+
# @see OpenAI::Models::ImageGenCompletedEvent#background
|
79
|
+
module Background
|
80
|
+
extend OpenAI::Internal::Type::Enum
|
81
|
+
|
82
|
+
TRANSPARENT = :transparent
|
83
|
+
OPAQUE = :opaque
|
84
|
+
AUTO = :auto
|
85
|
+
|
86
|
+
# @!method self.values
|
87
|
+
# @return [Array<Symbol>]
|
88
|
+
end
|
89
|
+
|
90
|
+
# The output format for the generated image.
|
91
|
+
#
|
92
|
+
# @see OpenAI::Models::ImageGenCompletedEvent#output_format
|
93
|
+
module OutputFormat
|
94
|
+
extend OpenAI::Internal::Type::Enum
|
95
|
+
|
96
|
+
PNG = :png
|
97
|
+
WEBP = :webp
|
98
|
+
JPEG = :jpeg
|
99
|
+
|
100
|
+
# @!method self.values
|
101
|
+
# @return [Array<Symbol>]
|
102
|
+
end
|
103
|
+
|
104
|
+
# The quality setting for the generated image.
|
105
|
+
#
|
106
|
+
# @see OpenAI::Models::ImageGenCompletedEvent#quality
|
107
|
+
module Quality
|
108
|
+
extend OpenAI::Internal::Type::Enum
|
109
|
+
|
110
|
+
LOW = :low
|
111
|
+
MEDIUM = :medium
|
112
|
+
HIGH = :high
|
113
|
+
AUTO = :auto
|
114
|
+
|
115
|
+
# @!method self.values
|
116
|
+
# @return [Array<Symbol>]
|
117
|
+
end
|
118
|
+
|
119
|
+
# The size of the generated image.
|
120
|
+
#
|
121
|
+
# @see OpenAI::Models::ImageGenCompletedEvent#size
|
122
|
+
module Size
|
123
|
+
extend OpenAI::Internal::Type::Enum
|
124
|
+
|
125
|
+
SIZE_1024X1024 = :"1024x1024"
|
126
|
+
SIZE_1024X1536 = :"1024x1536"
|
127
|
+
SIZE_1536X1024 = :"1536x1024"
|
128
|
+
AUTO = :auto
|
129
|
+
|
130
|
+
# @!method self.values
|
131
|
+
# @return [Array<Symbol>]
|
132
|
+
end
|
133
|
+
|
134
|
+
# @see OpenAI::Models::ImageGenCompletedEvent#usage
|
135
|
+
class Usage < OpenAI::Internal::Type::BaseModel
|
136
|
+
# @!attribute input_tokens
|
137
|
+
# The number of tokens (images and text) in the input prompt.
|
138
|
+
#
|
139
|
+
# @return [Integer]
|
140
|
+
required :input_tokens, Integer
|
141
|
+
|
142
|
+
# @!attribute input_tokens_details
|
143
|
+
# The input tokens detailed information for the image generation.
|
144
|
+
#
|
145
|
+
# @return [OpenAI::Models::ImageGenCompletedEvent::Usage::InputTokensDetails]
|
146
|
+
required :input_tokens_details, -> { OpenAI::ImageGenCompletedEvent::Usage::InputTokensDetails }
|
147
|
+
|
148
|
+
# @!attribute output_tokens
|
149
|
+
# The number of image tokens in the output image.
|
150
|
+
#
|
151
|
+
# @return [Integer]
|
152
|
+
required :output_tokens, Integer
|
153
|
+
|
154
|
+
# @!attribute total_tokens
|
155
|
+
# The total number of tokens (images and text) used for the image generation.
|
156
|
+
#
|
157
|
+
# @return [Integer]
|
158
|
+
required :total_tokens, Integer
|
159
|
+
|
160
|
+
# @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, total_tokens:)
|
161
|
+
# Some parameter documentations has been truncated, see
|
162
|
+
# {OpenAI::Models::ImageGenCompletedEvent::Usage} for more details.
|
163
|
+
#
|
164
|
+
# For `gpt-image-1` only, the token usage information for the image generation.
|
165
|
+
#
|
166
|
+
# @param input_tokens [Integer] The number of tokens (images and text) in the input prompt.
|
167
|
+
#
|
168
|
+
# @param input_tokens_details [OpenAI::Models::ImageGenCompletedEvent::Usage::InputTokensDetails] The input tokens detailed information for the image generation.
|
169
|
+
#
|
170
|
+
# @param output_tokens [Integer] The number of image tokens in the output image.
|
171
|
+
#
|
172
|
+
# @param total_tokens [Integer] The total number of tokens (images and text) used for the image generation.
|
173
|
+
|
174
|
+
# @see OpenAI::Models::ImageGenCompletedEvent::Usage#input_tokens_details
|
175
|
+
class InputTokensDetails < OpenAI::Internal::Type::BaseModel
|
176
|
+
# @!attribute image_tokens
|
177
|
+
# The number of image tokens in the input prompt.
|
178
|
+
#
|
179
|
+
# @return [Integer]
|
180
|
+
required :image_tokens, Integer
|
181
|
+
|
182
|
+
# @!attribute text_tokens
|
183
|
+
# The number of text tokens in the input prompt.
|
184
|
+
#
|
185
|
+
# @return [Integer]
|
186
|
+
required :text_tokens, Integer
|
187
|
+
|
188
|
+
# @!method initialize(image_tokens:, text_tokens:)
|
189
|
+
# The input tokens detailed information for the image generation.
|
190
|
+
#
|
191
|
+
# @param image_tokens [Integer] The number of image tokens in the input prompt.
|
192
|
+
#
|
193
|
+
# @param text_tokens [Integer] The number of text tokens in the input prompt.
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|