Documentation
¶
Index ¶
Constants ¶
View Source
const ( TITAN_EMBED_TEXT_V1 = LLM("amazon.titan-embed-text-v1") TITAN_EMBED_TEXT_V2 = LLM("amazon.titan-embed-text-v2:0") )
See https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html
View Source
const ( EMBEDDING_SIZE_256 = 256 EMBEDDING_SIZE_512 = 512 EMBEDDING_SIZE_1024 = 1024 )
View Source
const Version = "llm/bedrock/v0.2.0"
Variables ¶
View Source
var ( // Set AWS Bedrock Foundational LLM // // This option is required. WithLLM = opts.ForType[Client, LLM]() WithTitanV1 = WithLLM(TITAN_EMBED_TEXT_V1) WithTitanV2 = WithLLM(TITAN_EMBED_TEXT_V2) // Set the dimension of embeddings vector WithEmbeddingSize = opts.ForName[Client, int]("embeddingSize") WithEmbeddingSize256 = WithEmbeddingSize(EMBEDDING_SIZE_256) WithEmbeddingSize512 = WithEmbeddingSize(EMBEDDING_SIZE_512) WithEmbeddingSize1024 = WithEmbeddingSize(EMBEDDING_SIZE_1024) // Use aws.Config to config the client WithConfig = opts.FMap(optsFromConfig) // Use region for aws.Config WithRegion = opts.FMap(optsFromRegion) // Set us-west-2 as default region WithDefaultRegion = WithRegion(defaultRegion) // Set AWS Bedrock Runtime WithBedrock = opts.ForType[Client, Bedrock]() )
Functions ¶
This section is empty.
Types ¶
type Bedrock ¶
type Bedrock interface {
InvokeModel(ctx context.Context, params *bedrockruntime.InvokeModelInput, optFns ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelOutput, error)
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
Creates AWS BedRock embeddings client.
By default `us-west-2` region is used, supply custom `aws.Config` to alter behavior.
The client is configurable using
WithConfig(cfg aws.Config)
func (*Client) UsedTokens ¶
Number of tokens consumed within the session
type FoundationModel ¶
type FoundationModel struct {
constructs.Construct
// contains filtered or unexported fields
}
Foundation Model L3 construct simplify grant access
func NewFoundationModel ¶
func NewFoundationModel(scope constructs.Construct, id *string, foundationModelId awsbedrock.FoundationModelIdentifier) *FoundationModel
func NewTitanTextEmbeddingsV1 ¶
func NewTitanTextEmbeddingsV1(scope constructs.Construct) *FoundationModel
func NewTitanTextEmbeddingsV2 ¶
func NewTitanTextEmbeddingsV2(scope constructs.Construct) *FoundationModel
func (*FoundationModel) GrantAccess ¶
func (c *FoundationModel) GrantAccess(grantee awsiam.IGrantable)
func (*FoundationModel) GrantAccessIn ¶
func (c *FoundationModel) GrantAccessIn(grantee awsiam.IGrantable, region *string)
Click to show internal directories.
Click to hide internal directories.