openai 0.86.0 → 0.87.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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +10 -1
  4. data/examples/audio/record_and_play.rb +19 -0
  5. data/examples/responses/websocket_workflows.rb +159 -0
  6. data/lib/openai/helpers/local_audio/errors.rb +27 -0
  7. data/lib/openai/helpers/local_audio/process.rb +158 -0
  8. data/lib/openai/helpers/local_audio.rb +157 -0
  9. data/lib/openai/helpers/realtime/connection.rb +20 -2
  10. data/lib/openai/helpers/realtime/errors.rb +18 -0
  11. data/lib/openai/helpers/realtime/recovery.rb +489 -0
  12. data/lib/openai/helpers/realtime/resources/realtime_extension.rb +26 -1
  13. data/lib/openai/helpers/realtime.rb +1 -0
  14. data/lib/openai/models/beta/beta_response_input_item.rb +84 -1
  15. data/lib/openai/models/beta/beta_response_item.rb +72 -1
  16. data/lib/openai/models/beta/beta_response_output_item.rb +84 -1
  17. data/lib/openai/models/beta/beta_responses_client_event.rb +3 -0
  18. data/lib/openai/models/beta/beta_tool.rb +69 -37
  19. data/lib/openai/models/beta/response_create_params.rb +3 -0
  20. data/lib/openai/models/conversations/conversation_item.rb +82 -1
  21. data/lib/openai/models/image_edit_completed_event.rb +34 -8
  22. data/lib/openai/models/image_edit_params.rb +64 -44
  23. data/lib/openai/models/image_edit_partial_image_event.rb +34 -8
  24. data/lib/openai/models/image_gen_completed_event.rb +34 -8
  25. data/lib/openai/models/image_gen_partial_image_event.rb +34 -8
  26. data/lib/openai/models/image_generate_params.rb +51 -35
  27. data/lib/openai/models/image_model.rb +4 -0
  28. data/lib/openai/models/images_response.rb +37 -13
  29. data/lib/openai/models/responses/response_create_params.rb +3 -0
  30. data/lib/openai/models/responses/response_input_item.rb +84 -1
  31. data/lib/openai/models/responses/response_item.rb +72 -1
  32. data/lib/openai/models/responses/response_output_item.rb +84 -1
  33. data/lib/openai/models/responses/responses_client_event.rb +3 -0
  34. data/lib/openai/models/responses/tool.rb +69 -37
  35. data/lib/openai/models/webhooks/live_call_incoming_webhook_event.rb +3 -3
  36. data/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb +5 -3
  37. data/lib/openai/resources/images.rb +12 -14
  38. data/lib/openai/version.rb +1 -1
  39. data/local-audio.md +146 -0
  40. data/rbi/openai/helpers/local_audio/interface.rbi +110 -0
  41. data/rbi/openai/helpers/realtime/connection.rbi +18 -2
  42. data/rbi/openai/helpers/realtime/extensions.rbi +8 -0
  43. data/rbi/openai/helpers/realtime/recovery.rbi +27 -0
  44. data/rbi/openai/models/beta/beta_response_input_item.rbi +86 -1
  45. data/rbi/openai/models/beta/beta_response_item.rbi +78 -1
  46. data/rbi/openai/models/beta/beta_response_output_item.rbi +84 -1
  47. data/rbi/openai/models/beta/beta_responses_client_event.rbi +6 -0
  48. data/rbi/openai/models/beta/beta_tool.rbi +90 -51
  49. data/rbi/openai/models/beta/response_create_params.rbi +6 -0
  50. data/rbi/openai/models/conversations/conversation_item.rbi +88 -1
  51. data/rbi/openai/models/image_edit_completed_event.rbi +20 -9
  52. data/rbi/openai/models/image_edit_params.rbi +89 -60
  53. data/rbi/openai/models/image_edit_partial_image_event.rbi +20 -9
  54. data/rbi/openai/models/image_gen_completed_event.rbi +20 -9
  55. data/rbi/openai/models/image_gen_partial_image_event.rbi +20 -9
  56. data/rbi/openai/models/image_generate_params.rbi +71 -48
  57. data/rbi/openai/models/image_model.rbi +4 -0
  58. data/rbi/openai/models/images_response.rbi +27 -16
  59. data/rbi/openai/models/responses/response_create_params.rbi +6 -0
  60. data/rbi/openai/models/responses/response_input_item.rbi +88 -1
  61. data/rbi/openai/models/responses/response_item.rbi +80 -1
  62. data/rbi/openai/models/responses/response_output_item.rbi +84 -1
  63. data/rbi/openai/models/responses/responses_client_event.rbi +6 -0
  64. data/rbi/openai/models/responses/tool.rbi +90 -51
  65. data/rbi/openai/models/webhooks/live_call_incoming_webhook_event.rbi +4 -4
  66. data/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi +8 -4
  67. data/rbi/openai/resources/beta/responses.rbi +6 -2
  68. data/rbi/openai/resources/images.rbi +106 -76
  69. data/rbi/openai/resources/responses.rbi +6 -0
  70. data/realtime.md +101 -0
  71. data/responses-websocket.md +182 -0
  72. data/sig/openai/helpers/local_audio/interface.rbs +62 -0
  73. data/sig/openai/helpers/realtime/connection.rbs +9 -1
  74. data/sig/openai/helpers/realtime/extensions.rbs +4 -0
  75. data/sig/openai/helpers/realtime/recovery.rbs +19 -0
  76. data/sig/openai/models/beta/beta_response_input_item.rbs +39 -2
  77. data/sig/openai/models/beta/beta_response_item.rbs +39 -2
  78. data/sig/openai/models/beta/beta_response_output_item.rbs +39 -2
  79. data/sig/openai/models/beta/beta_tool.rbs +11 -1
  80. data/sig/openai/models/conversations/conversation_item.rbs +39 -2
  81. data/sig/openai/models/image_edit_completed_event.rbs +11 -4
  82. data/sig/openai/models/image_edit_params.rbs +3 -1
  83. data/sig/openai/models/image_edit_partial_image_event.rbs +11 -4
  84. data/sig/openai/models/image_gen_completed_event.rbs +11 -4
  85. data/sig/openai/models/image_gen_partial_image_event.rbs +11 -4
  86. data/sig/openai/models/image_generate_params.rbs +4 -1
  87. data/sig/openai/models/image_model.rbs +8 -0
  88. data/sig/openai/models/images_response.rbs +10 -4
  89. data/sig/openai/models/responses/response_input_item.rbs +39 -2
  90. data/sig/openai/models/responses/response_item.rbs +39 -2
  91. data/sig/openai/models/responses/response_output_item.rbs +39 -2
  92. data/sig/openai/models/responses/tool.rbs +11 -1
  93. metadata +15 -1
