Documentation
¶
Overview ¶
Package bedrock provides a comprehensive AWS Bedrock plugin for Firebase Genkit Go. This plugin supports text generation, image generation, and embedding capabilities using AWS Bedrock foundation models via the Converse API.
This implementation follows the same patterns as the existing Genkit plugins: - ollama: https://github.com/firebase/genkit/blob/main/go/plugins/ollama/ollama.go - gemini: https://github.com/firebase/genkit/blob/main/go/plugins/googlegenai/gemini.go
Index ¶
- func DefineCommonEmbedders(b *Bedrock, g *genkit.Genkit) map[string]ai.Embedder
- func DefineCommonModels(b *Bedrock, g *genkit.Genkit) map[string]ai.Model
- func IsDefinedModel(g *genkit.Genkit, name string) bool
- func Model(g *genkit.Genkit, name string) ai.Model
- func NewArraySchema(itemSchema map[string]interface{}, description string) map[string]interface{}
- func NewNumberSchema(description string, minimum, maximum *float64) map[string]interface{}
- func NewObjectSchema(properties map[string]interface{}, required []string) map[string]interface{}
- func NewStringSchema(description string, enum []string) map[string]interface{}
- type Bedrock
- type BedrockClient
- type FinishReason
- type ModelDefinition
- type Role
- type ToolChoice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefineCommonEmbedders ¶
DefineCommonEmbedders is a helper to define commonly used embedders
func DefineCommonModels ¶
DefineCommonModels is a helper to define commonly used models
func IsDefinedModel ¶
IsDefinedModel reports whether a model is defined.
func NewArraySchema ¶
NewArraySchema creates a JSON Schema for an array with the specified item type
func NewNumberSchema ¶
NewNumberSchema creates a JSON Schema for a number with optional constraints
func NewObjectSchema ¶
NewObjectSchema creates a JSON Schema for an object with the specified properties
func NewStringSchema ¶
NewStringSchema creates a JSON Schema for a string with optional constraints
Types ¶
type Bedrock ¶
type Bedrock struct { Region string // AWS region (optional, uses AWS_REGION or us-east-1) MaxRetries int // Maximum number of retries (default: 3) RequestTimeout time.Duration // Request timeout (default: 30s) AWSConfig *aws.Config // Custom AWS config (optional) // contains filtered or unexported fields }
Bedrock provides configuration options for the AWS Bedrock plugin.
func (*Bedrock) DefineEmbedder ¶
DefineEmbedder defines an embedder in the registry.
func (*Bedrock) DefineModel ¶
DefineModel defines a model in the registry. This follows the same pattern as the Anthropic plugin's DefineModel method.
type BedrockClient ¶
type BedrockClient = *bedrockruntime.Client
Type aliases for better readability
type FinishReason ¶
type FinishReason = string
Type aliases for better readability
const ( FinishReasonStop FinishReason = "stop" FinishReasonLength FinishReason = "length" FinishReasonBlocked FinishReason = "blocked" FinishReasonOther FinishReason = "other" FinishReasonUnknown FinishReason = "unknown" )
Finish reason constants
type ModelDefinition ¶
type ModelDefinition struct { Name string // Model ID as used in AWS Bedrock Type string // Type: "chat", "text", "image", "embedding" }
ModelDefinition represents a model with its name and type.
type ToolChoice ¶
type ToolChoice = string
Type aliases for better readability
const ( ToolChoiceAuto ToolChoice = "auto" ToolChoiceRequired ToolChoice = "required" ToolChoiceNone ToolChoice = "none" )
Tool choice constants
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
advanced_schemas
command
Package main demonstrates advanced schema usage with AWS Bedrock tool calling
|
Package main demonstrates advanced schema usage with AWS Bedrock tool calling |
basic
command
Package main demonstrates basic usage of the AWS Bedrock plugin
|
Package main demonstrates basic usage of the AWS Bedrock plugin |
embeddings
command
Package main demonstrates embedding generation with AWS Bedrock
|
Package main demonstrates embedding generation with AWS Bedrock |
image_generation
command
Package main demonstrates image generation with AWS Bedrock
|
Package main demonstrates image generation with AWS Bedrock |
multimodal
command
Package main demonstrates multimodal conversation with AWS Bedrock
|
Package main demonstrates multimodal conversation with AWS Bedrock |
streaming
command
Package main demonstrates streaming text generation with AWS Bedrock
|
Package main demonstrates streaming text generation with AWS Bedrock |
tool_calling
command
Package main demonstrates tool calling capabilities with AWS Bedrock
|
Package main demonstrates tool calling capabilities with AWS Bedrock |