Registry / aws / llama-index-llms-bedrock-converse

llama-index-llms-bedrock-converse

JSON →
library0.14.13pypypi✓ verified 85d ago

The `llama-index-llms-bedrock-converse` library provides an integration for LlamaIndex with Amazon Bedrock's Converse API. LlamaIndex is an open-source framework for building LLM applications over custom data. This integration allows users to leverage various Amazon Bedrock models, such as Claude, Command, and Mistral Large, with native support for function calling and streaming, offering a unified and recommended approach to using Bedrock LLMs within LlamaIndex applications.

pip install llama-index-llms-bedrock-converse
INSTALL
IMPORT
SIG · LLAMA-INDEX-LLMS-B
L
llama-index-llms-bedrock-converse
awspythonv0.14.13
Install
20.9s avg
Import
5726ms
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.14.13 · 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.769s · 267.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 20.9s · import 4.393s · 264MB
279MB installed
● package 279MB
Code
Verified usage

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

BedrockConverse
from llama_index.llms.bedrock_converse import BedrockConverse

Initializes the BedrockConverse LLM and performs a simple text completion. AWS credentials (profile, access keys, or environment variables) and a valid Bedrock Converse model ID are required.

import os from llama_index.llms.bedrock_converse import BedrockConverse # Ensure your AWS credentials and region are set via environment variables # or AWS CLI configuration (e.g., AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION) # Replace with a model that supports the Converse API, e.g., 'anthropic.claude-3-haiku-20240307-v1:0' # or 'anthropic.claude-3-sonnet-20240229-v1:0' llm = BedrockConverse( model="anthropic.claude-3-sonnet-20240229-v1:0", region_name=os.environ.get("AWS_REGION", "us-east-1"), # profile_name="default" # Uncomment and set if using an AWS profile # aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID", ""), # aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY", ""), # aws_session_token=os.environ.get("AWS_SESSION_TOKEN", ""), ) response = llm.complete("Tell me a short story about a brave knight.") print(response.text)
Debug
Known issues
deprecatedThe older `llama-index-llms-bedrock` package is deprecated in favor of `llama-index-llms-bedrock-converse`. The Converse API is the recommended way to use Bedrock LLMs with LlamaIndex.
fix
Migrate from `llama-index-llms-bedrock` to `llama-index-llms-bedrock-converse` and update imports and instantiation accordingly.
affects: All versions
gotchaWhen using an AWS Application Inference Profile ARN, the `model` argument provided to `BedrockConverse` must accurately match the underlying model referenced by the profile. `BedrockConverse` does not perform this validation, and a mismatch can lead to undefined behavior.
fix
Always ensure the `model` parameter precisely reflects the model associated with the `application_inference_profile_arn` being used.
affects: All versions
gotchaAWS authentication and region configuration are critical. Errors like 'Invalid payload!' can occur if the ECS task or deployment environment lacks the necessary IAM permissions (`bedrock:InvokeModel`), has incorrect region settings, or an improperly configured VPC (missing internet access or VPC endpoint).
fix
Verify IAM role policies, `region_name`, `profile_name`, `aws_access_key_id`, `aws_secret_access_key`, and network configurations in your deployment environment.
affects: All versions
breakingLlamaIndex v0.10.0 introduced a significant packaging refactor, splitting integrations (like this one) into separate PyPI packages. The `ServiceContext` abstraction was deprecated and later fully removed in v0.11, requiring direct specification of LLM and embedding arguments or use of the new `Settings` object. `LLMPredictor` was also deprecated.
fix
Consult the LlamaIndex v0.10 and v0.11 migration guides. Update code to import LLMs from their dedicated packages and replace `ServiceContext` usage with direct argument passing or the `Settings` object.
affects: >=0.10.0
breakingA regression in `llama-index-llms-bedrock-converse` versions around `0.12.11` to `0.14.x` can cause `ValidationException` when using 'extended thinking' and tools. This is due to changes in how `reasoningContent` (specifically `signature`) is handled in API responses, where `reasoningContent["text"]` is expected but not always present.
fix
Check for updates to the `llama-index-llms-bedrock-converse` library. If the issue persists, consider pinning to a known working version (e.g., `0.4.1` as reported in one instance) if not using extended thinking, or consult GitHub issues for specific patches.
affects: >=0.12.11, <0.14.5 (potentially resolved in latest patch, verify)
Errors
Common errors & fixes
ParamValidationError: The tools parameter is no longer recognized in the chat_with_tools method
A regression in certain versions of `llama-index-llms-bedrock-converse` (e.g., 0.4.2) caused the `tools` parameter in the `chat_with_tools` method to be incorrectly handled or unrecognized.
fix
Ensure you are using a compatible version of `llama-index-llms-bedrock-converse` by either downgrading to a known working version (e.g., `0.4.1`) or upgrading to the latest stable release that has addressed the bug.
Invalid payload! Need prompt and completion or messages and response
This error typically occurs when the request payload sent to the Bedrock Converse API is improperly structured, either missing the required 'prompt' for `complete` calls or 'messages' for `chat` calls, or due to misconfigured AWS credentials, IAM roles, or region settings.
fix
Verify that your `complete` method calls include the `prompt` parameter and `chat` method calls include a list of `ChatMessage` objects as the `messages` parameter. Additionally, confirm that your AWS credentials, IAM role permissions (`bedrock:InvokeModel`), and `region_name` are correctly configured and consistent with the Bedrock model's availability.
botocore.exceptions.NoRegionError: You must specify a region.
The AWS region where the Bedrock service is available has not been specified, either directly in the `BedrockConverse` constructor, in your AWS configuration files, or via environment variables.
fix
Explicitly set the `region_name` parameter when initializing `BedrockConverse`, for example: `llm = BedrockConverse(model="your-model-id", region_name="us-east-1")`. Alternatively, ensure your AWS CLI or SDK is configured with a default region.
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the ConverseStream operation: The model returned the following errors: messages.1.content.0.thinking.signature: Field required.
This validation error arises in specific `llama-index-llms-bedrock-converse` versions when using extended thinking and tool calls with streaming, due to an expected 'signature' field within the `reasoningContent` not being present or correctly parsed from the Bedrock Converse API response.
fix
Upgrade your `llama-index-llms-bedrock-converse` package to the latest version, which likely includes a fix for proper handling of the `reasoningContent` and 'signature' fields during streaming with tool use. If an upgrade doesn't resolve it, consider temporarily disabling extended thinking or tool use features if your application allows.
ERROR: Could not find a version that satisfies the requirement llama-index-llms-bedrock-converse
The Python Package Installer (`pip`) could not locate the `llama-index-llms-bedrock-converse` package in its configured package indices, often due to a typo in the package name, an unstable internet connection, or attempting to install a version that does not exist or is incompatible with your Python environment.
fix
First, verify that the package name `llama-index-llms-bedrock-converse` is spelled correctly. Ensure you have a stable internet connection. If the error persists, try upgrading `pip` (`python -m pip install --upgrade pip`) or specifying a known available version of the package.
Upgrade
Version history
0.14.13latest on PyPI · released May 28, 2026
Audit
Dependencies
llama-index-corerequiredThis is a LlamaIndex integration package, requiring the core LlamaIndex library for fundamental abstractions.
boto3optionalRequired for interacting with AWS Bedrock services.
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
llama-index-llms-bedrock-converse — pip install llama-index-llms-bedrock-converse · libregistry