-
Notifications
You must be signed in to change notification settings - Fork 151
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
Conversation
There was a problem hiding this 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.
src/strands/event_loop/streaming.py
Outdated
@@ -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"]: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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"}, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@awsarron |
Thank you for your contributions here @mazyu36. To avoid lots of back-and-forth, I made a follow-up PR for this in #229 that we'll get merged now with you as the co-author. I also created strands-agents/docs#90 to document this new streamed event type. |
Description
Added support for the redactedContent field in ReasoningContentBlock from AWS Bedrock API.
Related Issues
Closes #99
Type of Change
Testing
[How have you tested the change?]
hatch fmt --linter
hatch fmt --formatter
hatch test --all
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.