bedrock

package
v1.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package bedrock connects to the Amazon Bedrock Converse API.

Index

Constants

View Source
const (
	ProviderOptionAdditionalModelRequestFields      = "additionalModelRequestFields"
	ProviderOptionAdditionalModelResponseFieldPaths = "additionalModelResponseFieldPaths"
	ProviderOptionGuardrailConfig                   = "guardrailConfig"
	ProviderOptionPerformanceConfig                 = "performanceConfig"
	ProviderOptionPromptVariables                   = "promptVariables"
	ProviderOptionRequestMetadata                   = "requestMetadata"
)

ProviderOptions are native Converse fields copied into the body. An option naming a generated object is merged into it, so model-specific fields go under "additionalModelRequestFields".

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Region selects the endpoints and signing region, us-east-1 by default.
	Region string
	// BaseURL overrides the bedrock-runtime endpoint and ControlPlaneBaseURL
	// the bedrock endpoint used by ListModels.
	BaseURL             string
	ControlPlaneBaseURL string
	// Credentials is required and resolved for every request.
	Credentials CredentialsProvider
	HTTPClient  litellm.HTTPClient
}

Config configures Converse. HTTPClient, when set, sends the SigV4-signed requests; wrap it with retry.NewHTTPClient to retry.

type Credentials

type Credentials struct {
	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
}

Credentials are AWS credentials; SessionToken is for temporary ones.

type CredentialsProvider

type CredentialsProvider interface {
	Credentials(context.Context) (Credentials, error)
}

CredentialsProvider supplies credentials, allowing rotation.

func StaticCredentials

func StaticCredentials(accessKeyID, secretAccessKey, sessionToken string) CredentialsProvider

StaticCredentials returns a CredentialsProvider with fixed credentials.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements litellm.Provider, litellm.CapabilityProvider and litellm.ModelLister.

func New

func New(cfg Config) (*Provider, error)

New returns a Provider for cfg.

func (*Provider) Capabilities added in v1.8.1

func (p *Provider) Capabilities() litellm.Capabilities

Capabilities reports the static protocol facts.

func (*Provider) Chat

func (p *Provider) Chat(ctx context.Context, req *litellm.Request) (*litellm.Response, error)

Chat sends a Converse request; Request.Model is the model or inference profile ID.

func (*Provider) ListModels

func (p *Provider) ListModels(ctx context.Context) ([]litellm.ModelInfo, error)

ListModels lists the foundation models in the region.

func (*Provider) Name

func (p *Provider) Name() string

Name returns "bedrock".

func (*Provider) Stream

func (p *Provider) Stream(ctx context.Context, req *litellm.Request) (litellm.Stream, error)

Stream sends a ConverseStream request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL