enum

OpenAI::CreateImageRequestSize

Inherits Enum < Comparable < Value < Object

The size of the generated images. Must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default value) for gpt-image-1, one of 256x256, 512x512, or 1024x1024 for dall-e-2, and one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3.

Constants

Auto = 0
N1024X1024 = 1
N1536X1024 = 2
N1024X1536 = 3
N256X256 = 4
N512X512 = 5
N1792X1024 = 6
N1024X1792 = 7

Constructors

new(pull : JSON::PullParser) : self
Source

Instance methods

auto?

Returns true if this enum value equals Auto

Source
n1024_x1024?

Returns true if this enum value equals N1024X1024

Source
n1024_x1536?

Returns true if this enum value equals N1024X1536

Source
n1024_x1792?

Returns true if this enum value equals N1024X1792

Source
n1536_x1024?

Returns true if this enum value equals N1536X1024

Source
n1792_x1024?

Returns true if this enum value equals N1792X1024

Source
n256_x256?

Returns true if this enum value equals N256X256

Source
n512_x512?

Returns true if this enum value equals N512X512

Source
to_json(json : JSON::Builder) : Nil

Serializes this enum member by name.

For non-flags enums, the serialization is a JSON string. The value is the member name (see #to_s) transformed with String#underscore.

enum Stages
  INITIAL
  SECOND_STAGE
end

Stages::INITIAL.to_json      # => %("initial")
Stages::SECOND_STAGE.to_json # => %("second_stage")

For flags enums, the serialization is a JSON array including every flagged member individually serialized in the same way as a member of a non-flags enum. None is serialized as an empty array, All as an array containing all members.

@[Flags]
enum Sides
  LEFT
  RIGHT
end

Sides::LEFT.to_json                  # => %(["left"])
(Sides::LEFT | Sides::RIGHT).to_json # => %(["left","right"])
Sides::All.to_json                   # => %(["left","right"])
Sides::None.to_json                  # => %([])

ValueConverter.to_json offers a different serialization strategy based on the member value.

Source