Class: Soka::LLMs::Anthropic
Overview
Anthropic (Claude) LLM provider implementation
Constant Summary collapse
- ENV_KEY =
'ANTHROPIC_API_KEY'
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, #streaming_chat, #supports_streaming?
Constructor Details
This class inherits a constructor from Soka::LLMs::Base
Instance Method Details
#chat(messages, **params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/soka/llms/anthropic.rb', line 9 def chat(, **params) request_params = build_request_params(, params) response = connection.post do |req| req.url '/v1/messages' req.headers['x-api-key'] = api_key req.headers['anthropic-version'] = [:anthropic_version] req.body = request_params end parse_response(response) rescue Faraday::Error => e handle_error(e) end |