Class: RubyLLM::Providers::Anthropic
- Inherits:
-
RubyLLM::Provider
- Object
- RubyLLM::Provider
- RubyLLM::Providers::Anthropic
- Defined in:
- lib/ruby_llm/providers/anthropic.rb,
lib/ruby_llm/providers/anthropic/chat.rb,
lib/ruby_llm/providers/anthropic/media.rb,
lib/ruby_llm/providers/anthropic/tools.rb,
lib/ruby_llm/providers/anthropic/models.rb,
lib/ruby_llm/providers/anthropic/content.rb,
lib/ruby_llm/providers/anthropic/streaming.rb,
lib/ruby_llm/providers/anthropic/embeddings.rb,
lib/ruby_llm/providers/anthropic/capabilities.rb
Overview
Anthropic Claude API integration.
Defined Under Namespace
Modules: Capabilities, Chat, Embeddings, Media, Models, Streaming, Tools Classes: Content
Instance Attribute Summary
Attributes inherited from RubyLLM::Provider
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Tools
default_input_schema, extract_tool_calls, find_tool_uses, format_tool_call, format_tool_result, format_tool_result_block, format_tool_use_block, function_for, parse_tool_calls
Methods included from Models
extract_cache_creation_tokens, extract_cached_tokens, extract_input_tokens, extract_model_id, extract_output_tokens, models_url, parse_list_models_response
Methods included from Media
format_content, format_image, format_pdf, format_text, format_text_file
Methods included from Chat
add_optional_fields, build_base_payload, build_message, build_system_content, completion_url, convert_role, extract_text_content, format_basic_message, format_message, parse_completion_response, render_payload, separate_messages
Methods inherited from RubyLLM::Provider
#capabilities, #complete, #configuration_requirements, configured?, #configured?, configured_providers, configured_remote_providers, #embed, for, #format_messages, #format_tool_calls, #initialize, #list_models, #local?, local?, local_providers, #moderate, #name, name, #paint, #parse_error, #parse_tool_calls, providers, register, remote?, #remote?, remote_providers, resolve, slug, #slug, #transcribe
Methods included from Streaming
handle_stream, stream_response
Constructor Details
This class inherits a constructor from RubyLLM::Provider
Class Method Details
.capabilities ⇒ Object
26 27 28 |
# File 'lib/ruby_llm/providers/anthropic.rb', line 26 def capabilities Anthropic::Capabilities end |
.configuration_requirements ⇒ Object
30 31 32 |
# File 'lib/ruby_llm/providers/anthropic.rb', line 30 def configuration_requirements %i[anthropic_api_key] end |
Instance Method Details
#api_base ⇒ Object
14 15 16 |
# File 'lib/ruby_llm/providers/anthropic.rb', line 14 def api_base 'https://api.anthropic.com' end |
#headers ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ruby_llm/providers/anthropic.rb', line 18 def headers { 'x-api-key' => @config.anthropic_api_key, 'anthropic-version' => '2023-06-01' } end |