@@ -25,16 +25,20 @@ module OpenAI
25
25
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
26
26
  # the model will automatically determine the best background for the image.
27
27
  #
28
- # Transparent backgrounds are available for supported GPT Image models. For
29
- # `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
30
- # using `transparent`, set the output format to `png` or `webp`.
28
+ # `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
29
+ # snapshots, support `opaque` and `transparent` backgrounds. Transparent
30
+ # backgrounds are available for supported GPT Image models. For `gpt-image-2` and
31
+ # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
32
+ # set the output format to `png` or `webp`.
31
33
  sig { returns(T.nilable(OpenAI::ImageGenerateParams::Background::OrSymbol)) }
32
34
  attr_accessor :background
33
35
 
34
36
  # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
35
37
  # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
36
- # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific
37
- # to the GPT image models is used.
38
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
39
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
40
+ # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
41
+ # specific to the GPT image models is used.
38
42
  sig { returns(T.nilable(T.any(String, OpenAI::ImageModel::OrSymbol))) }
39
43
  attr_accessor :model
40
44
 
@@ -74,6 +78,8 @@ module OpenAI
74
78
  # - `auto` (default value) will automatically select the best quality for the
75
79
  # given model.
76
80
  # - `high`, `medium` and `low` are supported for the GPT image models.
