Documentation ¶
Overview ¶
Package bedrock contains aws logic
Package bedrock contains aws logic
Index ¶
- Variables
- func CreateBedrockClient(ctx context.Context, region string) (*bedrock.Client, error)
- func CreateBedrockruntimeClient(ctx context.Context, region string) (*bedrockruntime.Client, error)
- type AWSModelConfig
- type ClientAPI
- type ClientRuntimeAPI
- type Delta
- type FoundationModel
- type PartialResponse
- type PartialResponseMessage
- type PartialResponseUsage
- type StreamingOutputHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var SupportedModels = []string{"sonnet", "anthropic", "cohere", "mistral"}
SupportedModels contains all supported models implemented
Functions ¶
func CreateBedrockClient ¶
CreateBedrockClient creates a bedrock client based on region
func CreateBedrockruntimeClient ¶
CreateBedrockruntimeClient creates a bedrockruntime client based on region
Types ¶
type AWSModelConfig ¶
type AWSModelConfig struct { ModelID string // ModelID is the ID of the model to invoke Temperature float64 // Temperature is part of model settings (Anthropic, Cohere) TopP float64 // TopP is part of model settings (Anthropic, Cohere) TopK int // TopK is part of model settings (Anthropic, Cohere) MaxTokens int // MaxTokens is part of model settings (Anthropic, Cohere) }
AWSModelConfig contains all settings for AWS Models
func NewModel ¶
func NewModel(modelID string, temp, topP float64, topK, tokens int) AWSModelConfig
NewModel is a factory for AWS Models
func (*AWSModelConfig) InvokeModel ¶
func (m *AWSModelConfig) InvokeModel(ctx context.Context, api ClientRuntimeAPI, message string) (string, error)
InvokeModel runs prompt with settings with InvokeModelWithResponseStream
type ClientAPI ¶
type ClientAPI interface {
ListFoundationModels(ctx context.Context, params *bedrock.ListFoundationModelsInput, optFns ...func(*bedrock.Options)) (*bedrock.ListFoundationModelsOutput, error)
}
ClientAPI is used to interface with bedrock client
type ClientRuntimeAPI ¶
type ClientRuntimeAPI interface {
InvokeModelWithResponseStream(ctx context.Context, params *bedrockruntime.InvokeModelWithResponseStreamInput, optFns ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelWithResponseStreamOutput, error)
}
ClientRuntimeAPI interface is for support mocking of API calls
type FoundationModel ¶
FoundationModel contains model fields
func ListModels ¶
func ListModels(ctx context.Context, api ClientAPI) ([]FoundationModel, error)
type PartialResponse ¶ added in v1.0.1
type PartialResponse struct { Type string `json:"type"` Message PartialResponseMessage `json:"message,omitempty"` Index int `json:"index,omitempty"` Delta Delta `json:"delta,omitempty"` Usage PartialResponseUsage `json:"usage,omitempty"` }
type PartialResponseMessage ¶ added in v1.0.1
type PartialResponseMessage struct { ID string `json:"id,omitempty"` Type string `json:"type,omitempty"` Role string `json:"role,omitempty"` Content []interface{} `json:"content,omitempty"` Model string `json:"model,omitempty"` StopReason string `json:"stop_reason,omitempty"` StopSequence interface{} `json:"stop_sequence,omitempty"` Usage PartialResponseUsage `json:"usage,omitempty"` }
type PartialResponseUsage ¶ added in v1.0.1
Source Files ¶
Click to show internal directories.
Click to hide internal directories.