Documentation
¶
Index ¶
Constants ¶
View Source
const ( EnvAWSAccessKeyID = "AWS_ACCESS_KEY_ID" EnvAWSSecretAccessKey = "AWS_SECRET_ACCESS_KEY" EnvAWSRegion = "AWS_REGION" EnvAWSDefaultRegion = "AWS_DEFAULT_REGION" )
Environment variable names for AWS configuration.
View Source
const (
// DefaultModel is the recommended default model (Claude Sonnet 4).
DefaultModel = "anthropic.claude-sonnet-4-20250514-v1:0"
)
Variables ¶
This section is empty.
Functions ¶
func MaybeRegister ¶
MaybeRegister registers the Bedrock provider if AWS credentials are available. Credentials are detected from:
- Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
- Shared credentials file (~/.aws/credentials)
- IAM role (for EC2/ECS/Lambda) - detected at request time
Region is configured from AWS_REGION or AWS_DEFAULT_REGION environment variables, defaulting to us-east-1 if not set.
Types ¶
type Option ¶
type Option func(*Provider)
Option configures a Bedrock provider.
func WithDefaultModel ¶
WithDefaultModel sets the default model ID.
func WithRegion ¶
WithRegion sets the AWS region for Bedrock. Defaults to us-east-1 if not specified.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the AWS Bedrock LLM backend.
func New ¶
New creates a new AWS Bedrock provider. The provider uses the AWS SDK's default credential chain:
- Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
- Shared credentials file (~/.aws/credentials)
- IAM role (for EC2/ECS/Lambda)
- SSO credentials
Example usage:
// Use defaults (us-east-1, default credentials)
p := bedrock.New()
// Specify region
p := bedrock.New(bedrock.WithRegion("us-west-2"))
// Specify default model
p := bedrock.New(bedrock.WithDefaultModel("anthropic.claude-3-5-haiku-20241022-v1:0"))
func (*Provider) CreateStream ¶
func (p *Provider) CreateStream(ctx context.Context, opts llm.StreamOptions) (<-chan llm.StreamEvent, error)
func (*Provider) DefaultModel ¶
DefaultModel returns the configured default model ID.
Click to show internal directories.
Click to hide internal directories.