-
Notifications
You must be signed in to change notification settings - Fork 551
fix: skip messages with empty content #621
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
base: main
Are you sure you want to change the base?
Conversation
| cleaned_messages = [] | ||
|
|
||
| for message in messages: | ||
| if not message["content"]: |
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.
when can content come back as None? Should this not always be getting set to an empty list when we receive the response from Bedrock earlier on?
sdk-python/src/strands/types/content.py
Line 183 in ec5304c
| content: List[ContentBlock] |
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.
it seems to be from other places where session manager stores empty content, and then was sent to bedrock.
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.
I think we should try to fix it in the session manager where we ensure we never write malformed messages and/or never restore the agent with these malformed messages. Because it seems like Bedrock is functioning correctly it was just passed something that didn't actually adhere to the class which is just possible because we are using python. Otherwise this feels like a patch over a session manager bug
|
I ran against your Instructions something like: Respond to customer: My logging code: Log: |
Description
Skip message with empty content in order to fix validation exception.
Related Issues
#514
Documentation PR
N/A
Type of Change
Bug fix
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.