Revert "Stop yielding the accumulated final response"#1048
Conversation
This reverts commit 476e5e9.
There was a problem hiding this comment.
Code Review
This pull request updates the contact_lookup and restaurant_finder agents to include parsed response parts in the final task completion yield. The review feedback identifies that using a hardcoded 'OK.' as fallback text in parse_response_to_parts would cause data loss in text-only modes; it is recommended to use the original response content instead. Additionally, unused imports of ResponsePart should be removed from both files.
| final_parts = parse_response_to_parts( | ||
| final_response_content, fallback_text="OK." | ||
| ) |
There was a problem hiding this comment.
Using fallback_text="OK." will cause the agent to return "OK." instead of the actual response when running in text-only mode (i.e., when ui_version is None). In text-only mode, parse_response will fail to find A2UI tags and raise a ValueError, causing parse_response_to_parts to return the fallback text.
You should use final_response_content as the fallback text to ensure the full response is preserved in non-UI scenarios.
| final_parts = parse_response_to_parts( | |
| final_response_content, fallback_text="OK." | |
| ) | |
| final_parts = parse_response_to_parts( | |
| final_response_content, fallback_text=final_response_content | |
| ) |
| final_parts = parse_response_to_parts( | ||
| final_response_content, fallback_text="OK." | ||
| ) |
There was a problem hiding this comment.
Using fallback_text="OK." will cause the agent to return "OK." instead of the actual response when running in text-only mode (i.e., when ui_version is None). In text-only mode, parse_response will fail to find A2UI tags and raise a ValueError, causing parse_response_to_parts to return the fallback text.
You should use final_response_content as the fallback text to ensure the full response is preserved in non-UI scenarios.
| final_parts = parse_response_to_parts( | |
| final_response_content, fallback_text="OK." | |
| ) | |
| final_parts = parse_response_to_parts( | |
| final_response_content, fallback_text=final_response_content | |
| ) |
| from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9, A2UI_OPEN_TAG, A2UI_CLOSE_TAG | ||
| from a2ui.core.schema.manager import A2uiSchemaManager | ||
| from a2ui.core.parser.parser import parse_response | ||
| from a2ui.core.parser.parser import parse_response, ResponsePart |
| from a2ui.core.schema.constants import VERSION_0_8, VERSION_0_9, A2UI_OPEN_TAG, A2UI_CLOSE_TAG | ||
| from a2ui.core.schema.manager import A2uiSchemaManager | ||
| from a2ui.core.parser.parser import parse_response | ||
| from a2ui.core.parser.parser import parse_response, ResponsePart |
Reverts #986
We still need the full accumulated final response in case the client is not running in streaming mode.