bedrock

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ModelTitanG1Lite is the amazon.titan-text-lite-v1 model.
	ModelTitanG1Lite = types.Model{"amazon.titan-text-lite-v1", 4096, types.ModelTypeCompletion}

	// ModelTitanG1Express is the amazon.titan-text-express-v1 model.
	ModelTitanG1Express = types.Model{"amazon.titan-text-express-v1", 8192, types.ModelTypeChat}

	// ModelClaude1 is the anthropic.claude-v1 model.
	ModelClaude1 = types.Model{"anthropic.claude-v1", 100000, types.ModelTypeChat}

	// ModelClaude1 is the anthropic.claude-v2 model.
	ModelClaude2 = types.Model{"anthropic.claude-v2", 100000, types.ModelTypeChat}

	// ModelClaude1 is the anthropic.claude-v2:1 model.
	ModelClaude21 = types.Model{"anthropic.claude-v2:1", 200000, types.ModelTypeChat}

	// SupportedModels is a list of all language models supported by this
	// backend implementation.
	SupportedModels = []types.Model{
		ModelTitanG1Lite,
		ModelTitanG1Express,
		ModelClaude1,
		ModelClaude2,
		ModelClaude21,
	}
)

Functions

This section is empty.

Types

type Client

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

Client is the struct that implements libaiac's Backend interface.

func NewClient

func NewClient(opts bedrockruntime.Options) *Client

NewClient constructs a new Client object. It receives the standard Options object from the AWS SDK for the bedrockruntime service.

func (*Client) Chat

func (client *Client) Chat(model types.Model) types.Conversation

Chat initiates a conversation with a Bedrock chat model. A conversation maintains context, allowing to send further instructions to modify the output from previous requests.

func (*Client) Complete

func (client *Client) Complete(
	ctx context.Context,
	model types.Model,
	prompt string,
) (res types.Response, err error)

Complete sends a request to a Bedrock completion model with the provided prompt, and returns the response

func (*Client) DefaultModel

func (client *Client) DefaultModel() types.Model

DefaultModel returns the default model used by this backend.

func (*Client) ListModels

func (client *Client) ListModels() []types.Model

ListModels returns a list of all the models supported by this backend implementation.

type Conversation

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

Conversation is a struct used to converse with a Bedrock chat model. It maintains all messages sent/received in order to maintain context.

func (*Conversation) Send

func (conv *Conversation) Send(ctx context.Context, prompt string, msgs ...types.Message) (
	res types.Response,
	err error,
)

Send sends the provided message to the backend and returns a Response object. To maintain context, all previous messages (whether from you to the API or vice-versa) are sent as well, allowing you to ask the API to modify the code it already generated.

Jump to

Keyboard shortcuts

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