Skip to content

Conversation

@tahouse
Copy link
Contributor

@tahouse tahouse commented Mar 16, 2025

Fixes #401

Claude 3.7 still works because signatures are always returned with those thinking blocks. DeepSeek thinking blocks do not contain signatures and the ValidationError indicates a signature must be included with thinking blocks.

According to Converse API docs:

"Within the reasoningText field, the text fields describes the reasoning. The signature field is a hash of all the messages in the conversation and is a safeguard against tampering of the reasoning used by the model. You must include the signature and all previous messages in subsequent Converse requests. If any of the messages are changed, the response throws an error."

https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-call.html

@3coins I posted a separate PR #407 to make reviewing easier. Happy to combine if preferred.

@tahouse tahouse force-pushed the fix-thinking-no-sig-chatbedrockconverse branch from 43d21dc to 7b6641c Compare March 16, 2025 01:52
@3coins 3coins added the bug Something isn't working label Mar 16, 2025
@tahouse
Copy link
Contributor Author

tahouse commented Mar 16, 2025

Fixed the failing test, make lint_tests passes now with the added annotation. I ran make format, but it doesn't seem to fix all the linting issues found by make lint -- mainly, long line lengths are not being corrected. I fixed chat_models/bedrock_converse.py and test_bedrock_converse.py with manually breaking up lines, however 30 more manual edits will be needed to fix the other files.

@tahouse tahouse force-pushed the fix-thinking-no-sig-chatbedrockconverse branch from 73b3fa7 to 9e8adf1 Compare March 17, 2025 19:54
@tahouse
Copy link
Contributor Author

tahouse commented Mar 17, 2025

Tested and passing make lint_tests for Python 3.9 now as well

@michaelnchin
Copy link
Collaborator

michaelnchin commented Mar 18, 2025

Integration CI run on this branch looks clean. One unrelated test for ChatBedrock failed due to a test account permissions issue - I verified that this test is passing locally.

Copy link
Collaborator

@michaelnchin michaelnchin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tahouse !

@michaelnchin michaelnchin merged commit 1b61a6f into langchain-ai:main Mar 18, 2025
12 checks passed
@tahouse tahouse deleted the fix-thinking-no-sig-chatbedrockconverse branch March 18, 2025 04:42
murilosimao pushed a commit to murilosimao/langchain-aws that referenced this pull request Oct 29, 2025
…verse (langchain-ai#408)

Fixes langchain-ai#401

Claude 3.7 still works because signatures are always returned with those
thinking blocks. DeepSeek thinking blocks do not contain signatures and
the ValidationError indicates a signature must be included with thinking
blocks.

According to Converse API docs:
> "Within the reasoningText field, the text fields describes the
reasoning. The signature field is a hash of all the messages in the
conversation and is a safeguard against tampering of the reasoning used
by the model. You must include the signature and all previous messages
in subsequent Converse requests. If any of the messages are changed, the
response throws an error."


https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-call.html

@3coins I posted a separate PR
langchain-ai#407 to make reviewing
easier. Happy to combine if preferred.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeepSeek R1 ValidationException when calling the Converse operation

3 participants