81
+ # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
82
+ # `2026-09-08` snapshots, also support `xhigh` and `max`.
77
83
  # - `hd` and `standard` are supported for `dall-e-3`.
78
84
  # - `standard` is the only option for `dall-e-2`.
79
85
  sig { returns(T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol)) }
@@ -86,17 +92,18 @@ module OpenAI
86
92
  sig { returns(T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol)) }
87
93
  attr_accessor :response_format
88
94
 
89
- # The size of the generated images. For `gpt-image-2` and
90
- # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
91
- # strings, for example `1536x864`. Width and height must both be divisible by 16
92
- # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
93
- # `2560x1440` are experimental, and the maximum supported resolution is
94
- # `3840x2160`. The requested size must also satisfy the model's current pixel and
95
- # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
96
- # supported by the GPT image models; `auto` is supported for models that allow
97
- # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
98
- # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
99
- # `1024x1792`.
95
+ # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
96
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
97
+ # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
98
+ # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
99
+ # Width and height must both be divisible by 16 and the requested aspect ratio
100
+ # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
101
+ # the maximum supported resolution is `3840x2160`. The requested size must also
102
+ # satisfy the model's current pixel and edge limits. The standard sizes
103
+ # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
104
+ # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
105
+ # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
106
+ # `1024x1024`, `1792x1024`, or `1024x1792`.
100
107
  sig { returns(T.nilable(T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol))) }
101
108
  attr_accessor :size
102
109
 
@@ -160,15 +167,19 @@ module OpenAI
160
167
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
161
168
  # the model will automatically determine the best background for the image.
162
169
  #
163
- # Transparent backgrounds are available for supported GPT Image models. For
164
- # `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
165
- # using `transparent`, set the output format to `png` or `webp`.
170
+ # `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
171
+ # snapshots, support `opaque` and `transparent` backgrounds. Transparent
172
+ # backgrounds are available for supported GPT Image models. For `gpt-image-2` and
173
+ # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
174
+ # set the output format to `png` or `webp`.
166
175
  background: nil,
167
176
 
168
177
  # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
169
178
  # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
170
- # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific
171
- # to the GPT image models is used.
179
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
180
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
181
+ # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
182
+ # specific to the GPT image models is used.
172
183
  model: nil,
173
184
 
174
185
  # Control the content-moderation level for images generated by the GPT image
@@ -202,6 +213,8 @@ module OpenAI
202
213
  # - `auto` (default value) will automatically select the best quality for the
203
214
  # given model.
204
215
  # - `high`, `medium` and `low` are supported for the GPT image models.
216
+ # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
217
+ # `2026-09-08` snapshots, also support `xhigh` and `max`.
205
218
  # - `hd` and `standard` are supported for `dall-e-3`.
206
219
  # - `standard` is the only option for `dall-e-2`.
207
220
  quality: nil,
@@ -212,17 +225,18 @@ module OpenAI
212
225
  # image models, which always return base64-encoded images.
213
226
  response_format: nil,
214
227
 
215
- # The size of the generated images. For `gpt-image-2` and
216
- # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
217
- # strings, for example `1536x864`. Width and height must both be divisible by 16
218
- # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
219
- # `2560x1440` are experimental, and the maximum supported resolution is
220
- # `3840x2160`. The requested size must also satisfy the model's current pixel and
221
- # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
222
- # supported by the GPT image models; `auto` is supported for models that allow
223
- # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
224
- # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
225
- # `1024x1792`.
228
+ # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
229
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
230
+ # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
231
+ # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
232
+ # Width and height must both be divisible by 16 and the requested aspect ratio
233
+ # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
234
+ # the maximum supported resolution is `3840x2160`. The requested size must also
235
+ # satisfy the model's current pixel and edge limits. The standard sizes
236
+ # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
237
+ # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
238
+ # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
239
+ # `1024x1024`, `1792x1024`, or `1024x1792`.
226
240
  size: nil,
227
241
 
228
242
  # The style of the generated images. This parameter is only supported for
