Class: Riffer::Providers::Anthropic

Inherits:
Base
  • Object
show all
Defined in:
lib/riffer/providers/anthropic.rb

Overview

Anthropic provider for Claude models via the Anthropic API.

Requires the anthropic gem to be installed.

See github.com/anthropics/anthropic-sdk-ruby

Instance Method Summary collapse

Methods inherited from Base

#generate_text, #stream_text

Methods included from Messages::Converter

#convert_to_message_object

Methods included from Helpers::Dependencies

#depends_on

Constructor Details

#initialize(api_key: nil, **options) ⇒ Anthropic

Initializes the Anthropic provider.

: (?api_key: String?, **untyped) -> void



15
16
17
18
19
20
21
# File 'lib/riffer/providers/anthropic.rb', line 15

def initialize(api_key: nil, **options)
  depends_on "anthropic"

  api_key ||= Riffer.config.anthropic.api_key

  @client = Anthropic::Client.new(api_key: api_key, **options)
end