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

Constant Summary collapse

WEB_SEARCH_TOOL_TYPE =

: String

"web_search_20250305"

Constants inherited from Base

Base::WIRE_SEPARATOR

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#generate_text, #stream_text

Methods included from Messages::Converter

#convert_to_file_part, #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



24
25
26
27
28
29
30
# File 'lib/riffer/providers/anthropic.rb', line 24

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

Class Method Details

.skills_adapterObject

Returns the XML skill adapter for Anthropic/Claude.

– : () -> singleton(Riffer::Skills::Adapter)



16
17
18
# File 'lib/riffer/providers/anthropic.rb', line 16

def self.skills_adapter
  Riffer::Skills::XmlAdapter
end