@@ -267,9 +281,11 @@ module OpenAI
267
281
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
268
282
  # the model will automatically determine the best background for the image.
269
283
  #
270
- # Transparent backgrounds are available for supported GPT Image models. For
271
- # `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
272
- # using `transparent`, set the output format to `png` or `webp`.
284
+ # `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
285
+ # snapshots, support `opaque` and `transparent` backgrounds. Transparent
286
+ # backgrounds are available for supported GPT Image models. For `gpt-image-2` and
287
+ # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
288
+ # set the output format to `png` or `webp`.
273
289
  module Background
274
290
  extend OpenAI::Internal::Type::Enum
275
291
 
@@ -287,8 +303,10 @@ module OpenAI
287
303
 
288
304
  # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
289
305
  # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
290
- # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific
291
- # to the GPT image models is used.
306
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
307
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
308
+ # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
309
+ # specific to the GPT image models is used.
292
310
  module Model
293
311
  extend OpenAI::Internal::Type::Union
294
312
 
@@ -339,6 +357,8 @@ module OpenAI
339
357
  # - `auto` (default value) will automatically select the best quality for the
340
358
  # given model.
341
359
  # - `high`, `medium` and `low` are supported for the GPT image models.
360
+ # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
361
+ # `2026-09-08` snapshots, also support `xhigh` and `max`.
342
362
  # - `hd` and `standard` are supported for `dall-e-3`.
343
363
  # - `standard` is the only option for `dall-e-2`.
344
364
  module Quality
@@ -352,6 +372,8 @@ module OpenAI
352
372
  LOW = T.let(:low, OpenAI::ImageGenerateParams::Quality::TaggedSymbol)
353
373
  MEDIUM = T.let(:medium, OpenAI::ImageGenerateParams::Quality::TaggedSymbol)
354
374
  HIGH = T.let(:high, OpenAI::ImageGenerateParams::Quality::TaggedSymbol)
375
+ XHIGH = T.let(:xhigh, OpenAI::ImageGenerateParams::Quality::TaggedSymbol)
376
+ MAX = T.let(:max, OpenAI::ImageGenerateParams::Quality::TaggedSymbol)
355
377
  AUTO = T.let(:auto, OpenAI::ImageGenerateParams::Quality::TaggedSymbol)
356
378
 
357
379
  sig { override.returns(T::Array[OpenAI::ImageGenerateParams::Quality::TaggedSymbol]) }
@@ -377,17 +399,18 @@ module OpenAI
377
399
  end
378
400
  end
379
401
 
380
- # The size of the generated images. For `gpt-image-2` and
381
- # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
382
- # strings, for example `1536x864`. Width and height must both be divisible by 16
383
- # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
384
- # `2560x1440` are experimental, and the maximum supported resolution is
385
- # `3840x2160`. The requested size must also satisfy the model's current pixel and
386
- # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
387
- # supported by the GPT image models; `auto` is supported for models that allow
388
- # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
389
- # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
390
- # `1024x1792`.
402
+ # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
403
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
404
+ # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
405
+ # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
406
+ # Width and height must both be divisible by 16 and the requested aspect ratio
407
+ # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
408
+ # the maximum supported resolution is `3840x2160`. The requested size must also
409
+ # satisfy the model's current pixel and edge limits. The standard sizes
410
+ # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
411
+ # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
412
+ # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
413
+ # `1024x1024`, `1792x1024`, or `1024x1792`.
391
414
  module Size
392
415
  extend OpenAI::Internal::Type::Union
393
416
 
@@ -13,6 +13,10 @@ module OpenAI
13
13
  GPT_IMAGE_1_MINI = T.let(:"gpt-image-1-mini", OpenAI::ImageModel::TaggedSymbol)
14
14
  GPT_IMAGE_2 = T.let(:"gpt-image-2", OpenAI::ImageModel::TaggedSymbol)
15
15
  GPT_IMAGE_2_2026_04_21 = T.let(:"gpt-image-2-2026-04-21", OpenAI::ImageModel::TaggedSymbol)
