Sha256: a7ed3fffc5c80c7345822075a88f8bca6baac9307d67f69c3447909489bc0e52

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

module RubyAmazonBedrock
  module PayloadBuilders
    # Base class serves as an abstract class for payload builders.
    # It provides the basic structure and enforces the implementation
    # of certain methods in derived classes.
    class Base
      # Initializes a new instance of the Base class.
      # @param input [String] The input string for what needs to be generated.
      # @param options [Hash] optional parameters to customize payload building.
      # @option options [Any] :key Custom option key-value pairs.
      def initialize(input, options = {})
        @input = input
        @options = options
      end

      # Abstract method to build the payload.
      # @raise [NotImplementedError] if the subclass does not implement this method.
      # @return [Hash] the constructed payload.
      def build
        raise NotImplementedError
      end

      # Abstract method to retrieve the model ID.
      # @raise [NotImplementedError] if the subclass does not implement this method.
      # @return [String] the Amazon Bedrock model ID.
      def model_id
        raise NotImplementedError
      end

      # Abstract method to retrieve the model type.
      # @return [Symbol] the model result type: :text (default) or :image.
      def type
        :text
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-amazon-bedrock-0.2.1 lib/bedrock_runtime/payload_builders/base.rb
ruby-amazon-bedrock-0.2.0 lib/bedrock_runtime/payload_builders/base.rb