llamaIndex - ✅(Solved) Fix [Bug]: Signature field not being provided in BedrockConverse requests (regression) [3 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
run-llama/llama_index#20851Fetched 2026-04-08 00:30:38
View on GitHub
Comments
2
Participants
2
Timeline
12
Reactions
0
Author
Timeline (top)
referenced ×4commented ×2cross-referenced ×2labeled ×2

Error Message

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

Root Cause

After upgrading to the latest version of BedrockCoverse, 0.12.11, I am noticing a regression when using the LLM with extended thinking and tools. At a quick glance, I believe this regression is caused by the changes in #20664 , which modified the way that reasoningContent is handled.

Fix Action

Fixed

PR fix notes

PR #20852: fix(bedrock-converse): capture thinking signature from signature-only stream chunks

Description (problem / solution / changelog)

Summary

Fixes #20851 — a regression introduced in #20664 that causes botocore.errorfactory.ValidationException: thinking.signature: Field required when using BedrockConverse with extended thinking and tools.

Root Cause

When streaming extended thinking responses, Bedrock sends the reasoning signature in a separate chunk that contains only a signature field and no text:

{"contentBlockDelta": {"delta": {"reasoningContent": {"signature": "..."}}, "contentBlockIndex": 0}}

PR #20664 refactored thinking extraction to use extract_thinking_from_block(), but placed thinking_signature accumulation inside the if thinking_delta_value: guard:

thinking_delta_value = extract_thinking_from_block(content_delta)
if thinking_delta_value:          # ← False for signature-only chunks
    thinking += thinking_delta_value
    thinking_signature += content_delta.get("reasoningContent", {}).get("signature", "")  # ← never reached

Since extract_thinking_from_block() returns None for signature-only chunks (no text field present), the thinking_signature += line was never executed for these chunks. The signature was silently dropped, causing Bedrock to reject the subsequent request with thinking.signature: Field required.

Fix

Move thinking_signature accumulation outside the if thinking_delta_value: guard so it runs for every chunk containing a reasoningContent delta, regardless of whether that chunk also carries text. Applied to both sync and async streaming paths.

thinking_delta_value = extract_thinking_from_block(content_delta)
# Capture signature from any reasoningContent delta, even when
# the chunk carries only a signature and no text.
thinking_signature += content_delta.get("reasoningContent", {}).get("signature", "")
if thinking_delta_value:
    thinking += thinking_delta_value

Test plan

  • Reproduce locally: create a BedrockConverse LLM with thinking={"type": "enabled", "budget_tokens": 1000} and a tool, run a FunctionAgent — confirm no ValidationException
  • Verify sync streaming path (line ~535) and async streaming path (line ~821) are both fixed
  • Confirm existing tests still pass: pytest llama-index-integrations/llms/llama-index-llms-bedrock-converse/

Changed files

  • llama-index-integrations/llms/llama-index-llms-bedrock-converse/llama_index/llms/bedrock_converse/base.py (modified, +12/-6)

PR #20853: fix(bedrock-converse): Improve handling of reasoningContent in responses from Converse & ConverStream requests

Description (problem / solution / changelog)

Description

Fixes #20851 by addressing a regression introduced in #20664 that caused certain fields within reasoningContent, such as signature, to not be captured as expected when using the Bedrock Converse/ConverseStream APIs. This renders certain usage of BedrockConverse unusable, such as using the LLM with extended thinking and tool calling.

The changes in this PR were made to stay aligned with the Converse/ConverseStream specifications.

As part of the review of #20664 , a variety of changes were made that ultimately left the PR in a state where no new behaviors were being introduced. Additionally, as mentioned in my comment on #20851 , I also noticed that #20664 introduced some changes that aren't clear. For example, the added extract_thinking_from_block function contains a "Fallback for other potential keys (Nova, etc.)", but I can't find that in the Converse documentation.

This fix rolls back some of these changes in an effort to stay aligned with the Bedrock specifications, as the abstraction of extract_thinking_from_block does not appear to be needed. Per AWS documentation, content blocks from Converse and content block deltas from ConverseStream are distinct, and as such, keeping them logically distinct in the code seems sensical.

https://github.com/run-llama/llama_index/blob/a771a4f67e43bb5d2675972496a4e5c70f847052/llama-index-integrations/llms/llama-index-llms-bedrock-converse/llama_index/llms/bedrock_converse/utils.py#L867-L874

Also, it adds thinking_text as part of the tuple returned from _get_content_and_tool_calls, but it isn't used anywhere, as decided by @AstraBert in this comment and then later removed by the author of the PR.

One other observation is that the original PR made a change here, which I'm not really sure about (sorry for the formatting in the diff). @logan-markewich , @AstraBert would like your input on the change as I was hesitant to roll it back or adjust.

                if text := tool_result_content.get("text", None):
-                  text_content += text
-               tool_call_ids.append(tool_result_content.get("toolUseId", ""))
+                  # Use first text block as content for compatibility
+                  pass
+              tool_call_ids.append(tool_result.get("toolUseId", ""))
                status.append(tool_result.get("status", ""))

https://github.com/run-llama/llama_index/blob/a771a4f67e43bb5d2675972496a4e5c70f847052/llama-index-integrations/llms/llama-index-llms-bedrock-converse/llama_index/llms/bedrock_converse/base.py#L435-L438

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

  • Yes
  • No

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Your pull-request will likely not be merged unless it is covered by some form of impactful unit testing.

  • I added new unit tests to cover this change
  • I believe this change is already covered by existing unit tests

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ran uv run make format; uv run make lint to appease the lint gods

Changed files

  • llama-index-integrations/llms/llama-index-llms-bedrock-converse/llama_index/llms/bedrock_converse/base.py (modified, +33/-33)
  • llama-index-integrations/llms/llama-index-llms-bedrock-converse/llama_index/llms/bedrock_converse/utils.py (modified, +0/-22)
  • llama-index-integrations/llms/llama-index-llms-bedrock-converse/pyproject.toml (modified, +1/-1)
  • llama-index-integrations/llms/llama-index-llms-bedrock-converse/uv.lock (modified, +1/-1)

Code Example

{"contentBlockDelta": {"delta": {"reasoningContent": {"signature": "...."}}, "contentBlockIndex": 0}}

---

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

---

import asyncio

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.bedrock_coverse import BedrockConverse


def add(a: int | float, b: int | float) -> int | float:
    """Add two numbers."""
    return a + b


def subtract(a: int | float, b: int | float) -> int | float:
    """Subtract two numbers."""
    return a - b


async def main():
    llm = BedrockConverse(
        model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
        region_name="us-east-1",
        max_tokens=16_000,
        timeout=60.0,
        max_retries=1,
        temperature=1.0,  # required for extended thinking
        thinking={
            "type": "enabled",
            "budget_tokens": 1024,
        },
    )

    agent = FunctionAgent(
        tools=[add, subtract],
        llm=llm,
        system_prompt="You are a helpful math assistant. You can perform basic arithmetic operations like addition and subtraction.",
    )

    response = await agent.run(user_msg="What is 15 plus 27 minus 10?")

    # observe error


if __name__ == "__main__":
    asyncio.run(main())

---
RAW_BUFFERClick to expand / collapse

Bug Description

After upgrading to the latest version of BedrockCoverse, 0.12.11, I am noticing a regression when using the LLM with extended thinking and tools. At a quick glance, I believe this regression is caused by the changes in #20664 , which modified the way that reasoningContent is handled.

In particular, #20664 made modifications where "truthy"/"falsy" checks that were previously just looking at reasoningContent are now looking at reasoningContent["text"]. The issue, is that the text entry may not necessarily be included in the content block delta, and as such, certain data is being missed.

In the case of signature, you may receive a chunk like:

{"contentBlockDelta": {"delta": {"reasoningContent": {"signature": "...."}}, "contentBlockIndex": 0}}

which clearly doesn't have text.

As a result, when invoking a BedrockConverse LLM with thinking enabled and tools, you eventually get an error:

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 makes the latest versions of llama-index-llms-bedrock-converse unusable with extended thinking.

Version

0.14.15

Steps to Reproduce

import asyncio

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.bedrock_coverse import BedrockConverse


def add(a: int | float, b: int | float) -> int | float:
    """Add two numbers."""
    return a + b


def subtract(a: int | float, b: int | float) -> int | float:
    """Subtract two numbers."""
    return a - b


async def main():
    llm = BedrockConverse(
        model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
        region_name="us-east-1",
        max_tokens=16_000,
        timeout=60.0,
        max_retries=1,
        temperature=1.0,  # required for extended thinking
        thinking={
            "type": "enabled",
            "budget_tokens": 1024,
        },
    )

    agent = FunctionAgent(
        tools=[add, subtract],
        llm=llm,
        system_prompt="You are a helpful math assistant. You can perform basic arithmetic operations like addition and subtraction.",
    )

    response = await agent.run(user_msg="What is 15 plus 27 minus 10?")

    # observe error


if __name__ == "__main__":
    asyncio.run(main())

Relevant Logs/Tracbacks

extent analysis

Fix Plan

Modify llama_index-llms-bedrock-converse to handle missing text in reasoningContent

To fix this regression, you need to modify the llama_index-llms-bedrock-converse library to handle missing text in reasoningContent. Here are the steps:

  1. Update llama_index-llms-bedrock-converse to version 0.12.10 or earlier: This will revert the changes made in #20664 and restore the original behavior.

  2. Alternatively, modify the BedrockConverse class to handle missing text: You can modify the BedrockConverse class to check if text is present in reasoningContent before performing the "truthy"/"falsy" checks. Here's an example:

class BedrockConverse: def init(self, *args, **kwargs): # ...

def _check_reasoning_content(self, reasoning_content):
    if "text" in reasoning_content:
        # Perform checks on reasoning_content["text"]
        pass
    else:
        # Handle missing "text" in reasoning_content
        pass

   You'll need to modify the `BedrockConverse` class to handle missing `text` in `reasoningContent` according to your specific requirements.

3. **Update your code to use the modified `BedrockConverse` class**:
   Once you've modified the `BedrockConverse` class, you can update your code to use the new class.

### Verification

To verify that the fix worked, you can run the same test code as before and check if the error is resolved. You should no longer see the `ValidationException` error when invoking the `BedrockConverse` LLM with thinking enabled and tools.

### Extra Tips

* Make sure to

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

llamaIndex - ✅(Solved) Fix [Bug]: Signature field not being provided in BedrockConverse requests (regression) [3 pull requests, 2 comments, 2 participants]