Class: OpenAI::Models::ImageCreateVariationParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/openai/models/image_create_variation_params.rb,
sig/openai/models/image_create_variation_params.rbs

Overview

See Also:

  • OpenAI::Resources::Images#create_variation

Defined Under Namespace

Modules: Model, ResponseFormat, Size

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, fields, hash, #hash, inherited, #inspect, inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(image:, model: nil, n: nil, response_format: nil, size: nil, user: nil, request_options: {}) ⇒ ImageCreateVariationParams

Returns a new instance of ImageCreateVariationParams.

Parameters:

  • image —

    The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.

    String, StringIO, and pathless IO inputs are sent with generic upload metadata. Use OpenAI::FilePart when you need to override the filename or content type.

  • model (defaults to: nil) —

    The legacy model used by the retired image variations endpoint. This endpoint no longer accepts requests.

  • n (defaults to: nil) —

    The number of images to generate. Must be between 1 and 10.

  • response_format (defaults to: nil) —

    The format in which the generated images are returned. Must be one of url or b64_json. URLs are only valid for 60 minutes after the image has been generated.

  • size (defaults to: nil) —

    The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.

  • user (defaults to: nil) —

    A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

  • image: (OpenAI::Internal::file_input)
  • model: (OpenAI::Models::ImageCreateVariationParams::model, nil) (defaults to: nil)
  • n: (Integer, nil) (defaults to: nil)
  • response_format: (OpenAI::Models::ImageCreateVariationParams::response_format, nil) (defaults to: nil)
  • size: (OpenAI::Models::ImageCreateVariationParams::size, nil) (defaults to: nil)
  • user: (String) (defaults to: nil)
  • request_options: (OpenAI::request_opts) (defaults to: {})


# File 'lib/openai/models/image_create_variation_params.rb', line 57

Instance Attribute Details

#image ⇒ OpenAI::Internal::file_input

The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.

String, StringIO, and pathless IO inputs are sent with generic upload metadata. Use OpenAI::FilePart when you need to override the filename or content type.

Returns:

  • (OpenAI::Internal::file_input)


19
# File 'lib/openai/models/image_create_variation_params.rb', line 19

required :image, OpenAI::Internal::Type::FileInput

#model ⇒ OpenAI::Models::ImageCreateVariationParams::model?

The legacy model used by the retired image variations endpoint. This endpoint no longer accepts requests.

Returns:

  • (OpenAI::Models::ImageCreateVariationParams::model, nil)


26
# File 'lib/openai/models/image_create_variation_params.rb', line 26

optional :model, union: -> { OpenAI::ImageCreateVariationParams::Model }, nil?: true

#n ⇒ Integer?

The number of images to generate. Must be between 1 and 10.

Returns:

  • (Integer, nil)


32
# File 'lib/openai/models/image_create_variation_params.rb', line 32

optional :n, Integer, nil?: true

#response_format ⇒ OpenAI::Models::ImageCreateVariationParams::response_format?

The format in which the generated images are returned. Must be one of url or b64_json. URLs are only valid for 60 minutes after the image has been generated.

Returns:

  • (OpenAI::Models::ImageCreateVariationParams::response_format, nil)


40
# File 'lib/openai/models/image_create_variation_params.rb', line 40

optional :response_format, enum: -> { OpenAI::ImageCreateVariationParams::ResponseFormat }, nil?: true

#size ⇒ OpenAI::Models::ImageCreateVariationParams::size?

The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.

Returns:

  • (OpenAI::Models::ImageCreateVariationParams::size, nil)


47
# File 'lib/openai/models/image_create_variation_params.rb', line 47

optional :size, enum: -> { OpenAI::ImageCreateVariationParams::Size }, nil?: true

#user ⇒ String?

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

Returns:

  • (String, nil)


55
# File 'lib/openai/models/image_create_variation_params.rb', line 55

optional :user, String

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/image_create_variation_params.rb', line 112

.variants ⇒ Array(String, Symbol, OpenAI::Models::ImageModel)

Returns:



# File 'lib/openai/models/image_create_variation_params.rb', line 99

Instance Method Details

#to_hash ⇒ { image: OpenAI::Internal::file_input, ?model: OpenAI::Models::ImageCreateVariationParams::model?, ?n: Integer?, ?response_format: OpenAI::Models::ImageCreateVariationParams::response_format?, ?size: OpenAI::Models::ImageCreateVariationParams::size?, ?user: String, ?request_options: OpenAI::RequestOptions }

Returns:

  • ({ image: OpenAI::Internal::file_input, ?model: OpenAI::Models::ImageCreateVariationParams::model?, ?n: Integer?, ?response_format: OpenAI::Models::ImageCreateVariationParams::response_format?, ?size: OpenAI::Models::ImageCreateVariationParams::size?, ?user: String, ?request_options: OpenAI::RequestOptions })


85
86
87
88
89
90
91
92
93
# File 'sig/openai/models/image_create_variation_params.rbs', line 85

def to_hash: -> {
  image: OpenAI::Internal::file_input,
  ?model: OpenAI::Models::ImageCreateVariationParams::model?,
  ?n: Integer?,
  ?response_format: OpenAI::Models::ImageCreateVariationParams::response_format?,
  ?size: OpenAI::Models::ImageCreateVariationParams::size?,
  ?user: String,
  ?request_options: OpenAI::RequestOptions
}