Class: RunApi::IdeogramV3::Resources::RemixImage

Inherits:
Object
  • Object
show all
Includes:
Core::ResourceHelpers
Defined in:
lib/runapi/ideogram_v3/resources/remix_image.rb

Overview

Creates a variation of a source image guided by a new text prompt.

Constant Summary collapse

ENDPOINT =
"/api/v1/ideogram_v3/remix_image"
RESPONSE_CLASS =
Types::IdeogramResponse
COMPLETED_RESPONSE_CLASS =
Types::CompletedIdeogramResponse
PROMPT_MAX_LENGTH =
5000
STRENGTH_MIN =
0.01
CHARACTER_REMIX_STRENGTH_MIN =
0.1
STRENGTH_MAX =
1.0

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ RemixImage

Returns a new instance of RemixImage.



18
19
20
# File 'lib/runapi/ideogram_v3/resources/remix_image.rb', line 18

def initialize(http)
  @http = http
end

Instance Method Details

#create(options: nil, **params) ⇒ Object



27
28
29
30
31
# File 'lib/runapi/ideogram_v3/resources/remix_image.rb', line 27

def create(options: nil, **params)
  params = compact_params(params)
  validate_params!(params)
  request(:post, ENDPOINT, body: params, options: options)
end

#get(id, options: nil) ⇒ Object



33
34
35
# File 'lib/runapi/ideogram_v3/resources/remix_image.rb', line 33

def get(id, options: nil)
  request(:get, "#{ENDPOINT}/#{id}", options: options)
end

#run(options: nil, **params) ⇒ Object



22
23
24
25
# File 'lib/runapi/ideogram_v3/resources/remix_image.rb', line 22

def run(options: nil, **params)
  task = create(options: options, **params)
  poll_until_complete { get(task.id, options: options) }
end