Class: RubyAmazonBedrock::PayloadBuilders::Amazon::TitanImageGeneratorV1

Inherits:
Base
  • Object
show all
Defined in:
lib/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1.rb

Overview

TitanImageGeneratorV1 is a subclass of Base. It provides functionalities specific to the Amazon Titan Image Generator G1 - v1 model.

for more information about the Amazon model. NOTE: This model is currently in preview release. Changes may be made to this model.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #parameters, #type

Constructor Details

This class inherits a constructor from RubyAmazonBedrock::PayloadBuilders::Base

Instance Method Details

#buildObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1.rb', line 13

def build
  {
    model_id: model_id,
    content_type: 'application/json',
    accept: 'application/json',
    body: {
      taskType: "TEXT_IMAGE",
      textToImageParams: {
        text: @prompt,
        negativeTtext: @options[:negative_text]
      },
      imageGenerationConfig: {
        numberOfImages: @options[:number_of_images] || 1,
        quality: @options[:quality] || 'standard',
        height: @options[:height] || 1024,
        width: @options[:width] || 1024,
        cfgScale: @options[:cfg_scale] || 8.0,
        seed: @options[:seed] || 0
      }
    }.to_json
  }
end

#model_idString

Returns the model ID for the AI21 Labs Titan Image Generator G1 - v1 model.

Returns:

  • (String)

    ‘amazon.titan-image-generator-v1’



39
40
41
# File 'lib/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1.rb', line 39

def model_id
  'amazon.titan-image-generator-v1'
end