Class: RubyPi::LLM::Anthropic
- Inherits:
-
BaseProvider
- Object
- BaseProvider
- RubyPi::LLM::Anthropic
- Defined in:
- lib/ruby_pi/llm/anthropic.rb
Overview
Anthropic Claude provider implementation. Communicates with the Anthropic Messages API to generate text completions, handle tool_use blocks, and stream responses via Server-Sent Events.
Constant Summary collapse
- BASE_URL =
Base URL for the Anthropic Messages API.
"https://api.anthropic.com"- API_VERSION =
Anthropic API version header value.
"2023-06-01"- DEFAULT_MAX_TOKENS =
Default maximum tokens for a response.
4096
Instance Attribute Summary
Attributes inherited from BaseProvider
#max_retries, #retry_base_delay, #retry_max_delay
Instance Method Summary collapse
-
#initialize(model: nil, api_key: nil, max_tokens: DEFAULT_MAX_TOKENS, **options) ⇒ Anthropic
constructor
Creates a new Anthropic provider instance.
-
#model_name ⇒ String
Returns the Claude model identifier.
-
#provider_name ⇒ Symbol
Returns :anthropic as the provider identifier.
Methods inherited from BaseProvider
Constructor Details
#initialize(model: nil, api_key: nil, max_tokens: DEFAULT_MAX_TOKENS, **options) ⇒ Anthropic
Creates a new Anthropic provider instance.
38 39 40 41 42 43 44 |
# File 'lib/ruby_pi/llm/anthropic.rb', line 38 def initialize(model: nil, api_key: nil, max_tokens: DEFAULT_MAX_TOKENS, **) super(**) config = RubyPi.configuration @model = model || config.default_anthropic_model @api_key = api_key || config.anthropic_api_key @max_tokens = max_tokens end |
Instance Method Details
#model_name ⇒ String
Returns the Claude model identifier.
49 50 51 |
# File 'lib/ruby_pi/llm/anthropic.rb', line 49 def model_name @model end |
#provider_name ⇒ Symbol
Returns :anthropic as the provider identifier.
56 57 58 |
# File 'lib/ruby_pi/llm/anthropic.rb', line 56 def provider_name :anthropic end |