bedrockclient

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ai21CompletionReasonLength    = "length"
	Ai21CompletionReasonStop      = "stop"
	Ai21CompletionReasonEndOfText = "endoftext"
)

Finish reason for the completion of the generation for AI21 Models.

View Source
const (
	AmazonCompletionReasonFinish          = "FINISH"
	AmazonCompletionReasonMaxTokens       = "LENGTH"
	AmazonCompletionReasonContentFiltered = "CONTENT_FILTERED"
)

Finish reason for the completion of the generation for Amazon Models.

View Source
const (
	AnthropicCompletionReasonEndTurn      = "end_turn"
	AnthropicCompletionReasonMaxTokens    = "max_tokens"
	AnthropicCompletionReasonStopSequence = "stop_sequence"
)

Finish reason for the completion of the generation.

View Source
const (
	AnthropicSystem        = "system"
	AnthropicRoleUser      = "user"
	AnthropicRoleAssistant = "assistant"
)

Role attribute for the anthropic message.

View Source
const (
	AnthropicMessageTypeText  = "text"
	AnthropicMessageTypeImage = "image"
)

Type attribute for the anthropic message.

View Source
const (
	CohereCompletionReasonComplete   = "COMPLETE"
	CohereCompletionReasonMaxTokens  = "MAX_TOKENS"
	CohereCompletionReasonError      = "ERROR"
	CohereCompletionReasonErrorToxic = "ERROR_TOXIC"
)

Finish reason for the completion of the generation for Cohere Models.

View Source
const (
	MetaCompletionReasonStop   = "stop"
	MetaCompletionReasonLength = "length"
)

Finish reason for the completion of the generation.

View Source
const (
	AnthropicLatestVersion = "bedrock-2023-05-31"
)

The latest version of the model.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a Bedrock client.

func NewClient

func NewClient(client *bedrockruntime.Client) *Client

NewClient creates a new Bedrock client.

func (*Client) CreateCompletion

func (c *Client) CreateCompletion(ctx context.Context,
	modelID string,
	messages []Message,
	options llms.CallOptions,
) (*llms.ContentResponse, error)

CreateCompletion creates a new completion response from the provider after sending the messages to the provider.

type Message

type Message struct {
	Role    llms.ChatMessageType
	Content string
	// Type may be "text" or "image"
	Type string
	// MimeType is the MIME type
	MimeType string
}

Message is a chunk of text or an data that will be sent to the provider.

The provider may then transform the message to its own format before sending it to the LLM model API.

Jump to

Keyboard shortcuts

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