Sha256: 57e7edacd1618f31001fed2e72e52f216dea5ef37c8fdbe950efccc7f8b275ce

Contents?: true

Size: 602 Bytes

Versions: 4

Compression:

Stored size: 602 Bytes

Contents

# frozen_string_literal: true

module GenAI
  class Chat
    class Anthropic < Base
      SYSTEM_ROLE = 'system'

      private

      def build_history(messages, context, examples)
        @default_options[:system] = context
        history = []
        history.concat(examples)
        history.concat(messages)
        history
      end

      def role(message)
        message[:role]
      end

      def transform_message(message)
        message
      end

      def append_to_message(message)
        @history.last[:content] = "#{@history.last[:content]}\n#{message}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gen-ai-0.4.3 lib/gen_ai/chat/anthropic.rb
gen-ai-0.4.2 lib/gen_ai/chat/anthropic.rb
gen-ai-0.4.1 lib/gen_ai/chat/anthropic.rb
gen-ai-0.4.0 lib/gen_ai/chat/anthropic.rb