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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +10 -1
- data/examples/audio/record_and_play.rb +19 -0
- data/examples/responses/websocket_workflows.rb +159 -0
- data/lib/openai/helpers/local_audio/errors.rb +27 -0
- data/lib/openai/helpers/local_audio/process.rb +158 -0
- data/lib/openai/helpers/local_audio.rb +157 -0
- data/lib/openai/helpers/realtime/connection.rb +20 -2
- data/lib/openai/helpers/realtime/errors.rb +18 -0
- data/lib/openai/helpers/realtime/recovery.rb +489 -0
- data/lib/openai/helpers/realtime/resources/realtime_extension.rb +26 -1
- data/lib/openai/helpers/realtime.rb +1 -0
- data/lib/openai/models/beta/beta_response_input_item.rb +84 -1
- data/lib/openai/models/beta/beta_response_item.rb +72 -1
- data/lib/openai/models/beta/beta_response_output_item.rb +84 -1
- data/lib/openai/models/beta/beta_responses_client_event.rb +3 -0
- data/lib/openai/models/beta/beta_tool.rb +69 -37
- data/lib/openai/models/beta/response_create_params.rb +3 -0
- data/lib/openai/models/conversations/conversation_item.rb +82 -1
- data/lib/openai/models/image_edit_completed_event.rb +34 -8
- data/lib/openai/models/image_edit_params.rb +64 -44
- data/lib/openai/models/image_edit_partial_image_event.rb +34 -8
- data/lib/openai/models/image_gen_completed_event.rb +34 -8
- data/lib/openai/models/image_gen_partial_image_event.rb +34 -8
- data/lib/openai/models/image_generate_params.rb +51 -35
- data/lib/openai/models/image_model.rb +4 -0
- data/lib/openai/models/images_response.rb +37 -13
- data/lib/openai/models/responses/response_create_params.rb +3 -0
- data/lib/openai/models/responses/response_input_item.rb +84 -1
- data/lib/openai/models/responses/response_item.rb +72 -1
- data/lib/openai/models/responses/response_output_item.rb +84 -1
- data/lib/openai/models/responses/responses_client_event.rb +3 -0
- data/lib/openai/models/responses/tool.rb +69 -37
- data/lib/openai/models/webhooks/live_call_incoming_webhook_event.rb +3 -3
- data/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb +5 -3
- data/lib/openai/resources/images.rb +12 -14
- data/lib/openai/version.rb +1 -1
- data/local-audio.md +146 -0
- data/rbi/openai/helpers/local_audio/interface.rbi +110 -0
- data/rbi/openai/helpers/realtime/connection.rbi +18 -2
- data/rbi/openai/helpers/realtime/extensions.rbi +8 -0
- data/rbi/openai/helpers/realtime/recovery.rbi +27 -0
- data/rbi/openai/models/beta/beta_response_input_item.rbi +86 -1
- data/rbi/openai/models/beta/beta_response_item.rbi +78 -1
- data/rbi/openai/models/beta/beta_response_output_item.rbi +84 -1
- data/rbi/openai/models/beta/beta_responses_client_event.rbi +6 -0
- data/rbi/openai/models/beta/beta_tool.rbi +90 -51
- data/rbi/openai/models/beta/response_create_params.rbi +6 -0
- data/rbi/openai/models/conversations/conversation_item.rbi +88 -1
- data/rbi/openai/models/image_edit_completed_event.rbi +20 -9
- data/rbi/openai/models/image_edit_params.rbi +89 -60
- data/rbi/openai/models/image_edit_partial_image_event.rbi +20 -9
- data/rbi/openai/models/image_gen_completed_event.rbi +20 -9
- data/rbi/openai/models/image_gen_partial_image_event.rbi +20 -9
- data/rbi/openai/models/image_generate_params.rbi +71 -48
- data/rbi/openai/models/image_model.rbi +4 -0
- data/rbi/openai/models/images_response.rbi +27 -16
- data/rbi/openai/models/responses/response_create_params.rbi +6 -0
- data/rbi/openai/models/responses/response_input_item.rbi +88 -1
- data/rbi/openai/models/responses/response_item.rbi +80 -1
- data/rbi/openai/models/responses/response_output_item.rbi +84 -1
- data/rbi/openai/models/responses/responses_client_event.rbi +6 -0
- data/rbi/openai/models/responses/tool.rbi +90 -51
- data/rbi/openai/models/webhooks/live_call_incoming_webhook_event.rbi +4 -4
- data/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi +8 -4
- data/rbi/openai/resources/beta/responses.rbi +6 -2
- data/rbi/openai/resources/images.rbi +106 -76
- data/rbi/openai/resources/responses.rbi +6 -0
- data/realtime.md +101 -0
- data/responses-websocket.md +182 -0
- data/sig/openai/helpers/local_audio/interface.rbs +62 -0
- data/sig/openai/helpers/realtime/connection.rbs +9 -1
- data/sig/openai/helpers/realtime/extensions.rbs +4 -0
- data/sig/openai/helpers/realtime/recovery.rbs +19 -0
- data/sig/openai/models/beta/beta_response_input_item.rbs +39 -2
- data/sig/openai/models/beta/beta_response_item.rbs +39 -2
- data/sig/openai/models/beta/beta_response_output_item.rbs +39 -2
- data/sig/openai/models/beta/beta_tool.rbs +11 -1
- data/sig/openai/models/conversations/conversation_item.rbs +39 -2
- data/sig/openai/models/image_edit_completed_event.rbs +11 -4
- data/sig/openai/models/image_edit_params.rbs +3 -1
- data/sig/openai/models/image_edit_partial_image_event.rbs +11 -4
- data/sig/openai/models/image_gen_completed_event.rbs +11 -4
- data/sig/openai/models/image_gen_partial_image_event.rbs +11 -4
- data/sig/openai/models/image_generate_params.rbs +4 -1
- data/sig/openai/models/image_model.rbs +8 -0
- data/sig/openai/models/images_response.rbs +10 -4
- data/sig/openai/models/responses/response_input_item.rbs +39 -2
- data/sig/openai/models/responses/response_item.rbs +39 -2
- data/sig/openai/models/responses/response_output_item.rbs +39 -2
- data/sig/openai/models/responses/tool.rbs +11 -1
- metadata +15 -1
|
@@ -803,7 +803,26 @@ module OpenAI
|
|
|
803
803
|
# @return [OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Agent, nil]
|
|
804
804
|
optional :agent, -> { OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Agent }, nil?: true
|
|
805
805
|
|
|
806
|
-
# @!
|
|
806
|
+
# @!attribute quality
|
|
807
|
+
# The quality of the image generated by the image generation tool call. One of
|
|
808
|
+
# `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
809
|
+
#
|
|
810
|
+
# @return [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Quality, nil]
|
|
811
|
+
optional(
|
|
812
|
+
:quality,
|
|
813
|
+
enum: -> {
|
|
814
|
+
OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Quality
|
|
815
|
+
},
|
|
816
|
+
nil?: true
|
|
817
|
+
)
|
|
818
|
+
|
|
819
|
+
# @!attribute size
|
|
820
|
+
# The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
821
|
+
#
|
|
822
|
+
# @return [String, Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Size, nil]
|
|
823
|
+
optional :size, union: -> { OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Size }, nil?: true
|
|
824
|
+
|
|
825
|
+
# @!method initialize(id:, result:, status:, agent: nil, quality: nil, size: nil, type: :image_generation_call)
|
|
807
826
|
# Some parameter documentations has been truncated, see
|
|
808
827
|
# {OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall} for more details.
|
|
809
828
|
#
|
|
@@ -817,6 +836,10 @@ module OpenAI
|
|
|
817
836
|
#
|
|
818
837
|
# @param agent [OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Agent, nil] The agent that produced this item.
|
|
819
838
|
#
|
|
839
|
+
# @param quality [Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Quality, nil] The quality of the image generated by the image generation tool call. One of `lo
|
|
840
|
+
#
|
|
841
|
+
# @param size [String, Symbol, OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Size, nil] The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
842
|
+
#
|
|
820
843
|
# @param type [Symbol, :image_generation_call] The type of the image generation call. Always `image_generation_call`.
|
|
821
844
|
|
|
822
845
|
# The status of the image generation call.
|
|
@@ -847,6 +870,54 @@ module OpenAI
|
|
|
847
870
|
#
|
|
848
871
|
# @param agent_name [String] The canonical name of the agent that produced this item.
|
|
849
872
|
end
|
|
873
|
+
|
|
874
|
+
# The quality of the image generated by the image generation tool call. One of
|
|
875
|
+
# `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
876
|
+
#
|
|
877
|
+
# @see OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall#quality
|
|
878
|
+
module Quality
|
|
879
|
+
extend OpenAI::Internal::Type::Enum
|
|
880
|
+
|
|
881
|
+
LOW = :low
|
|
882
|
+
MEDIUM = :medium
|
|
883
|
+
HIGH = :high
|
|
884
|
+
XHIGH = :xhigh
|
|
885
|
+
MAX = :max
|
|
886
|
+
AUTO = :auto
|
|
887
|
+
|
|
888
|
+
# @!method self.values
|
|
889
|
+
# @return [Array<Symbol>]
|
|
890
|
+
end
|
|
891
|
+
|
|
892
|
+
# The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
893
|
+
#
|
|
894
|
+
# @see OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall#size
|
|
895
|
+
module Size
|
|
896
|
+
extend OpenAI::Internal::Type::Union
|
|
897
|
+
|
|
898
|
+
variant String
|
|
899
|
+
|
|
900
|
+
variant const: -> { OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Size::SIZE_1024X1024 }
|
|
901
|
+
|
|
902
|
+
variant const: -> { OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Size::SIZE_1024X1536 }
|
|
903
|
+
|
|
904
|
+
variant const: -> { OpenAI::Models::Beta::BetaResponseItem::ImageGenerationCall::Size::SIZE_1536X1024 }
|
|
905
|
+
|
|
906
|
+
# @!method self.variants
|
|
907
|
+
# @return [Array(String, Symbol)]
|
|
908
|
+
|
|
909
|
+
define_sorbet_constant!(:Variants) do
|
|
910
|
+
T.type_alias { T.any(String, OpenAI::Beta::BetaResponseItem::ImageGenerationCall::Size::TaggedSymbol) }
|
|
911
|
+
end
|
|
912
|
+
|
|
913
|
+
# @!group
|
|
914
|
+
|
|
915
|
+
SIZE_1024X1024 = :"1024x1024"
|
|
916
|
+
SIZE_1024X1536 = :"1024x1536"
|
|
917
|
+
SIZE_1536X1024 = :"1536x1024"
|
|
918
|
+
|
|
919
|
+
# @!endgroup
|
|
920
|
+
end
|
|
850
921
|
end
|
|
851
922
|
|
|
852
923
|
class LocalShellCall < OpenAI::Internal::Type::BaseModel
|
|
@@ -802,7 +802,30 @@ module OpenAI
|
|
|
802
802
|
# @return [OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent, nil]
|
|
803
803
|
optional :agent, -> { OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent }, nil?: true
|
|
804
804
|
|
|
805
|
-
# @!
|
|
805
|
+
# @!attribute quality
|
|
806
|
+
# The quality of the image generated by the image generation tool call. One of
|
|
807
|
+
# `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
808
|
+
#
|
|
809
|
+
# @return [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Quality, nil]
|
|
810
|
+
optional(
|
|
811
|
+
:quality,
|
|
812
|
+
enum: -> { OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Quality },
|
|
813
|
+
nil?: true
|
|
814
|
+
)
|
|
815
|
+
|
|
816
|
+
# @!attribute size
|
|
817
|
+
# The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
818
|
+
#
|
|
819
|
+
# @return [String, Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Size, nil]
|
|
820
|
+
optional(
|
|
821
|
+
:size,
|
|
822
|
+
union: -> {
|
|
823
|
+
OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Size
|
|
824
|
+
},
|
|
825
|
+
nil?: true
|
|
826
|
+
)
|
|
827
|
+
|
|
828
|
+
# @!method initialize(id:, result:, status:, agent: nil, quality: nil, size: nil, type: :image_generation_call)
|
|
806
829
|
# Some parameter documentations has been truncated, see
|
|
807
830
|
# {OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall} for more
|
|
808
831
|
# details.
|
|
@@ -817,6 +840,10 @@ module OpenAI
|
|
|
817
840
|
#
|
|
818
841
|
# @param agent [OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Agent, nil] The agent that produced this item.
|
|
819
842
|
#
|
|
843
|
+
# @param quality [Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Quality, nil] The quality of the image generated by the image generation tool call. One of `lo
|
|
844
|
+
#
|
|
845
|
+
# @param size [String, Symbol, OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Size, nil] The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
846
|
+
#
|
|
820
847
|
# @param type [Symbol, :image_generation_call] The type of the image generation call. Always `image_generation_call`.
|
|
821
848
|
|
|
822
849
|
# The status of the image generation call.
|
|
@@ -847,6 +874,62 @@ module OpenAI
|
|
|
847
874
|
#
|
|
848
875
|
# @param agent_name [String] The canonical name of the agent that produced this item.
|
|
849
876
|
end
|
|
877
|
+
|
|
878
|
+
# The quality of the image generated by the image generation tool call. One of
|
|
879
|
+
# `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
880
|
+
#
|
|
881
|
+
# @see OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall#quality
|
|
882
|
+
module Quality
|
|
883
|
+
extend OpenAI::Internal::Type::Enum
|
|
884
|
+
|
|
885
|
+
LOW = :low
|
|
886
|
+
MEDIUM = :medium
|
|
887
|
+
HIGH = :high
|
|
888
|
+
XHIGH = :xhigh
|
|
889
|
+
MAX = :max
|
|
890
|
+
AUTO = :auto
|
|
891
|
+
|
|
892
|
+
# @!method self.values
|
|
893
|
+
# @return [Array<Symbol>]
|
|
894
|
+
end
|
|
895
|
+
|
|
896
|
+
# The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
897
|
+
#
|
|
898
|
+
# @see OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall#size
|
|
899
|
+
module Size
|
|
900
|
+
extend OpenAI::Internal::Type::Union
|
|
901
|
+
|
|
902
|
+
variant String
|
|
903
|
+
|
|
904
|
+
variant(
|
|
905
|
+
const: -> { OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Size::SIZE_1024X1024 }
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
variant(
|
|
909
|
+
const: -> { OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Size::SIZE_1024X1536 }
|
|
910
|
+
)
|
|
911
|
+
|
|
912
|
+
variant(
|
|
913
|
+
const: -> { OpenAI::Models::Beta::BetaResponseOutputItem::ImageGenerationCall::Size::SIZE_1536X1024 }
|
|
914
|
+
)
|
|
915
|
+
|
|
916
|
+
# @!method self.variants
|
|
917
|
+
# @return [Array(String, Symbol)]
|
|
918
|
+
|
|
919
|
+
define_sorbet_constant!(:Variants) do
|
|
920
|
+
T.type_alias {
|
|
921
|
+
T.any(String, OpenAI::Beta::BetaResponseOutputItem::ImageGenerationCall::Size::TaggedSymbol)
|
|
922
|
+
}
|
|
923
|
+
end
|
|
924
|
+
|
|
925
|
+
# @!group
|
|
926
|
+
|
|
927
|
+
SIZE_1024X1024 = :"1024x1024"
|
|
928
|
+
SIZE_1024X1536 = :"1024x1536"
|
|
929
|
+
SIZE_1536X1024 = :"1536x1024"
|
|
930
|
+
|
|
931
|
+
# @!endgroup
|
|
932
|
+
end
|
|
850
933
|
end
|
|
851
934
|
|
|
852
935
|
class LocalShellCall < OpenAI::Internal::Type::BaseModel
|
|
@@ -336,6 +336,9 @@ module OpenAI
|
|
|
336
336
|
|
|
337
337
|
# @!attribute store
|
|
338
338
|
# Whether to store the generated model response for later retrieval via API.
|
|
339
|
+
# Defaults to true when omitted. If set to true, response data will be stored for
|
|
340
|
+
# at least 30 days, subject to the
|
|
341
|
+
# [data retention exceptions](/api/docs/guides/your-data#v1responses).
|
|
339
342
|
#
|
|
340
343
|
# @return [Boolean, nil]
|
|
341
344
|
optional :store, OpenAI::Internal::Type::Boolean, nil?: true
|
|
@@ -571,9 +571,11 @@ module OpenAI
|
|
|
571
571
|
# one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
|
|
572
572
|
# the model will automatically determine the best background for the image.
|
|
573
573
|
#
|
|
574
|
-
#
|
|
575
|
-
# `
|
|
576
|
-
#
|
|
574
|
+
# `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
|
|
575
|
+
# snapshots, support `opaque` and `transparent` backgrounds. Transparent
|
|
576
|
+
# backgrounds are available for supported GPT Image models. For `gpt-image-2` and
|
|
577
|
+
# `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
|
|
578
|
+
# set the output format to `png` or `webp`.
|
|
577
579
|
#
|
|
578
580
|
# @return [Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Background, nil]
|
|
579
581
|
optional :background, enum: -> { OpenAI::Beta::BetaTool::ImageGeneration::Background }
|
|
@@ -602,7 +604,9 @@ module OpenAI
|
|
|
602
604
|
|
|
603
605
|
# @!attribute model
|
|
604
606
|
# The image generation model to use. One of `gpt-image-1`, `gpt-image-1-mini`,
|
|
605
|
-
# `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
607
|
+
# `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
608
|
+
# `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
|
|
609
|
+
# `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
|
|
606
610
|
# `chatgpt-image-latest`. Default: `gpt-image-1`.
|
|
607
611
|
#
|
|
608
612
|
# @return [String, Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Model, nil]
|
|
@@ -635,24 +639,27 @@ module OpenAI
|
|
|
635
639
|
optional :partial_images, Integer
|
|
636
640
|
|
|
637
641
|
# @!attribute quality
|
|
638
|
-
# The quality of the generated image.
|
|
639
|
-
#
|
|
642
|
+
# The quality of the generated image. The GPT image models support `low`,
|
|
643
|
+
# `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
|
|
644
|
+
# including their `2026-09-08` snapshots, also support `xhigh` and `max`. Default:
|
|
645
|
+
# `auto`.
|
|
640
646
|
#
|
|
641
647
|
# @return [Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Quality, nil]
|
|
642
648
|
optional :quality, enum: -> { OpenAI::Beta::BetaTool::ImageGeneration::Quality }
|
|
643
649
|
|
|
644
650
|
# @!attribute size
|
|
645
|
-
# The size of the generated images. For `gpt-image-2`
|
|
646
|
-
# `gpt-image-2-2026-
|
|
647
|
-
#
|
|
648
|
-
#
|
|
649
|
-
#
|
|
650
|
-
#
|
|
651
|
-
#
|
|
652
|
-
#
|
|
653
|
-
#
|
|
654
|
-
# `
|
|
655
|
-
# `
|
|
651
|
+
# The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
652
|
+
# `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
|
|
653
|
+
# `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
|
|
654
|
+
# resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
|
|
655
|
+
# Width and height must both be divisible by 16 and the requested aspect ratio
|
|
656
|
+
# must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
|
|
657
|
+
# the maximum supported resolution is `3840x2160`. The requested size must also
|
|
658
|
+
# satisfy the model's current pixel and edge limits. The standard sizes
|
|
659
|
+
# `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
|
|
660
|
+
# `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
|
|
661
|
+
# one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
|
|
662
|
+
# `1024x1024`, `1792x1024`, or `1024x1792`.
|
|
656
663
|
#
|
|
657
664
|
# @return [String, Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Size, nil]
|
|
658
665
|
optional :size, union: -> { OpenAI::Beta::BetaTool::ImageGeneration::Size }
|
|
@@ -665,7 +672,7 @@ module OpenAI
|
|
|
665
672
|
#
|
|
666
673
|
# @param action [Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Action] Whether to generate a new image or edit an existing image. Default: `auto`.
|
|
667
674
|
#
|
|
668
|
-
# @param background [Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Background] Allows to set transparency for the background of the generated image(s).
|
|
675
|
+
# @param background [Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Background] Allows to set transparency for the background of the generated image(s). Must
|
|
669
676
|
#
|
|
670
677
|
# @param input_fidelity [Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::InputFidelity, nil] Control how much effort the model will exert to match the style and features, es
|
|
671
678
|
#
|
|
@@ -681,9 +688,9 @@ module OpenAI
|
|
|
681
688
|
#
|
|
682
689
|
# @param partial_images [Integer] Number of partial images to generate in streaming mode, from 0 (default value) t
|
|
683
690
|
#
|
|
684
|
-
# @param quality [Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Quality] The quality of the generated image.
|
|
691
|
+
# @param quality [Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Quality] The quality of the generated image. The GPT image models support `low`,
|
|
685
692
|
#
|
|
686
|
-
# @param size [String, Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Size] The size of the generated images. For `gpt-image-2
|
|
693
|
+
# @param size [String, Symbol, OpenAI::Models::Beta::BetaTool::ImageGeneration::Size] The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `
|
|
687
694
|
#
|
|
688
695
|
# @param type [Symbol, :image_generation] The type of the image generation tool. Always `image_generation`.
|
|
689
696
|
|
|
@@ -705,9 +712,11 @@ module OpenAI
|
|
|
705
712
|
# one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
|
|
706
713
|
# the model will automatically determine the best background for the image.
|
|
707
714
|
#
|
|
708
|
-
#
|
|
709
|
-
# `
|
|
710
|
-
#
|
|
715
|
+
# `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
|
|
716
|
+
# snapshots, support `opaque` and `transparent` backgrounds. Transparent
|
|
717
|
+
# backgrounds are available for supported GPT Image models. For `gpt-image-2` and
|
|
718
|
+
# `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
|
|
719
|
+
# set the output format to `png` or `webp`.
|
|
711
720
|
#
|
|
712
721
|
# @see OpenAI::Models::Beta::BetaTool::ImageGeneration#background
|
|
713
722
|
module Background
|
|
@@ -765,7 +774,9 @@ module OpenAI
|
|
|
765
774
|
end
|
|
766
775
|
|
|
767
776
|
# The image generation model to use. One of `gpt-image-1`, `gpt-image-1-mini`,
|
|
768
|
-
# `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
777
|
+
# `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
778
|
+
# `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
|
|
779
|
+
# `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
|
|
769
780
|
# `chatgpt-image-latest`. Default: `gpt-image-1`.
|
|
770
781
|
#
|
|
771
782
|
# @see OpenAI::Models::Beta::BetaTool::ImageGeneration#model
|
|
@@ -782,6 +793,18 @@ module OpenAI
|
|
|
782
793
|
|
|
783
794
|
variant const: -> { OpenAI::Models::Beta::BetaTool::ImageGeneration::Model::GPT_IMAGE_2_2026_04_21 }
|
|
784
795
|
|
|
796
|
+
variant const: -> { OpenAI::Models::Beta::BetaTool::ImageGeneration::Model::GPT_IMAGE_2_5_SUNBURST }
|
|
797
|
+
|
|
798
|
+
variant(
|
|
799
|
+
const: -> { OpenAI::Models::Beta::BetaTool::ImageGeneration::Model::GPT_IMAGE_2_5_SUNBURST_2026_09_08 }
|
|
800
|
+
)
|
|
801
|
+
|
|
802
|
+
variant const: -> { OpenAI::Models::Beta::BetaTool::ImageGeneration::Model::GPT_IMAGE_2_5_FLARE }
|
|
803
|
+
|
|
804
|
+
variant(
|
|
805
|
+
const: -> { OpenAI::Models::Beta::BetaTool::ImageGeneration::Model::GPT_IMAGE_2_5_FLARE_2026_09_08 }
|
|
806
|
+
)
|
|
807
|
+
|
|
785
808
|
variant const: -> { OpenAI::Models::Beta::BetaTool::ImageGeneration::Model::GPT_IMAGE_1_5 }
|
|
786
809
|
|
|
787
810
|
variant const: -> { OpenAI::Models::Beta::BetaTool::ImageGeneration::Model::CHATGPT_IMAGE_LATEST }
|
|
@@ -799,6 +822,10 @@ module OpenAI
|
|
|
799
822
|
GPT_IMAGE_1_MINI = :"gpt-image-1-mini"
|
|
800
823
|
GPT_IMAGE_2 = :"gpt-image-2"
|
|
801
824
|
GPT_IMAGE_2_2026_04_21 = :"gpt-image-2-2026-04-21"
|
|
825
|
+
GPT_IMAGE_2_5_SUNBURST = :"gpt-image-2.5-sunburst"
|
|
826
|
+
GPT_IMAGE_2_5_SUNBURST_2026_09_08 = :"gpt-image-2.5-sunburst-2026-09-08"
|
|
827
|
+
GPT_IMAGE_2_5_FLARE = :"gpt-image-2.5-flare"
|
|
828
|
+
GPT_IMAGE_2_5_FLARE_2026_09_08 = :"gpt-image-2.5-flare-2026-09-08"
|
|
802
829
|
GPT_IMAGE_1_5 = :"gpt-image-1.5"
|
|
803
830
|
CHATGPT_IMAGE_LATEST = :"chatgpt-image-latest"
|
|
804
831
|
|
|
@@ -833,8 +860,10 @@ module OpenAI
|
|
|
833
860
|
# @return [Array<Symbol>]
|
|
834
861
|
end
|
|
835
862
|
|
|
836
|
-
# The quality of the generated image.
|
|
837
|
-
#
|
|
863
|
+
# The quality of the generated image. The GPT image models support `low`,
|
|
864
|
+
# `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`,
|
|
865
|
+
# including their `2026-09-08` snapshots, also support `xhigh` and `max`. Default:
|
|
866
|
+
# `auto`.
|
|
838
867
|
#
|
|
839
868
|
# @see OpenAI::Models::Beta::BetaTool::ImageGeneration#quality
|
|
840
869
|
module Quality
|
|
@@ -843,23 +872,26 @@ module OpenAI
|
|
|
843
872
|
LOW = :low
|
|
844
873
|
MEDIUM = :medium
|
|
845
874
|
HIGH = :high
|
|
875
|
+
XHIGH = :xhigh
|
|
876
|
+
MAX = :max
|
|
846
877
|
AUTO = :auto
|
|
847
878
|
|
|
848
879
|
# @!method self.values
|
|
849
880
|
# @return [Array<Symbol>]
|
|
850
881
|
end
|
|
851
882
|
|
|
852
|
-
# The size of the generated images. For `gpt-image-2`
|
|
853
|
-
# `gpt-image-2-2026-
|
|
854
|
-
#
|
|
855
|
-
#
|
|
856
|
-
#
|
|
857
|
-
#
|
|
858
|
-
#
|
|
859
|
-
#
|
|
860
|
-
#
|
|
861
|
-
# `
|
|
862
|
-
# `
|
|
883
|
+
# The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
884
|
+
# `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
|
|
885
|
+
# `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
|
|
886
|
+
# resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
|
|
887
|
+
# Width and height must both be divisible by 16 and the requested aspect ratio
|
|
888
|
+
# must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
|
|
889
|
+
# the maximum supported resolution is `3840x2160`. The requested size must also
|
|
890
|
+
# satisfy the model's current pixel and edge limits. The standard sizes
|
|
891
|
+
# `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
|
|
892
|
+
# `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
|
|
893
|
+
# one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
|
|
894
|
+
# `1024x1024`, `1792x1024`, or `1024x1792`.
|
|
863
895
|
#
|
|
864
896
|
# @see OpenAI::Models::Beta::BetaTool::ImageGeneration#size
|
|
865
897
|
module Size
|
|
@@ -260,6 +260,9 @@ module OpenAI
|
|
|
260
260
|
|
|
261
261
|
# @!attribute store
|
|
262
262
|
# Whether to store the generated model response for later retrieval via API.
|
|
263
|
+
# Defaults to true when omitted. If set to true, response data will be stored for
|
|
264
|
+
# at least 30 days, subject to the
|
|
265
|
+
# [data retention exceptions](/api/docs/guides/your-data#v1responses).
|
|
263
266
|
#
|
|
264
267
|
# @return [Boolean, nil]
|
|
265
268
|
optional :store, OpenAI::Internal::Type::Boolean, nil?: true
|
|
@@ -126,7 +126,28 @@ module OpenAI
|
|
|
126
126
|
# @return [Symbol, :image_generation_call]
|
|
127
127
|
required :type, const: :image_generation_call
|
|
128
128
|
|
|
129
|
-
# @!
|
|
129
|
+
# @!attribute quality
|
|
130
|
+
# The quality of the image generated by the image generation tool call. One of
|
|
131
|
+
# `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
132
|
+
#
|
|
133
|
+
# @return [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Quality, nil]
|
|
134
|
+
optional(
|
|
135
|
+
:quality,
|
|
136
|
+
enum: -> { OpenAI::Conversations::ConversationItem::ImageGenerationCall::Quality },
|
|
137
|
+
nil?: true
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
# @!attribute size
|
|
141
|
+
# The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
142
|
+
#
|
|
143
|
+
# @return [String, Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Size, nil]
|
|
144
|
+
optional(
|
|
145
|
+
:size,
|
|
146
|
+
union: -> { OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size },
|
|
147
|
+
nil?: true
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# @!method initialize(id:, result:, status:, quality: nil, size: nil, type: :image_generation_call)
|
|
130
151
|
# Some parameter documentations has been truncated, see
|
|
131
152
|
# {OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall} for more
|
|
132
153
|
# details.
|
|
@@ -139,6 +160,10 @@ module OpenAI
|
|
|
139
160
|
#
|
|
140
161
|
# @param status [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Status] The status of the image generation call.
|
|
141
162
|
#
|
|
163
|
+
# @param quality [Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Quality, nil] The quality of the image generated by the image generation tool call. One of `lo
|
|
164
|
+
#
|
|
165
|
+
# @param size [String, Symbol, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Size, nil] The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
166
|
+
#
|
|
142
167
|
# @param type [Symbol, :image_generation_call] The type of the image generation call. Always `image_generation_call`.
|
|
143
168
|
|
|
144
169
|
# The status of the image generation call.
|
|
@@ -155,6 +180,62 @@ module OpenAI
|
|
|
155
180
|
# @!method self.values
|
|
156
181
|
# @return [Array<Symbol>]
|
|
157
182
|
end
|
|
183
|
+
|
|
184
|
+
# The quality of the image generated by the image generation tool call. One of
|
|
185
|
+
# `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
|
|
186
|
+
#
|
|
187
|
+
# @see OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall#quality
|
|
188
|
+
module Quality
|
|
189
|
+
extend OpenAI::Internal::Type::Enum
|
|
190
|
+
|
|
191
|
+
LOW = :low
|
|
192
|
+
MEDIUM = :medium
|
|
193
|
+
HIGH = :high
|
|
194
|
+
XHIGH = :xhigh
|
|
195
|
+
MAX = :max
|
|
196
|
+
AUTO = :auto
|
|
197
|
+
|
|
198
|
+
# @!method self.values
|
|
199
|
+
# @return [Array<Symbol>]
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
203
|
+
#
|
|
204
|
+
# @see OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall#size
|
|
205
|
+
module Size
|
|
206
|
+
extend OpenAI::Internal::Type::Union
|
|
207
|
+
|
|
208
|
+
variant String
|
|
209
|
+
|
|
210
|
+
variant(
|
|
211
|
+
const: -> { OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Size::SIZE_1024X1024 }
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
variant(
|
|
215
|
+
const: -> { OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Size::SIZE_1024X1536 }
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
variant(
|
|
219
|
+
const: -> { OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall::Size::SIZE_1536X1024 }
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
# @!method self.variants
|
|
223
|
+
# @return [Array(String, Symbol)]
|
|
224
|
+
|
|
225
|
+
define_sorbet_constant!(:Variants) do
|
|
226
|
+
T.type_alias {
|
|
227
|
+
T.any(String, OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size::TaggedSymbol)
|
|
228
|
+
}
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# @!group
|
|
232
|
+
|
|
233
|
+
SIZE_1024X1024 = :"1024x1024"
|
|
234
|
+
SIZE_1024X1536 = :"1024x1536"
|
|
235
|
+
SIZE_1536X1024 = :"1536x1024"
|
|
236
|
+
|
|
237
|
+
# @!endgroup
|
|
238
|
+
end
|
|
158
239
|
end
|
|
159
240
|
|
|
160
241
|
class AdditionalTools < OpenAI::Internal::Type::BaseModel
|
|
@@ -34,10 +34,10 @@ module OpenAI
|
|
|
34
34
|
required :quality, enum: -> { OpenAI::ImageEditCompletedEvent::Quality }
|
|
35
35
|
|
|
36
36
|
# @!attribute size
|
|
37
|
-
# The
|
|
37
|
+
# The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
38
38
|
#
|
|
39
|
-
# @return [Symbol, OpenAI::Models::ImageEditCompletedEvent::Size]
|
|
40
|
-
required :size,
|
|
39
|
+
# @return [String, Symbol, OpenAI::Models::ImageEditCompletedEvent::Size]
|
|
40
|
+
required :size, union: -> { OpenAI::ImageEditCompletedEvent::Size }
|
|
41
41
|
|
|
42
42
|
# @!attribute type
|
|
43
43
|
# The type of the event. Always `image_edit.completed`.
|
|
@@ -68,7 +68,7 @@ module OpenAI
|
|
|
68
68
|
#
|
|
69
69
|
# @param quality [Symbol, OpenAI::Models::ImageEditCompletedEvent::Quality] The quality setting for the edited image.
|
|
70
70
|
#
|
|
71
|
-
# @param size [Symbol, OpenAI::Models::ImageEditCompletedEvent::Size] The
|
|
71
|
+
# @param size [String, Symbol, OpenAI::Models::ImageEditCompletedEvent::Size] The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
72
72
|
#
|
|
73
73
|
# @param usage [OpenAI::Models::ImageEditCompletedEvent::Usage] For the GPT image models only, the token usage information for the image generat
|
|
74
74
|
#
|
|
@@ -111,25 +111,51 @@ module OpenAI
|
|
|
111
111
|
LOW = :low
|
|
112
112
|
MEDIUM = :medium
|
|
113
113
|
HIGH = :high
|
|
114
|
+
XHIGH = :xhigh
|
|
115
|
+
MAX = :max
|
|
114
116
|
AUTO = :auto
|
|
115
117
|
|
|
116
118
|
# @!method self.values
|
|
117
119
|
# @return [Array<Symbol>]
|
|
118
120
|
end
|
|
119
121
|
|
|
120
|
-
# The
|
|
122
|
+
# The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
|
|
121
123
|
#
|
|
122
124
|
# @see OpenAI::Models::ImageEditCompletedEvent#size
|
|
123
125
|
module Size
|
|
124
|
-
extend OpenAI::Internal::Type::
|
|
126
|
+
extend OpenAI::Internal::Type::Union
|
|
127
|
+
|
|
128
|
+
variant const: -> { OpenAI::Models::ImageEditCompletedEvent::Size::SIZE_1024X1024 }
|
|
129
|
+
|
|
130
|
+
variant const: -> { OpenAI::Models::ImageEditCompletedEvent::Size::SIZE_1024X1536 }
|
|
131
|
+
|
|
132
|
+
variant const: -> { OpenAI::Models::ImageEditCompletedEvent::Size::SIZE_1536X1024 }
|
|
133
|
+
|
|
134
|
+
variant const: -> { OpenAI::Models::ImageEditCompletedEvent::Size::AUTO }
|
|
135
|
+
|
|
136
|
+
# Keep known dimensions as symbols when reading existing API responses.
|
|
137
|
+
variant String
|
|
138
|
+
|
|
139
|
+
# @!method self.variants
|
|
140
|
+
# @return [Array(String, Symbol)]
|
|
141
|
+
|
|
142
|
+
define_sorbet_constant!(:Variants) do
|
|
143
|
+
T.type_alias { T.any(String, OpenAI::ImageEditCompletedEvent::Size::TaggedSymbol) }
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# @!group
|
|
125
147
|
|
|
126
148
|
SIZE_1024X1024 = :"1024x1024"
|
|
127
149
|
SIZE_1024X1536 = :"1024x1536"
|
|
128
150
|
SIZE_1536X1024 = :"1536x1024"
|
|
129
151
|
AUTO = :auto
|
|
130
152
|
|
|
131
|
-
# @!
|
|
132
|
-
|
|
153
|
+
# @!endgroup
|
|
154
|
+
|
|
155
|
+
# Preserve the enum helper available before custom dimensions were supported.
|
|
156
|
+
#
|
|
157
|
+
# @return [Array<Symbol>]
|
|
158
|
+
def self.values = [SIZE_1024X1024, SIZE_1024X1536, SIZE_1536X1024, AUTO]
|
|
133
159
|
end
|
|
134
160
|
|
|
135
161
|
# @see OpenAI::Models::ImageEditCompletedEvent#usage
|