Class: ActiveAgent::Providers::BedrockProvider
- Inherits:
-
AnthropicProvider
- Object
- BaseProvider
- AnthropicProvider
- ActiveAgent::Providers::BedrockProvider
- Defined in:
- lib/active_agent/providers/bedrock_provider.rb
Overview
Provider for Anthropic models hosted on AWS Bedrock.
Inherits all functionality from AnthropicProvider (streaming, tool use, multimodal, JSON format emulation) and overrides only the client construction to use Anthropic::BedrockClient for AWS authentication.
Constant Summary
Constants inherited from AnthropicProvider
AnthropicProvider::JSON_RESPONSE_FORMAT_LEAD_IN
Class Method Summary collapse
Instance Method Summary collapse
-
#client ⇒ Bedrock::BearerClient, Anthropic::Helpers::Bedrock::Client
Returns a configured Bedrock client.
Methods inherited from AnthropicProvider
Methods inherited from BaseProvider
#embed, embed_request_type, #initialize, namespace, #preview, #prompt, tag_name
Methods included from ToolChoiceClearing
Methods included from Previewable
Methods included from Instrumentation
#instrumentation_prompt_payload
Methods included from ExceptionHandler
#configure_exception_handler, #rescue_with_handler, #with_exception_handling
Constructor Details
This class inherits a constructor from ActiveAgent::Providers::AnthropicProvider
Class Method Details
.options_klass ⇒ Class
37 38 39 |
# File 'lib/active_agent/providers/bedrock_provider.rb', line 37 def self. Bedrock::Options end |
.prompt_request_type ⇒ ActiveModel::Type::Value
42 43 44 |
# File 'lib/active_agent/providers/bedrock_provider.rb', line 42 def self.prompt_request_type Anthropic::RequestType.new end |
.service_name ⇒ String
32 33 34 |
# File 'lib/active_agent/providers/bedrock_provider.rb', line 32 def self.service_name "Bedrock" end |
Instance Method Details
#client ⇒ Bedrock::BearerClient, Anthropic::Helpers::Bedrock::Client
Returns a configured Bedrock client.
When a bearer token is available (via aws_bearer_token option or AWS_BEARER_TOKEN_BEDROCK env var), uses ActiveAgent::Providers::Bedrock::BearerClient which sends an Authorization: Bearer header.
Otherwise, falls back to Anthropic::BedrockClient which handles SigV4 signing, credential resolution, and Bedrock URL path rewriting.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/active_agent/providers/bedrock_provider.rb', line 56 def client @client ||= if .aws_bearer_token.present? Bedrock::BearerClient.new( aws_region: .aws_region, bearer_token: .aws_bearer_token, base_url: .base_url.presence, max_retries: .max_retries, timeout: .timeout, initial_retry_delay: .initial_retry_delay, max_retry_delay: .max_retry_delay ) else ::Anthropic::BedrockClient.new( aws_region: .aws_region, aws_access_key: .aws_access_key, aws_secret_key: .aws_secret_key, aws_session_token: .aws_session_token, aws_profile: .aws_profile, base_url: .base_url.presence, max_retries: .max_retries, timeout: .timeout, initial_retry_delay: .initial_retry_delay, max_retry_delay: .max_retry_delay ) end end |