openai 0.13.0 → 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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/openai/helpers/structured_output/json_schema_converter.rb +34 -10
  5. data/lib/openai/models/eval_create_params.rb +50 -5
  6. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +50 -5
  7. data/lib/openai/models/evals/run_cancel_response.rb +48 -5
  8. data/lib/openai/models/evals/run_create_params.rb +50 -5
  9. data/lib/openai/models/evals/run_create_response.rb +48 -5
  10. data/lib/openai/models/evals/run_list_response.rb +48 -5
  11. data/lib/openai/models/evals/run_retrieve_response.rb +48 -5
  12. data/lib/openai/models/graders/label_model_grader.rb +48 -5
  13. data/lib/openai/models/graders/score_model_grader.rb +48 -5
  14. data/lib/openai/models/image_edit_completed_event.rb +198 -0
  15. data/lib/openai/models/image_edit_params.rb +36 -1
  16. data/lib/openai/models/image_edit_partial_image_event.rb +135 -0
  17. data/lib/openai/models/image_edit_stream_event.rb +21 -0
  18. data/lib/openai/models/image_gen_completed_event.rb +198 -0
  19. data/lib/openai/models/image_gen_partial_image_event.rb +135 -0
  20. data/lib/openai/models/image_gen_stream_event.rb +21 -0
  21. data/lib/openai/models/image_generate_params.rb +13 -1
  22. data/lib/openai/models/images_response.rb +3 -0
  23. data/lib/openai/models/responses/response_output_refusal.rb +2 -2
  24. data/lib/openai/models/responses/tool.rb +30 -1
  25. data/lib/openai/models.rb +12 -0
  26. data/lib/openai/resources/images.rb +140 -2
  27. data/lib/openai/version.rb +1 -1
  28. data/lib/openai.rb +6 -0
  29. data/rbi/openai/helpers/structured_output/json_schema_converter.rbi +4 -0
  30. data/rbi/openai/models/eval_create_params.rbi +76 -7
  31. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +76 -7
  32. data/rbi/openai/models/evals/run_cancel_response.rbi +70 -5
  33. data/rbi/openai/models/evals/run_create_params.rbi +76 -7
  34. data/rbi/openai/models/evals/run_create_response.rbi +70 -5
  35. data/rbi/openai/models/evals/run_list_response.rbi +70 -5
  36. data/rbi/openai/models/evals/run_retrieve_response.rbi +70 -5
  37. data/rbi/openai/models/graders/label_model_grader.rbi +74 -7
  38. data/rbi/openai/models/graders/score_model_grader.rbi +74 -7
  39. data/rbi/openai/models/image_edit_completed_event.rbi +346 -0
  40. data/rbi/openai/models/image_edit_params.rbi +51 -0
  41. data/rbi/openai/models/image_edit_partial_image_event.rbi +249 -0
  42. data/rbi/openai/models/image_edit_stream_event.rbi +22 -0
  43. data/rbi/openai/models/image_gen_completed_event.rbi +339 -0
  44. data/rbi/openai/models/image_gen_partial_image_event.rbi +243 -0
  45. data/rbi/openai/models/image_gen_stream_event.rbi +22 -0
  46. data/rbi/openai/models/image_generate_params.rbi +12 -0
  47. data/rbi/openai/models/responses/response_output_refusal.rbi +2 -2
  48. data/rbi/openai/models/responses/tool.rbi +61 -0
  49. data/rbi/openai/models.rbi +12 -0
  50. data/rbi/openai/resources/images.rbi +225 -0
  51. data/sig/openai/models/eval_create_params.rbs +29 -0
  52. data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +29 -0
  53. data/sig/openai/models/evals/run_cancel_response.rbs +33 -0
  54. data/sig/openai/models/evals/run_create_params.rbs +33 -0
  55. data/sig/openai/models/evals/run_create_response.rbs +33 -0
  56. data/sig/openai/models/evals/run_list_response.rbs +33 -0
  57. data/sig/openai/models/evals/run_retrieve_response.rbs +33 -0
  58. data/sig/openai/models/graders/label_model_grader.rbs +29 -0
  59. data/sig/openai/models/graders/score_model_grader.rbs +29 -0
  60. data/sig/openai/models/image_edit_completed_event.rbs +150 -0
  61. data/sig/openai/models/image_edit_params.rbs +21 -0
  62. data/sig/openai/models/image_edit_partial_image_event.rbs +105 -0
  63. data/sig/openai/models/image_edit_stream_event.rbs +12 -0
  64. data/sig/openai/models/image_gen_completed_event.rbs +150 -0
  65. data/sig/openai/models/image_gen_partial_image_event.rbs +105 -0
  66. data/sig/openai/models/image_gen_stream_event.rbs +12 -0
  67. data/sig/openai/models/image_generate_params.rbs +5 -0
  68. data/sig/openai/models/responses/tool.rbs +16 -0
  69. data/sig/openai/models.rbs +12 -0
  70. data/sig/openai/resources/images.rbs +38 -0
  71. metadata +20 -2
