fix: correct boolean parsing in parse_llm_output#1
Open
Joshh99 wants to merge 1 commit intowwcohen:mainfrom
Open
fix: correct boolean parsing in parse_llm_output#1Joshh99 wants to merge 1 commit intowwcohen:mainfrom
Joshh99 wants to merge 1 commit intowwcohen:mainfrom
Conversation
- Fixed boolean parsing bug where bool('False') returned True
- Added proper handling for complex types (tuple, list, dict)
- Complex types now use ast.literal_eval instead of type constructor
- Prevents tuple(string) from converting character-by-character
Comprehensive test suite (test_type_parsing.py) now covers:
- Boolean parsing with various string formats
- Tuple/list/dict parsing with ast.literal_eval
- Integration tests with mock LLM calls
Resolves parsing issues in @subagent decorator for all return types.
71ccc5f to
42f80ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem: bool('False') returns True in Python because any non-empty string is truthy. This caused @subagent functions returning bool to always return True when LLM generated 'False'.
Solution: Special-case boolean type conversion to explicitly check for 'true'/'false' strings (case-insensitive).
Test: Added examples/test_boolean_fix.py to demonstrate the fix with mock LLM