Sha256: d1f644edb1325b9b3744a691b7ddf5ba4d61643cd5cbf4eb17c377eadde9d6d0

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'bedrock_runtime/payload_builders/ai_21_labs/j2_mid_v1'

RSpec.describe RubyAmazonBedrock::PayloadBuilders::Ai21Labs::J2MidV1 do
  let(:input) { 'example_input' }
  let(:options) { { key: 'value' } }
  let(:body) do
    {
      prompt: input,
      maxTokens: 200,
      temperature: 0,
      topP: 250,
      stop_sequences: [],
      countPenalty: { scale: 0 },
      presencePenalty: { scale: 0 },
      frequencyPenalty: { scale: 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('ai21labs.j2-mid-v1')
      expect(payload[:content_type]).to eq('application/json')
      expect(payload[:accept]).to eq('*/*')
      expect(payload[:body]).to eq(body)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-amazon-bedrock-0.2.0 spec/bedrock_runtime/payload_builders/ai_21_labs/j2_mid_v1_spec.rb
ruby-amazon-bedrock-0.1.1 spec/bedrock_runtime/payload_builders/ai_21_labs/j2_mid_v1_spec.rb