Sha256: 57276c2651cee7d8c02f2bc2309180271f5f8daac8c5c8d69a216c2ad1ff75f2

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'bedrock_runtime/payload_builders/amazon/titan_image_generator_v1'

RSpec.describe RubyAmazonBedrock::PayloadBuilders::Amazon::TitanImageGeneratorV1 do
  let(:input) { 'example_input' }
  let(:options) { { key: 'value' } }
  let(:body) do
    {
      taskType: "TEXT_IMAGE",
      textToImageParams: {
        text: input,
        negativeTtext: nil
      },
      imageGenerationConfig: {
        numberOfImages: 1,
        quality: 'standard',
        height: 1024,
        width: 1024,
        cfgScale: 8.0,
        seed: 0
      }
    }.to_json
  end

  describe '#build' do
    it 'returns a hash with the expected structure' do
      payload_builder = described_class.new(input, options)
      payload = payload_builder.build

      expect(payload[:model_id]).to eq('amazon.titan-image-generator-v1')
      expect(payload[:content_type]).to eq('application/json')
      expect(payload[:accept]).to eq('application/json')
      expect(payload[:body]).to eq(body)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-amazon-bedrock-0.2.4 spec/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1_spec.rb
ruby-amazon-bedrock-0.2.3 spec/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1_spec.rb
ruby-amazon-bedrock-0.2.2 spec/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1_spec.rb
ruby-amazon-bedrock-0.2.1 spec/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1_spec.rb
ruby-amazon-bedrock-0.2.0 spec/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1_spec.rb
ruby-amazon-bedrock-0.1.1 spec/bedrock_runtime/payload_builders/amazon/titan_image_generator_v1_spec.rb