Class: RunApi::Qwen2::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/runapi/qwen_2/client.rb

Overview

Qwen2 text-to-image, image-to-image, and edit-image API client.

Examples:

client = RunApi::Qwen2::Client.new(api_key: "your-api-key")
result = client.edit_image.run(
  model: "qwen-2-image-edit",
  prompt: "Replace the background with a neon-lit city skyline",
  image_url: "https://example.com/input.jpg"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, **options) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
24
25
26
# File 'lib/runapi/qwen_2/client.rb', line 18

def initialize(api_key: nil, **options)
  @api_key = Core::Auth.resolve_api_key(api_key)

  client_options = Core::ClientOptions.new(api_key: @api_key, **options)
  http = client_options.http_client || Core::HttpClient.new(client_options)
  @text_to_image = Resources::TextToImage.new(http)
  @image_to_image = Resources::ImageToImage.new(http)
  @edit_image = Resources::EditImage.new(http)
end

Instance Attribute Details

#edit_imageResources::TextToImage, ... (readonly)

Returns Image operations.



16
17
18
# File 'lib/runapi/qwen_2/client.rb', line 16

def edit_image
  @edit_image
end

#image_to_imageResources::TextToImage, ... (readonly)

Returns Image operations.



16
17
18
# File 'lib/runapi/qwen_2/client.rb', line 16

def image_to_image
  @image_to_image
end

#text_to_imageResources::TextToImage, ... (readonly)

Returns Image operations.



16
17
18
# File 'lib/runapi/qwen_2/client.rb', line 16

def text_to_image
  @text_to_image
end