Class: OpenAI::Resources::Images
- Inherits:
-
Object
- Object
- OpenAI::Resources::Images
- Defined in:
- lib/openai/resources/images.rb
Instance Method Summary collapse
-
#create_variation(image: , model: nil, n: nil, response_format: nil, size: nil, user: nil, request_options: {}) ⇒ OpenAI::Models::ImagesResponse
Some parameter documentations has been truncated, see Models::ImageCreateVariationParams for more details.
-
#edit(image: , prompt: , background: nil, mask: nil, model: nil, n: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {}) ⇒ OpenAI::Models::ImagesResponse
Some parameter documentations has been truncated, see Models::ImageEditParams for more details.
-
#generate(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: {}) ⇒ OpenAI::Models::ImagesResponse
Some parameter documentations has been truncated, see Models::ImageGenerateParams for more details.
-
#initialize(client:) ⇒ Images
constructor
private
A new instance of Images.
Constructor Details
#initialize(client:) ⇒ Images
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Images.
138 139 140 |
# File 'lib/openai/resources/images.rb', line 138 def initialize(client:) @client = client end |
Instance Method Details
#create_variation(image: , model: nil, n: nil, response_format: nil, size: nil, user: nil, request_options: {}) ⇒ OpenAI::Models::ImagesResponse
Some parameter documentations has been truncated, see Models::ImageCreateVariationParams for more details.
Creates a variation of a given image. This endpoint only supports ‘dall-e-2`.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/openai/resources/images.rb', line 30 def create_variation(params) parsed, = OpenAI::ImageCreateVariationParams.dump_request(params) @client.request( method: :post, path: "images/variations", headers: {"content-type" => "multipart/form-data"}, body: parsed, model: OpenAI::ImagesResponse, options: ) end |
#edit(image: , prompt: , background: nil, mask: nil, model: nil, n: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {}) ⇒ OpenAI::Models::ImagesResponse
Some parameter documentations has been truncated, see Models::ImageEditParams for more details.
Creates an edited or extended image given one or more source images and a prompt. This endpoint only supports ‘gpt-image-1` and `dall-e-2`.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/openai/resources/images.rb', line 75 def edit(params) parsed, = OpenAI::ImageEditParams.dump_request(params) @client.request( method: :post, path: "images/edits", headers: {"content-type" => "multipart/form-data"}, body: parsed, model: OpenAI::ImagesResponse, options: ) end |
#generate(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: {}) ⇒ OpenAI::Models::ImagesResponse
Some parameter documentations has been truncated, see Models::ImageGenerateParams for more details.
Creates an image given a prompt. [Learn more](platform.openai.com/docs/guides/images).
124 125 126 127 128 129 130 131 132 133 |
# File 'lib/openai/resources/images.rb', line 124 def generate(params) parsed, = OpenAI::ImageGenerateParams.dump_request(params) @client.request( method: :post, path: "images/generations", body: parsed, model: OpenAI::ImagesResponse, options: ) end |