16
+ GPT_IMAGE_2_5_SUNBURST = T.let(:"gpt-image-2.5-sunburst", OpenAI::ImageModel::TaggedSymbol)
17
+ GPT_IMAGE_2_5_SUNBURST_2026_09_08 = T.let(:"gpt-image-2.5-sunburst-2026-09-08", OpenAI::ImageModel::TaggedSymbol)
18
+ GPT_IMAGE_2_5_FLARE = T.let(:"gpt-image-2.5-flare", OpenAI::ImageModel::TaggedSymbol)
19
+ GPT_IMAGE_2_5_FLARE_2026_09_08 = T.let(:"gpt-image-2.5-flare-2026-09-08", OpenAI::ImageModel::TaggedSymbol)
16
20
  GPT_IMAGE_1_5 = T.let(:"gpt-image-1.5", OpenAI::ImageModel::TaggedSymbol)
17
21
  CHATGPT_IMAGE_LATEST = T.let(:"chatgpt-image-latest", OpenAI::ImageModel::TaggedSymbol)
18
22
  DALL_E_2 = T.let(:"dall-e-2", OpenAI::ImageModel::TaggedSymbol)
@@ -38,19 +38,19 @@ module OpenAI
38
38
  sig { params(output_format: OpenAI::ImagesResponse::OutputFormat::OrSymbol).void }
39
39
  attr_writer :output_format
40
40
 
41
- # The quality of the image generated. Either `low`, `medium`, or `high`.
41
+ # The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or
42
+ # `max`.
42
43
  sig { returns(T.nilable(OpenAI::ImagesResponse::Quality::TaggedSymbol)) }
43
44
  attr_reader :quality
44
45
 
45
46
  sig { params(quality: OpenAI::ImagesResponse::Quality::OrSymbol).void }
46
47
  attr_writer :quality
47
48
 
48
- # The size of the image generated. Either `1024x1024`, `1024x1536`, or
49
- # `1536x1024`.
50
- sig { returns(T.nilable(OpenAI::ImagesResponse::Size::TaggedSymbol)) }
49
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
50
+ sig { returns(T.nilable(OpenAI::ImagesResponse::Size::Variants)) }
51
51
  attr_reader :size
52
52
 
53
- sig { params(size: OpenAI::ImagesResponse::Size::OrSymbol).void }
53
+ sig { params(size: T.any(String, OpenAI::ImagesResponse::Size::OrSymbol)).void }
54
54
  attr_writer :size
55
55
 
56
56
  # For `gpt-image-1` only, the token usage information for the image generation.
@@ -74,7 +74,7 @@ module OpenAI
74
74
 
75
75
  quality: OpenAI::ImagesResponse::Quality::OrSymbol,
76
76
 
77
- size: OpenAI::ImagesResponse::Size::OrSymbol,
77
+ size: T.any(String, OpenAI::ImagesResponse::Size::OrSymbol),
78
78
 
79
79
  usage: OpenAI::ImagesResponse::Usage::OrHash
80
80
  )
@@ -95,11 +95,11 @@ module OpenAI
95
95
  # The output format of the image generation. Either `png`, `webp`, or `jpeg`.
96
96
  output_format: nil,
97
97
 
98
- # The quality of the image generated. Either `low`, `medium`, or `high`.
98
+ # The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or
99
+ # `max`.
99
100
  quality: nil,
100
101
 
101
- # The size of the image generated. Either `1024x1024`, `1024x1536`, or
102
- # `1536x1024`.
102
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
103
103
  size: nil,
104
104
 
105
105
  # For `gpt-image-1` only, the token usage information for the image generation.
@@ -116,7 +116,7 @@ module OpenAI
116
116
  data: T::Array[OpenAI::Image],
117
117
  output_format: OpenAI::ImagesResponse::OutputFormat::TaggedSymbol,
118
118
  quality: OpenAI::ImagesResponse::Quality::TaggedSymbol,
119
- size: OpenAI::ImagesResponse::Size::TaggedSymbol,
119
+ size: OpenAI::ImagesResponse::Size::Variants,
120
120
  usage: OpenAI::ImagesResponse::Usage
