bedrock

package
v3.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnthropicVersion = "bedrock-2023-05-31"

	BedrockModelClaude35Sonnet          = "anthropic.claude-3-5-sonnet-20241022-v2:0"
	BedrockModelClaude35Sonnet_20241022 = "anthropic.claude-3-5-sonnet-20241022-v2:0"
	BedrockModelClaude35Sonnet_20240620 = "anthropic.claude-3-5-sonnet-20240620-v1:0"
	BedrockModelClaude35Haiku           = "anthropic.claude-3-5-haiku-20241022-v1:0"
	BedrockModelClaude35Haiku_20241022  = "anthropic.claude-3-5-haiku-20241022-v1:0"
	BedrockModelClaude3Opus             = "anthropic.claude-3-opus-20240229-v1:0"
	BedrockModelClaude3Sonnet           = "anthropic.claude-3-sonnet-20240229-v1:0"
	BedrockModelClaude3Haiku            = "anthropic.claude-3-haiku-20240307-v1:0"
	BedrockModelClaudeV2_1              = "anthropic.claude-v2:1"

	// Cross-region top-level region code
	CRUS = "us"
	CREU = "eu"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func MakeClient

func MakeClient(ctx context.Context, cfg Config) (*Client, error)

func (*Client) Complete

func (*Client) CompleteStream

func (c *Client) CompleteStream(ctx context.Context, req *anthropic.CompletionRequest) (<-chan *anthropic.StreamResponse, <-chan error)

func (*Client) Message

func (*Client) MessageStream

func (c *Client) MessageStream(ctx context.Context, req *anthropic.MessageRequest) (<-chan *anthropic.MessageStreamResponse, <-chan error)

type CompleteRequest

type CompleteRequest struct {
	anthropic.CompletionRequest
	AnthropicVersion string `json:"anthropic_version"`
	Model            bool   `json:"model,omitempty"`  // shadow for Model
	Stream           bool   `json:"stream,omitempty"` // shadow for Stream
}

type Config

type Config struct {
	Region               string
	AccessKeyID          string
	SecretAccessKey      string
	SessionToken         string
	CrossRegionInference bool
}

type MessageRequest

type MessageRequest struct {
	anthropic.MessageRequest
	AnthropicVersion string `json:"anthropic_version"`
	Model            bool   `json:"model,omitempty"`  // shadow for Model
	Stream           bool   `json:"stream,omitempty"` // shadow for Stream
}

MessageRequest is an override for the default message request to adapt the request for the Bedrock API.

Jump to

Keyboard shortcuts

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