Module: RubyLLM::BedrockInvoke::Capabilities
- Defined in:
- lib/ruby_llm/bedrock_invoke/capabilities.rb
Overview
Delegates capability lookups to the Anthropic capabilities module after
normalizing Bedrock model ids (region prefixes, vendor prefix, version
suffixes) into first-party Anthropic ids, so context windows, pricing
and feature flags resolve correctly for ids like
us.anthropic.claude-sonnet-4-5-20250929-v1:0.
Class Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/ruby_llm/bedrock_invoke/capabilities.rb', line 24
def method_missing(name, *args, &)
target = anthropic_capabilities
return super unless target.respond_to?(name)
args = args.dup
args[0] = normalize_model_id(args[0]) if args[0].is_a?(String)
target.public_send(name, *args, &)
end
|
Class Method Details
.anthropic_capabilities ⇒ Object
20
21
22
|
# File 'lib/ruby_llm/bedrock_invoke/capabilities.rb', line 20
def anthropic_capabilities
RubyLLM::Providers::Anthropic::Capabilities
end
|
.method_missing(name, *args) ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/ruby_llm/bedrock_invoke/capabilities.rb', line 24
def method_missing(name, *args, &)
target = anthropic_capabilities
return super unless target.respond_to?(name)
args = args.dup
args[0] = normalize_model_id(args[0]) if args[0].is_a?(String)
target.public_send(name, *args, &)
end
|
.normalize_model_id(model_id) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/ruby_llm/bedrock_invoke/capabilities.rb', line 13
def normalize_model_id(model_id)
model_id.to_s
.sub(/\A(?:us|eu|apac|global)\./, '')
.sub(/\Aanthropic\./, '')
.sub(/-v\d+(?::\d+)?\z/, '')
end
|
.respond_to_missing?(name, include_private = false) ⇒ Boolean
33
34
35
|
# File 'lib/ruby_llm/bedrock_invoke/capabilities.rb', line 33
def respond_to_missing?(name, include_private = false)
anthropic_capabilities.respond_to?(name) || super
end
|