Documentation ¶
Index ¶
- Constants
- type BedrockClient
- type Claude2Request
- type Claude2Response
- type Claude3Request
- type Claude3RequestMessage
- type Claude3RequestMessageContent
- type Claude3RequestMessageImageContent
- type Claude3RequestMessageTextContent
- type Claude3Response
- type Claude3ResponseContent
- type Claude3ResponseUsage
- type LLM
- func (l *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)
- func (l *LLM) CreateEmbedding(ctx context.Context, texts []string) ([][]float32, error)
- func (l *LLM) GenerateContent(ctx context.Context, messages []llms.MessageContent, ...) (*llms.ContentResponse, error)
- type Option
- func WithAWSConfig(cfg aws.Config) Option
- func WithClient(client BedrockClient) Option
- func WithEmbeddingModel(embeddingModel string) Option
- func WithLogger(logger *slog.Logger) Option
- func WithMaxTokens(maxTokens int) Option
- func WithModel(model string) Option
- func WithNumWorkers(workers int) Option
- func WithRegion(region string) Option
- func WithStopWords(stopWords []string) Option
- func WithTemperature(temperature float64) Option
- func WithTopK(topK int) Option
- func WithTopP(topP float64) Option
Constants ¶
View Source
const ( TitanEmbeddingG1Text = "amazon.titan-embed-text-v1" Claude2 = "anthropic.claude-v2:1" ClaudeInstant = "anthropic.claude-instant-v1" Claude3Sonnet = "anthropic.claude-3-sonnet-20240229-v1:0" Claude3Haiku = "anthropic.claude-3-haiku-20240307-v1:0" )
https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids-arns.html
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BedrockClient ¶
type BedrockClient interface {
InvokeModel(ctx context.Context, params *bedrockruntime.InvokeModelInput, optFns ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelOutput, error)
}
type Claude2Request ¶
type Claude2Response ¶
type Claude2Response struct {
Completion string `json:"completion"`
}
type Claude3Request ¶
type Claude3Request struct { Temperature float64 `json:"temperature,omitempty"` TopP float64 `json:"top_p,omitempty"` TopK int `json:"top_k,omitempty"` StopSequences []string `json:"stop_sequences,omitempty"` System string `json:"system,omitempty"` MaxTokens int `json:"max_tokens,omitempty"` Messages []*Claude3RequestMessage `json:"messages,omitempty"` AnthropicVersion string `json:"anthropic_version,omitempty"` }
type Claude3RequestMessage ¶
type Claude3RequestMessage struct { Role string `json:"role"` Content []Claude3RequestMessageContent `json:"content"` }
type Claude3RequestMessageContent ¶
type Claude3RequestMessageContent interface {
// contains filtered or unexported methods
}
type Claude3RequestMessageImageContent ¶
type Claude3RequestMessageImageContent struct { Type string `json:"type,omitempty"` Source claoudelV3RequestMessageImageContentSource `json:"source,omitempty"` }
type Claude3Response ¶
type Claude3Response struct { Content []Claude3ResponseContent `json:"content"` ID string `json:"id"` Model string `json:"model"` Role string `json:"role"` StopReason string `json:"stop_reason"` StopSequence any `json:"stop_sequence"` Type string `json:"type"` Usage Claude3ResponseUsage `json:"usage"` }
type Claude3ResponseContent ¶
type Claude3ResponseUsage ¶
type LLM ¶
func (*LLM) CreateEmbedding ¶
func (*LLM) GenerateContent ¶
func (l *LLM) GenerateContent(ctx context.Context, messages []llms.MessageContent, options ...llms.CallOption) (*llms.ContentResponse, error)
type Option ¶
type Option func(*options)
func WithAWSConfig ¶
func WithClient ¶
func WithClient(client BedrockClient) Option
func WithEmbeddingModel ¶
func WithLogger ¶
func WithMaxTokens ¶
func WithNumWorkers ¶
func WithRegion ¶
func WithStopWords ¶
func WithTemperature ¶
Click to show internal directories.
Click to hide internal directories.