121
121
  }
122
122
  )
@@ -156,7 +156,8 @@ module OpenAI
156
156
  end
157
157
  end
158
158
 
159
- # The quality of the image generated. Either `low`, `medium`, or `high`.
159
+ # The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or
160
+ # `max`.
160
161
  module Quality
161
162
  extend OpenAI::Internal::Type::Enum
162
163
 
@@ -166,25 +167,35 @@ module OpenAI
166
167
  LOW = T.let(:low, OpenAI::ImagesResponse::Quality::TaggedSymbol)
167
168
  MEDIUM = T.let(:medium, OpenAI::ImagesResponse::Quality::TaggedSymbol)
168
169
  HIGH = T.let(:high, OpenAI::ImagesResponse::Quality::TaggedSymbol)
170
+ XHIGH = T.let(:xhigh, OpenAI::ImagesResponse::Quality::TaggedSymbol)
171
+ MAX = T.let(:max, OpenAI::ImagesResponse::Quality::TaggedSymbol)
169
172
 
170
173
  sig { override.returns(T::Array[OpenAI::ImagesResponse::Quality::TaggedSymbol]) }
171
174
  def self.values
172
175
  end
173
176
  end
174
177
 
175
- # The size of the image generated. Either `1024x1024`, `1024x1536`, or
176
- # `1536x1024`.
178
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
177
179
  module Size
178
- extend OpenAI::Internal::Type::Enum
180
+ extend OpenAI::Internal::Type::Union
181
+
182
+ Variants = T.type_alias { T.any(String, OpenAI::ImagesResponse::Size::TaggedSymbol) }
183
+
184
+ sig { override.returns(T::Array[OpenAI::ImagesResponse::Size::Variants]) }
185
+ def self.variants
186
+ end
187
+
188
+ TaggedSymbol = T.type_alias do
189
+ T.all(Symbol, OpenAI::ImagesResponse::Size)
190
+ end
179
191
 
180
- TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::ImagesResponse::Size) }
181
192
  OrSymbol = T.type_alias { T.any(Symbol, String) }
182
193
 
183
194
  SIZE_1024X1024 = T.let(:"1024x1024", OpenAI::ImagesResponse::Size::TaggedSymbol)
184
195
  SIZE_1024X1536 = T.let(:"1024x1536", OpenAI::ImagesResponse::Size::TaggedSymbol)
185
196
  SIZE_1536X1024 = T.let(:"1536x1024", OpenAI::ImagesResponse::Size::TaggedSymbol)
186
197
 
187
- sig { override.returns(T::Array[OpenAI::ImagesResponse::Size::TaggedSymbol]) }
198
+ sig { returns(T::Array[OpenAI::ImagesResponse::Size::TaggedSymbol]) }
188
199
  def self.values
189
200
  end
190
201
  end
@@ -231,6 +231,9 @@ module OpenAI
231
231
  attr_accessor :service_tier
232
232
 
233
233
  # Whether to store the generated model response for later retrieval via API.
234
+ # Defaults to true when omitted. If set to true, response data will be stored for
235
+ # at least 30 days, subject to the
236
+ # [data retention exceptions](/api/docs/guides/your-data#v1responses).
234
237
  sig { returns(T.nilable(T::Boolean)) }
235
238
  attr_accessor :store
236
239
 
@@ -682,6 +685,9 @@ module OpenAI
682
685
  service_tier: nil,
683
686
 
684
687
  # Whether to store the generated model response for later retrieval via API.
688
+ # Defaults to true when omitted. If set to true, response data will be stored for
689
+ # at least 30 days, subject to the
690
+ # [data retention exceptions](/api/docs/guides/your-data#v1responses).
685
691
  store: nil,
686
692
 
687
693
  # Options for streaming responses. Only set this when you set `stream: true`.
@@ -956,6 +956,17 @@ module OpenAI
956
956
  sig { returns(Symbol) }
957
957
  attr_accessor :type
958
958
 
