Skip to main content
To use AWS Bedrock embedding models, you need the appropriate AWS credentials and permissions. Python uses boto3, and TypeScript uses @aws-sdk/client-bedrock-runtime. Both SDKs support the Amazon Titan and Cohere embedding model families.

Setup

  • Model access is automatic: Bedrock enables serverless foundation models on first invocation in AWS commercial regions, and the Model access page has been retired. Cohere models are served from AWS Marketplace, so an account’s first invocation must come from a principal with the aws-marketplace:Subscribe permission; after that, any user in the account can invoke them. Browse the models available to you in the Bedrock model catalog.
  • Install the AWS client for your language:
    In TypeScript this package is an optional peer dependency, so it is only required when you actually use the Bedrock embedder.
  • Set up environment variables for authentication:
Both SDKs fall back to the standard AWS credential chain (environment variables, shared config, SSO, or an instance role) when you do not pass credentials in the config, so you rarely need to hardcode keys. See the boto3 credentials guide for the Python resolution order.

Usage

Choosing a model

Custom output sizes are model specific. In Python, only Titan Text Embeddings V2 accepts one. In TypeScript, Titan Text Embeddings V2 and Cohere Embed v4 both do, and embeddingDims is ignored on Titan V1 and on Cohere v3, which have no such parameter. When you do set it, make sure your vector store dimension matches, otherwise inserts will fail. Bedrock caps a Cohere embedding call at 96 texts. The TypeScript SDK splits larger batches into multiple requests for you, so a 200 text batch becomes 3 calls.

Config

Here are the parameters available for configuring AWS Bedrock embedder: