bedrock

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TITAN_EMBED_TEXT_V1 = ModelID("amazon.titan-embed-text-v1")
	TITAN_EMBED_TEXT_V2 = ModelID("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 = "bedrock/v0.1.2"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(opts ...Option) (*Client, error)

Creates AWS BedRock embeddings client.

By default `us-east-1` region is used, supply custom `aws.Config` to alter behavior.

The client is configurable using

WithConfig(cfg aws.Config)

func (*Client) ConsumedTokens

func (c *Client) ConsumedTokens() int

Number of tokens consumed within the session

func (*Client) Embedding

func (c *Client) Embedding(ctx context.Context, text string) ([]float32, error)

Calculates embedding vector

type FoundationModel added in v0.1.0

type FoundationModel struct {
	constructs.Construct
	// contains filtered or unexported fields
}

Foundation Model L3 construct simplify grant access

func NewFoundationModel added in v0.1.0

func NewFoundationModel(scope constructs.Construct, id *string, foundationModelId awsbedrock.FoundationModelIdentifier) *FoundationModel

func NewTitanTextEmbeddingsV1 added in v0.1.0

func NewTitanTextEmbeddingsV1(scope constructs.Construct) *FoundationModel

func NewTitanTextEmbeddingsV2 added in v0.1.0

func NewTitanTextEmbeddingsV2(scope constructs.Construct) *FoundationModel

func (*FoundationModel) GrantAccess added in v0.1.0

func (c *FoundationModel) GrantAccess(grantee awsiam.IGrantable)

type ModelID added in v0.0.3

type ModelID string

type Option

type Option func(*Client)

func WithConfig

func WithConfig(cfg aws.Config) Option

func WithDimension added in v0.1.0

func WithDimension(d int) Option

func WithModel added in v0.0.3

func WithModel(id ModelID) Option

func WithTitanV1 added in v0.1.0

func WithTitanV1() Option

func WithTitanV2 added in v0.1.0

func WithTitanV2() Option

Jump to

Keyboard shortcuts

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