Embeddings
AWS Bedrock Embedder
The AwsBedrockEmbedder
class is used to embed text data into vectors using the AWS Bedrock API. By default, it uses the Cohere Embed Multilingual V3 model for generating embeddings.
Setup
Set your AWS credentials
By default, this embedder uses the cohere.embed-multilingual-v3
model. You must enable access to this model from the AWS Bedrock model catalog before using this embedder.
Run PgVector
Usage
cookbook/embedders/aws_bedrock_embedder.py
Params
Parameter | Type | Default | Description |
---|---|---|---|
id | str | "cohere.embed-multilingual-v3" | The model ID to use. You need to enable this model in your AWS Bedrock model catalog. |
dimensions | int | 1024 | The dimensionality of the embeddings generated by the model(1024 for Cohere models). |
input_type | str | "search_query" | Prepends special tokens to differentiate types. Options: ‘search_document’, ‘search_query’, ‘classification’, ‘clustering’. |
truncate | Optional[str] | None | How to handle inputs longer than the maximum token length. Options: ‘NONE’, ‘START’, ‘END’. |
embedding_types | Optional[List[str]] | None | Types of embeddings to return . Options: ‘float’, ‘int8’, ‘uint8’, ‘binary’, ‘ubinary’. |
aws_region | Optional[str] | None | The AWS region to use. If not provided, falls back to AWS_REGION env variable. |
aws_access_key_id | Optional[str] | None | The AWS access key ID. If not provided, falls back to AWS_ACCESS_KEY_ID env variable. |
aws_secret_access_key | Optional[str] | None | The AWS secret access key. If not provided, falls back to AWS_SECRET_ACCESS_KEY env variable. |
session | Optional[Session] | None | A boto3 Session object to use for authentication. |
request_params | Optional[Dict[str, Any]] | None | Additional parameters to pass to the API requests. |
client_params | Optional[Dict[str, Any]] | None | Additional parameters to pass to the boto3 client. |
client | Optional[AwsClient] | None | An instance of the AWS Bedrock client to use for making API requests. |
Developer Resources
- View Cookbook