Documentation
¶
Overview ¶
Package bedrock provides a plugin to use Amazon Bedrock models. Supported models are defined in the MODELS variable. To add additional models, append them to the MODELS array. Models must support the Converse and ConverseStream operations Authentication supports three modes:
- Bearer token: Provide a Bedrock API Key (ABSK token) for simple authentication
- Explicit credentials: Provide AWS Access Key ID and Secret Access Key directly via fabric --setup
- AWS credential provider chain (default fallback): Uses the standard chain similar to the AWS CLI and SDKs https://docs.aws.amazon.com/sdkref/latest/guide/standardized-credentials.html
Index ¶
- type BedrockClient
- func (c *BedrockClient) ListModels() ([]string, error)
- func (c *BedrockClient) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, ...) (ret string, err error)
- func (c *BedrockClient) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, ...) (err error)
- func (c *BedrockClient) Setup() (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BedrockClient ¶
type BedrockClient struct {
*plugins.PluginBase
// contains filtered or unexported fields
}
BedrockClient is a plugin to add support for Amazon Bedrock. It implements the plugins.Plugin interface and provides methods for interacting with AWS Bedrock's Converse and ConverseStream APIs.
Authentication modes (in priority order):
- Bearer token: BEDROCK_API_KEY (ABSK token) — simplest, like Claude Code
- Explicit credentials: BEDROCK_AWS_ACCESS_KEY_ID + BEDROCK_AWS_SECRET_ACCESS_KEY provided via setup
- AWS credential chain: Standard AWS SDK credential resolution (env vars, profiles, IAM roles, etc.)
func NewClient ¶
func NewClient() (ret *BedrockClient)
NewClient returns a new Bedrock plugin client. Client initialization is deferred to configure() so that explicit credentials from the .env file or --setup can be used when available.
func (*BedrockClient) ListModels ¶
func (c *BedrockClient) ListModels() ([]string, error)
ListModels retrieves all available foundation models and inference profiles from AWS Bedrock that can be used with this plugin. When using bearer token auth, the API may not be accessible, so a static fallback list of common models is returned instead.
func (*BedrockClient) Send ¶
func (c *BedrockClient) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions) (ret string, err error)
Send sends the messages the Bedrock Converse API
func (*BedrockClient) SendStream ¶
func (c *BedrockClient) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, channel chan domain.StreamUpdate) (err error)
SendStream sends the messages to the Bedrock ConverseStream API
func (*BedrockClient) Setup ¶ added in v1.4.430
func (c *BedrockClient) Setup() (err error)
Setup overrides the default plugin Setup to provide a guided auth flow: 1. Choose auth method: API Key (ABSK) or AWS Access Key + Secret 2. Based on choice, ask only the relevant questions 3. Choose region from list or type custom 4. Choose model from list or type custom