AWS Bedrock Embedder
Generate Cohere Embed v3 or v4 embeddings through AWS Bedrock.
AwsBedrockEmbedder defaults to cohere.embed-multilingual-v3 with 1024 dimensions. Set input_type for the text being embedded.
from agno.knowledge.embedder.aws_bedrock import AwsBedrockEmbedder
document_embedder = AwsBedrockEmbedder(input_type="search_document")
query_embedder = AwsBedrockEmbedder(input_type="search_query")
document_vector = document_embedder.get_embedding(
"The quick brown fox jumps over the lazy dog."
)
query_vector = query_embedder.get_embedding("Which animal jumps?")
print(len(document_vector), len(query_vector))AwsBedrockEmbedder applies one configured input_type to every call. A single instance used by a vector database therefore applies the same input type to document insertion and query search. Cohere retrieval models distinguish search_document from search_query.
For Cohere Embed v4, set id="cohere.embed-v4:0". The embedder changes its default vector dimension to 1536. Set output_dimension to use 256, 512, 1024, or 1536 dimensions.
Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateConfigure AWS credentials
Authenticate with the AWS SDK credential chain, then set the region:
export AWS_REGION=us-east-1Install dependencies
uv pip install -U agno boto3Run the example
python aws_bedrock_embedder.py