bedrock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package bedrock provides a ModelProvider adapter for AWS Bedrock Converse API. It implements the Converse API wire format with HAND-ROLLED SigV4 signing (no aws-sdk dep).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Provider)

Option is a functional option for configuring a Provider.

func WithCredentials

func WithCredentials(accessKey, secretKey, sessionToken string) Option

WithCredentials sets AWS credentials for SigV4 signing.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets a custom HTTP client for requests.

func WithRegion

func WithRegion(region string) Option

WithRegion sets the AWS region (default: us-east-1).

type Provider

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

Provider implements runtime.ModelProvider for AWS Bedrock Converse API.

func New

func New(opts ...Option) *Provider

New creates a new Bedrock provider with default endpoint for the region.

func NewWithEndpoint

func NewWithEndpoint(endpoint string, opts ...Option) *Provider

NewWithEndpoint creates a new Bedrock provider with a custom endpoint. Used primarily for testing with httptest.Server.

func (*Provider) Complete

func (p *Provider) Complete(ctx context.Context, req model.Request) (model.Response, error)

Complete sends a request to the model and returns its complete response.

func (*Provider) Stream

func (p *Provider) Stream(ctx context.Context, req model.Request) (runtime.StreamReader, error)

Stream sends a request to the model and returns a StreamReader for reading chunks. NOTE: AWS Bedrock converse-stream uses binary event-stream framing which is complex. For httptest.Server compatibility, we implement Stream as Complete-then-single-chunk emulation: Stream makes a Complete call and returns it wrapped as a single chunk. This is deterministic and contract-compatible with the runtime.StreamReader interface, though it differs from true streaming. Production code should use the /converse-stream endpoint with proper AWS event-stream decoding when available.

Jump to

Keyboard shortcuts

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