@@ -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
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ class ImageGenPartialImageEvent < 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 image.
14
+ #
15
+ # @return [Symbol, OpenAI::Models::ImageGenPartialImageEvent::Background]
16
+ required :background, enum: -> { OpenAI::ImageGenPartialImageEvent::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 image.
26
+ #
27
+ # @return [Symbol, OpenAI::Models::ImageGenPartialImageEvent::OutputFormat]
28
+ required :output_format, enum: -> { OpenAI::ImageGenPartialImageEvent::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 image.
38
+ #
39
+ # @return [Symbol, OpenAI::Models::ImageGenPartialImageEvent::Quality]
40
+ required :quality, enum: -> { OpenAI::ImageGenPartialImageEvent::Quality }
41
+
42
+ # @!attribute size
43
+ # The size of the requested image.
44
+ #
45
+ # @return [Symbol, OpenAI::Models::ImageGenPartialImageEvent::Size]
46
+ required :size, enum: -> { OpenAI::ImageGenPartialImageEvent::Size }
47
+
48
+ # @!attribute type
49
+ # The type of the event. Always `image_generation.partial_image`.
50
+ #
51
+ # @return [Symbol, :"image_generation.partial_image"]
52
+ required :type, const: :"image_generation.partial_image"
53
+
54
+ # @!method initialize(b64_json:, background:, created_at:, output_format:, partial_image_index:, quality:, size:, type: :"image_generation.partial_image")
55
+ # Some parameter documentations has been truncated, see
56
+ # {OpenAI::Models::ImageGenPartialImageEvent} for more details.
57
+ #
58
+ # Emitted when a partial image is available during image generation 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::ImageGenPartialImageEvent::Background] The background setting for the requested image.
63
+ #
64
+ # @param created_at [Integer] The Unix timestamp when the event was created.
65
+ #
66
+ # @param output_format [Symbol, OpenAI::Models::ImageGenPartialImageEvent::OutputFormat] The output format for the requested image.
67
+ #
68
+ # @param partial_image_index [Integer] 0-based index for the partial image (streaming).
69
+ #
70
+ # @param quality [Symbol, OpenAI::Models::ImageGenPartialImageEvent::Quality] The quality setting for the requested image.
71
+ #
72
+ # @param size [Symbol, OpenAI::Models::ImageGenPartialImageEvent::Size] The size of the requested image.
73
+ #
74
+ # @param type [Symbol, :"image_generation.partial_image"] The type of the event. Always `image_generation.partial_image`.
75
+
76
+ # The background setting for the requested image.
77
+ #
78
+ # @see OpenAI::Models::ImageGenPartialImageEvent#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 image.
91
+ #
92
+ # @see OpenAI::Models::ImageGenPartialImageEvent#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 image.
105
+ #
106
+ # @see OpenAI::Models::ImageGenPartialImageEvent#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 image.
120
+ #
121
+ # @see OpenAI::Models::ImageGenPartialImageEvent#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 generation streaming.
6
+ module ImageGenStreamEvent
7
+ extend OpenAI::Internal::Type::Union
8
+
9
+ discriminator :type
10
+
11
+ # Emitted when a partial image is available during image generation streaming.
12
+ variant :"image_generation.partial_image", -> { OpenAI::ImageGenPartialImageEvent }
13
+
14
+ # Emitted when image generation has completed and the final image is available.
15
+ variant :"image_generation.completed", -> { OpenAI::ImageGenCompletedEvent }
16
+
17
+ # @!method self.variants
18
+ # @return [Array(OpenAI::Models::ImageGenPartialImageEvent, OpenAI::Models::ImageGenCompletedEvent)]
19
+ end
20
+ end
21
+ end
@@ -3,6 +3,8 @@
3
3
  module OpenAI
4
4
  module Models
5
5
  # @see OpenAI::Resources::Images#generate
6
+ #
7
+ # @see OpenAI::Resources::Images#stream_raw
6
8
  class ImageGenerateParams < OpenAI::Internal::Type::BaseModel
7
9
  extend OpenAI::Internal::Type::RequestParameters::Converter
8
10
  include OpenAI::Internal::Type::RequestParameters
@@ -64,6 +66,14 @@ module OpenAI
64
66
  # @return [Symbol, OpenAI::Models::ImageGenerateParams::OutputFormat, nil]
65
67
  optional :output_format, enum: -> { OpenAI::ImageGenerateParams::OutputFormat }, nil?: true
66
68
 
69
+ # @!attribute partial_images
70
+ # The number of partial images to generate. This parameter is used for streaming
71
+ # responses that return partial images. Value must be between 0 and 3. When set to
72
+ # 0, the response will be a single image sent in one streaming event.
73
+ #
74
+ # @return [Integer, nil]
75
+ optional :partial_images, Integer, nil?: true
76
+
67
77
  # @!attribute quality
68
78
  # The quality of the image that will be generated.
69
79
  #
@@ -111,7 +121,7 @@ module OpenAI
111
121
  # @return [String, nil]
112
122
  optional :user, String
113
123
 
114
- # @!method initialize(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
124
+ # @!method initialize(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
115
125
  # Some parameter documentations has been truncated, see
116
126
  # {OpenAI::Models::ImageGenerateParams} for more details.
117
127
  #
@@ -129,6 +139,8 @@ module OpenAI
129
139
  #
130
140
  # @param output_format [Symbol, OpenAI::Models::ImageGenerateParams::OutputFormat, nil] The format in which the generated images are returned. This parameter is only su
131
141
  #
142
+ # @param partial_images [Integer, nil] The number of partial images to generate. This parameter is used for
143
+ #
132
144
  # @param quality [Symbol, OpenAI::Models::ImageGenerateParams::Quality, nil] The quality of the image that will be generated.
133
145
  #
134
146
  # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil] The format in which generated images with `dall-e-2` and `dall-e-3` are returned
@@ -152,6 +152,9 @@ module OpenAI
152
152
  required :total_tokens, Integer
153
153
 
154
154
  # @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, total_tokens:)
155
+ # Some parameter documentations has been truncated, see
156
+ # {OpenAI::Models::ImagesResponse::Usage} for more details.
157
+ #
155
158
  # For `gpt-image-1` only, the token usage information for the image generation.
156
159
  #
157
160
  # @param input_tokens [Integer] The number of tokens (images and text) in the input prompt.
@@ -5,7 +5,7 @@ module OpenAI
5
5
  module Responses
6
6
  class ResponseOutputRefusal < OpenAI::Internal::Type::BaseModel
7
7
  # @!attribute refusal
8
- # The refusal explanationfrom the model.
8
+ # The refusal explanation from the model.
9
9
  #
10
10
  # @return [String]
11
11
  required :refusal, String
@@ -19,7 +19,7 @@ module OpenAI
19
19
  # @!method initialize(refusal:, type: :refusal)
20
20
  # A refusal from the model.
21
21
  #
22
- # @param refusal [String] The refusal explanationfrom the model.
22
+ # @param refusal [String] The refusal explanation from the model.
23
23
  #
24
24
  # @param type [Symbol, :refusal] The type of the refusal. Always `refusal`.
25
25
  end
@@ -305,6 +305,18 @@ module OpenAI
305
305
  # @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Background, nil]
306
306
  optional :background, enum: -> { OpenAI::Responses::Tool::ImageGeneration::Background }
307
307
 
308
+ # @!attribute input_fidelity
309
+ # Control how much effort the model will exert to match the style and features,
310
+ # especially facial features, of input images. This parameter is only supported
311
+ # for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`.
312
+ #
313
+ # @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::InputFidelity, nil]
314
+ optional :input_fidelity,
315
+ enum: -> {
316
+ OpenAI::Responses::Tool::ImageGeneration::InputFidelity
317
+ },
318
+ nil?: true
319
+
308
320
  # @!attribute input_image_mask
309
321
  # Optional mask for inpainting. Contains `image_url` (string, optional) and
310
322
  # `file_id` (string, optional).
@@ -358,7 +370,7 @@ module OpenAI
358
370
  # @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Size, nil]
359
371
  optional :size, enum: -> { OpenAI::Responses::Tool::ImageGeneration::Size }
360
372
 
361
- # @!method initialize(background: nil, input_image_mask: nil, model: nil, moderation: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, size: nil, type: :image_generation)
373
+ # @!method initialize(background: nil, input_fidelity: nil, input_image_mask: nil, model: nil, moderation: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, size: nil, type: :image_generation)
362
374
  # Some parameter documentations has been truncated, see
363
375
  # {OpenAI::Models::Responses::Tool::ImageGeneration} for more details.
364
376
  #
@@ -366,6 +378,8 @@ module OpenAI
366
378
  #
367
379
  # @param background [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Background] Background type for the generated image. One of `transparent`,
368
380
  #
381
+ # @param input_fidelity [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::InputFidelity, nil] Control how much effort the model will exert to match the style and features,
382
+ #
369
383
  # @param input_image_mask [OpenAI::Models::Responses::Tool::ImageGeneration::InputImageMask] Optional mask for inpainting. Contains `image_url`
370
384
  #
371
385
  # @param model [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Model] The image generation model to use. Default: `gpt-image-1`.
@@ -399,6 +413,21 @@ module OpenAI
399
413
  # @return [Array<Symbol>]
400
414
  end
401
415
 
416
+ # Control how much effort the model will exert to match the style and features,
417
+ # especially facial features, of input images. This parameter is only supported
418
+ # for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`.
419
+ #
420
+ # @see OpenAI::Models::Responses::Tool::ImageGeneration#input_fidelity
421
+ module InputFidelity
422
+ extend OpenAI::Internal::Type::Enum
423
+
424
+ HIGH = :high
425
+ LOW = :low
426
+
427
+ # @!method self.values
428
+ # @return [Array<Symbol>]
429
+ end
430
+
402
431
  # @see OpenAI::Models::Responses::Tool::ImageGeneration#input_image_mask
403
432
  class InputImageMask < OpenAI::Internal::Type::BaseModel
404
433
  # @!attribute file_id
data/lib/openai/models.rb CHANGED
@@ -152,10 +152,22 @@ module OpenAI
152
152
 
153
153
  ImageCreateVariationParams = OpenAI::Models::ImageCreateVariationParams
154
154
 
155
+ ImageEditCompletedEvent = OpenAI::Models::ImageEditCompletedEvent
156
+
155
157
  ImageEditParams = OpenAI::Models::ImageEditParams
156
158
 
159
+ ImageEditPartialImageEvent = OpenAI::Models::ImageEditPartialImageEvent
160
+
161
+ ImageEditStreamEvent = OpenAI::Models::ImageEditStreamEvent
162
+
163
+ ImageGenCompletedEvent = OpenAI::Models::ImageGenCompletedEvent
164
+
157
165
  ImageGenerateParams = OpenAI::Models::ImageGenerateParams
158
166
 
167
+ ImageGenPartialImageEvent = OpenAI::Models::ImageGenPartialImageEvent
168
+
169
+ ImageGenStreamEvent = OpenAI::Models::ImageGenStreamEvent
170
+
159
171
  ImageModel = OpenAI::Models::ImageModel
160
172
 
161
173
  ImagesResponse = OpenAI::Models::ImagesResponse