Registry / llm-agents / llama-index-embeddings-bedrock

llama-index-embeddings-bedrock

JSON →
library0.8.0pypypi✓ verified 85d ago

The `llama-index-embeddings-bedrock` library provides robust integration for Amazon Bedrock embedding models within the LlamaIndex framework. It allows developers to leverage various AWS Bedrock models like Amazon Titan and Cohere for generating text embeddings. The library is actively maintained, with version 0.8.0 released on March 12, 2026, and receives frequent updates to align with LlamaIndex core and Bedrock API changes.

pip install llama-index-embeddings-bedrock
INSTALL
IMPORT
SIG · LLAMA-INDEX-EMBEDD
L
llama-index-embeddings-bedrock
llm-agentspythonv0.8.0
Install
20.9s avg
Import
5763ms
Disk
279MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.8.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 4.770s · 267.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 20.9s · import 4.451s · 264MB
279MB installed
● package 279MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BedrockEmbedding
from llama_index.embeddings.bedrock import BedrockEmbedding
This is the primary class for Bedrock embedding models.

This quickstart demonstrates how to initialize the `BedrockEmbedding` class, configure AWS credentials and region, and generate an embedding for a given text. It highlights using environment variables for sensitive information.

import os from llama_index.embeddings.bedrock import BedrockEmbedding # Configure AWS credentials and region via environment variables or explicitly # os.environ['AWS_ACCESS_KEY_ID'] = 'YOUR_ACCESS_KEY' # os.environ['AWS_SECRET_ACCESS_KEY'] = 'YOUR_SECRET_KEY' # os.environ['AWS_REGION_NAME'] = 'us-east-1' # Initialize the embedding model embed_model = BedrockEmbedding( model_name="cohere.embed-english-v3", # Example model, choose from supported models region_name=os.environ.get('AWS_REGION_NAME', 'us-east-1'), # Optionally, specify credentials directly or via profile_name aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID'), aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY'), # profile_name='my-aws-profile' ) # Get a single embedding text = "Hello, world! This is a test document." embedding = embed_model.get_text_embedding(text) print(f"Embedding length: {len(embedding)}") print(f"First 5 embedding values: {embedding[:5]}") # List supported models # supported_models = BedrockEmbedding.list_supported_models() # print("Supported models:", supported_models)
Debug
Known issues
gotchaCohere embedding models on Bedrock have strict input token limits (e.g., 512 tokens or ~2048 characters for `cohere.embed-english-v3`). Exceeding this limit will result in a `ValidationException` or 'Input too long' error, even with small LlamaIndex chunk sizes if the underlying text is too long.
fix
Ensure that text chunks passed to the embedding model are within the model's maximum context length. Adjust LlamaIndex's chunking strategy (e.g., `chunk_size` and `chunk_overlap`) and consider model-specific limitations.
affects: All versions
gotchaWhen using an `application_inference_profile_arn` with `BedrockEmbedding`, the `model_name` argument *must* still match the underlying model referenced by the profile. The integration does not validate this, and mismatched values lead to undefined behavior or errors.
fix
Always ensure the `model_name` passed to `BedrockEmbedding` accurately reflects the model configured in your AWS Application Inference Profile.
affects: All versions
gotchaFailing to configure AWS credentials (e.g., `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION_NAME`) or specify `region_name` during `BedrockEmbedding` initialization will lead to `botocore.exceptions.NoRegionError` or authentication failures.
fix
Set AWS credentials as environment variables, provide them directly to `BedrockEmbedding` during initialization, or configure an AWS profile, and always specify the `region_name`.
affects: All versions
gotchaMixing embedding models with different output vector dimensions (e.g., default OpenAI `text-embedding-ada-002` (1536 dims) with AWS Titan (1024 dims)) when using a vector store can lead to `Vector dimension does not match the dimension of the index` errors.
fix
Ensure that the embedding model used for generating vectors matches the expected dimension of your vector store index. Re-index your data if you switch embedding models.
affects: All versions (when integrating with vector stores)
Errors
Common errors & fixes
botocore.exceptions.NoRegionError: You must specify a region.
The AWS region was not specified in the `BedrockEmbedding` constructor or via environment variables (`AWS_REGION_NAME`).
fix
Ensure `region_name` is provided to `BedrockEmbedding` (e.g., `region_name="us-east-1"`) or set the `AWS_REGION_NAME` environment variable. Also check other AWS credential configurations.
An error occurred (ValidationException) when calling the InvokeModel operation: Input is too long for requested model.
The input text provided to the Bedrock embedding model (especially Cohere models) exceeded its maximum token or character limit.
fix
Reduce the size of the text chunks being embedded. For LlamaIndex, adjust `chunk_size` and `chunk_overlap` settings in your `Settings` (or `ServiceContext` for older versions) object to ensure chunks adhere to the model's limits.
Vector dimension 1536 does not match the dimension of the index 1024
The embedding model used to generate vectors (e.g., OpenAI's ADA with 1536 dimensions by default in LlamaIndex) does not match the dimensionality of the vector store index (e.g., 1024 for AWS Titan).
fix
Ensure consistency in embedding model dimensions. If you intend to use AWS Bedrock embeddings, configure LlamaIndex to use `BedrockEmbedding` for all indexing and querying operations, and re-index your data if the dimensions are mismatched. Explicitly set the embedding model in LlamaIndex's global settings or `ServiceContext`.
Unable to install llama-index-embeddings-bedrock (due to `llama-index-core` version conflict)
Specific versions of `llama-index-embeddings-bedrock` might have strict dependencies on `llama-index-core`, leading to conflicts if `llama-index-core` is already installed at an incompatible version.
fix
Upgrade `llama-index-embeddings-bedrock` to the latest version, which typically has broader `llama-index-core` compatibility. If issues persist, try upgrading `llama-index-core` to its latest version or, as a last resort, downgrade `llama-index-core` to a version compatible with your `llama-index-embeddings-bedrock` (e.g., `pip install llama-index-core==0.10.0`).
Upgrade
Version history
0.8.0latest on PyPI · released Mar 12, 2026
Audit
Dependencies
llama-index-corerequiredRequired for core LlamaIndex functionalities and types.
boto3requiredAWS SDK for Python, necessary to interact with Amazon Bedrock service.
Agent activity
29 hits · last 30 days
node
26
OpenAI (training)
1
Resources