959
+ # The quality of the image generated by the image generation tool call. One of
960
+ # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
961
+ sig { returns(T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::OrSymbol)) }
962
+ attr_accessor :quality
963
+
964
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
965
+ sig {
966
+ returns(T.nilable(T.any(String, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::OrSymbol)))
967
+ }
968
+ attr_accessor :size
969
+
959
970
  # An image generation request made by the model.
960
971
  sig do
961
972
  params(
@@ -966,6 +977,10 @@ module OpenAI
966
977
 
967
978
  status: OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Status::OrSymbol,
968
979
 
980
+ quality: T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::OrSymbol),
981
+
982
+ size: T.nilable(T.any(String, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::OrSymbol)),
983
+
969
984
  type: Symbol
970
985
  )
971
986
  .returns(T.attached_class)
@@ -981,6 +996,13 @@ module OpenAI
981
996
  # The status of the image generation call.
982
997
  status:,
983
998
 
999
+ # The quality of the image generated by the image generation tool call. One of
1000
+ # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
1001
+ quality: nil,
1002
+
1003
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
1004
+ size: nil,
1005
+
984
1006
  # The type of the image generation call. Always `image_generation_call`.
985
1007
 
986
1008
  type: :image_generation_call
@@ -993,7 +1015,11 @@ module OpenAI
993
1015
  id: String,
994
1016
  result: T.nilable(String),
995
1017
  status: OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Status::OrSymbol,
996
- type: Symbol
1018
+ type: Symbol,
1019
+ quality: T.nilable(OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::OrSymbol),
1020
+ size: T.nilable(
1021
+ T.any(String, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::OrSymbol)
1022
+ )
997
1023
  }
998
1024
  )
999
1025
  end
@@ -1031,6 +1057,67 @@ module OpenAI
1031
1057
  def self.values
1032
1058
  end
1033
1059
  end
1060
+
1061
+ # The quality of the image generated by the image generation tool call. One of
1062
+ # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
1063
+ module Quality
1064
+ extend OpenAI::Internal::Type::Enum
1065
+
1066
+ TaggedSymbol = T.type_alias {
1067
+ T.all(Symbol, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality)
1068
+ }
1069
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1070
+
1071
+ LOW = T.let(:low, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::TaggedSymbol)
1072
+ MEDIUM = T.let(:medium, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::TaggedSymbol)
1073
+ HIGH = T.let(:high, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::TaggedSymbol)
1074
+ XHIGH = T.let(:xhigh, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::TaggedSymbol)
1075
+ MAX = T.let(:max, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::TaggedSymbol)
1076
+ AUTO = T.let(:auto, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::TaggedSymbol)
1077
+
1078
+ sig {
1079
+ override.returns(
1080
+ T::Array[OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Quality::TaggedSymbol]
1081
+ )
1082
+ }
1083
+ def self.values
1084
+ end
1085
+ end
1086
+
1087
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
1088
+ module Size
1089
+ extend OpenAI::Internal::Type::Union
1090
+
1091
+ Variants = T.type_alias {
1092
+ T.any(String, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::TaggedSymbol)
1093
+ }
1094
+
1095
+ sig {
1096
+ override.returns(T::Array[OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::Variants])
1097
+ }
1098
+ def self.variants
1099
+ end
1100
+
1101
+ TaggedSymbol = T.type_alias do
1102
+ T.all(Symbol, OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size)
1103
+ end
1104
+
1105
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1106
+
1107
+ SIZE_1024X1024 = T.let(
1108
+ :"1024x1024",
1109
+ OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::TaggedSymbol
1110
+ )
1111
+ SIZE_1024X1536 = T.let(
1112
+ :"1024x1536",
1113
+ OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::TaggedSymbol
1114
+ )
1115
+ SIZE_1536X1024 = T.let(
1116
+ :"1536x1024",
1117
+ OpenAI::Responses::ResponseInputItem::ImageGenerationCall::Size::TaggedSymbol
1118
+ )
1119
+
1120
+ end
1034
1121
  end
1035
1122
 
1036
1123
  class LocalShellCall < OpenAI::Internal::Type::BaseModel
