Class: ImageGeneration::Service::GenerateResult

Inherits:
Data
  • Object
show all
Defined in:
app/services/image_generation/service.rb

Overview

Generate an image.

param prompt [String]
param reference_images [Array] Library images (up to 14).
Silently ignored for providers that don't support them.
param aspect_ratio [String] e.g. "16:9". Passed to Gemini REST path only.
param image_size [String] "1K"/"2K"/"4K". Gemini REST path only.

Returns:

  • (GenerateResult)

    Value object with +jpeg_data+, +input_tokens+,
    +output_tokens+, and +provider+.

Raises:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jpeg_data:, provider:, input_tokens: nil, output_tokens: nil) ⇒ GenerateResult

Returns a new instance of GenerateResult.



148
149
150
# File 'app/services/image_generation/service.rb', line 148

def initialize(jpeg_data:, provider:, input_tokens: nil, output_tokens: nil)
  super
end

Instance Attribute Details

#input_tokensObject (readonly)

Returns the value of attribute input_tokens

Returns:

  • (Object)

    the current value of input_tokens



147
148
149
# File 'app/services/image_generation/service.rb', line 147

def input_tokens
  @input_tokens
end

#jpeg_dataObject (readonly)

Returns the value of attribute jpeg_data

Returns:

  • (Object)

    the current value of jpeg_data



147
148
149
# File 'app/services/image_generation/service.rb', line 147

def jpeg_data
  @jpeg_data
end

#output_tokensObject (readonly)

Returns the value of attribute output_tokens

Returns:

  • (Object)

    the current value of output_tokens



147
148
149
# File 'app/services/image_generation/service.rb', line 147

def output_tokens
  @output_tokens
end

#providerObject (readonly)

Returns the value of attribute provider

Returns:

  • (Object)

    the current value of provider



147
148
149
# File 'app/services/image_generation/service.rb', line 147

def provider
  @provider
end