Skip to content

feat: support redactedContent in reasoningContent streamed events #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mazyu36
Copy link

@mazyu36 mazyu36 commented May 28, 2025

Description

Added support for the redactedContent field in ReasoningContentBlock from AWS Bedrock API.

Related Issues

Closes #99

Type of Change

  • New feature

Testing

[How have you tested the change?]

  • hatch fmt --linter
  • hatch fmt --formatter
  • hatch test --all
  • Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

Checklist

  • I have read the CONTRIBUTING document
  • I have added tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mazyu36 mazyu36 marked this pull request as ready for review May 29, 2025 03:41
@mazyu36 mazyu36 requested a review from a team as a code owner May 29, 2025 03:41
@awsarron awsarron assigned awsarron and unassigned mehtarac Jun 3, 2025
Copy link
Member

@awsarron awsarron left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @mazyu36 ❤️.

A couple of requested changes, and you'll need to merge from main for unit tests to pass.

@@ -207,6 +219,9 @@ def handle_content_block_stop(state: Dict[str, Any]) -> Dict[str, Any]:
}
)
state["reasoningText"] = ""
elif "redactedContent" in state and state["redactedContent"]:
Copy link
Member

Choose a reason for hiding this comment

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

nit: add a line like redacted_content = state["redactedContent"] on line 185 above for consistent style with the other state variables used in these conditions

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

(
{"delta": {"reasoningContent": {"redactedContent": b"encrypted"}}},
{},
{"redactedContent": b"encrypted"},
Copy link
Member

Choose a reason for hiding this comment

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

super nit: encoded might be better terminology than encrypted. The value is a base64 encoded binary blob

Copy link
Author

Choose a reason for hiding this comment

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

You're right. Fixed it.

@mazyu36
Copy link
Author

mazyu36 commented Jun 4, 2025

@awsarron
Thank you for the review.
I've addressed the comments.

@mazyu36 mazyu36 requested a review from awsarron June 4, 2025 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] BedrockModel - support redactedContent in reasoningContent streamed events
3 participants