@@ -342,6 +342,15 @@ module OpenAI
342
342
  sig { returns(Symbol) }
343
343
  attr_accessor :type
344
344
 
345
+ # The quality of the image generated by the image generation tool call. One of
346
+ # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
347
+ sig { returns(T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol)) }
348
+ attr_accessor :quality
349
+
350
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
351
+ sig { returns(T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::Variants)) }
352
+ attr_accessor :size
353
+
345
354
  # An image generation request made by the model.
346
355
  sig do
347
356
  params(
@@ -352,6 +361,10 @@ module OpenAI
352
361
 
353
362
  status: OpenAI::Responses::ResponseItem::ImageGenerationCall::Status::OrSymbol,
354
363
 
364
+ quality: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::OrSymbol),
365
+
366
+ size: T.nilable(T.any(String, OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::OrSymbol)),
367
+
355
368
  type: Symbol
356
369
  )
357
370
  .returns(T.attached_class)
@@ -367,6 +380,13 @@ module OpenAI
367
380
  # The status of the image generation call.
368
381
  status:,
369
382
 
383
+ # The quality of the image generated by the image generation tool call. One of
384
+ # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
385
+ quality: nil,
386
+
387
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
388
+ size: nil,
389
+
370
390
  # The type of the image generation call. Always `image_generation_call`.
371
391
 
372
392
  type: :image_generation_call
@@ -379,7 +399,9 @@ module OpenAI
379
399
  id: String,
380
400
  result: T.nilable(String),
381
401
  status: OpenAI::Responses::ResponseItem::ImageGenerationCall::Status::TaggedSymbol,
382
- type: Symbol
402
+ type: Symbol,
403
+ quality: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol),
404
+ size: T.nilable(OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::Variants)
383
405
  }
384
406
  )
385
407
  end
@@ -407,6 +429,63 @@ module OpenAI
407
429
  def self.values
408
430
  end
409
431
  end
432
+
433
+ # The quality of the image generated by the image generation tool call. One of
434
+ # `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
435
+ module Quality
436
+ extend OpenAI::Internal::Type::Enum
437
+
438
+ TaggedSymbol = T.type_alias {
439
+ T.all(Symbol, OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality)
440
+ }
441
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
442
+
443
+ LOW = T.let(:low, OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol)
444
+ MEDIUM = T.let(:medium, OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol)
445
+ HIGH = T.let(:high, OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol)
446
+ XHIGH = T.let(:xhigh, OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol)
447
+ MAX = T.let(:max, OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol)
448
+ AUTO = T.let(:auto, OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol)
449
+
450
+ sig {
451
+ override.returns(T::Array[OpenAI::Responses::ResponseItem::ImageGenerationCall::Quality::TaggedSymbol])
452
+ }
453
+ def self.values
454
+ end
455
+ end
456
+
457
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
458
+ module Size
459
+ extend OpenAI::Internal::Type::Union
460
+
461
+ Variants = T.type_alias {
462
+ T.any(String, OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::TaggedSymbol)
463
+ }
464
+
465
+ sig { override.returns(T::Array[OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::Variants]) }
466
+ def self.variants
467
+ end
468
+
469
+ TaggedSymbol = T.type_alias do
470
+ T.all(Symbol, OpenAI::Responses::ResponseItem::ImageGenerationCall::Size)
471
+ end
472
+
473
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
474
+
475
+ SIZE_1024X1024 = T.let(
476
+ :"1024x1024",
477
+ OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::TaggedSymbol
478
+ )
479
+ SIZE_1024X1536 = T.let(
480
+ :"1024x1536",
481
+ OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::TaggedSymbol
482
+ )
483
+ SIZE_1536X1024 = T.let(
484
+ :"1536x1024",
485
+ OpenAI::Responses::ResponseItem::ImageGenerationCall::Size::TaggedSymbol
486
+ )
487
+
488
+ end
410
489
  end
411
490
 
412
491
  class LocalShellCall < OpenAI::Internal::Type::BaseModel