10 bug attributeerror str object has no attribute text during stream graph #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors and improves the graph agent's message handling and error resilience. The main focus is on cleaning up messages with empty tool calls in the graph state, introducing a robust filtering mechanism, and enhancing error handling. Additionally, unnecessary docstrings and comments are removed from
graph/react.pyfor clarity.Message Filtering and Graph State Management
_has_empty_tool_callhelper method to detect messages containing tool calls with empty content, improving the accuracy of context filtering.fix_graphmethod to remove all messages with empty tool calls, rather than just the last assistant message, and updated the logic to report the number of removed messages.Error Handling Improvements
fix_graphoperation in a try/except block to catch and log exceptions, returning an HTTP 500 error if the operation fails.Code and Documentation Cleanup
graph/react.pyto streamline the codebase and improve readability. [1] [2]Minor Code Quality Updates