guidance-ai / guidance

A guidance language for controlling large language models.
MIT License
18.14k stars 1.01k forks source link

Improve JSON and Pydantic negative tests with more `ParserException` info #864

Closed hudson-ai closed 1 month ago

hudson-ai commented 1 month ago

This PR adds additional info to ParserExceptions to facilitate more explicit and stringent test conditions when a string is expected not to match a grammar.

Changes to _parser.py:

Changes to tests:

hudson-ai commented 1 month ago

@riedgar-ms request for review

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 59.85%. Comparing base (cb263a8) to head (0273662).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #864 +/- ## ========================================== + Coverage 56.91% 59.85% +2.94% ========================================== Files 63 63 Lines 4570 4571 +1 ========================================== + Hits 2601 2736 +135 + Misses 1969 1835 -134 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Harsha-Nori commented 1 month ago

LGTM