AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Add tests for json_utils.json_fix_llm

Open coditamar opened this issue 2 years ago • 8 comments
trafficstars

Background

I get the following error a lot. Before debugging and refactoring, let's add relevant simple unit-tests. Error: The following AI output couldn't be converted to a JSON:

Changes

Added tests for json_utils.json_fix_llm::fix_json_using_multiple_techniques()

Documentation

Test Plan

Add tests, they pass

PR Quality Checklist

  • [x] My pull request is atomic and focuses on a single change.
  • [x] I have thoroughly tested my changes with multiple different prompts.
  • [x] I have considered potential risks and mitigations for my changes.
  • [x] I have documented my changes clearly and comprehensively.
  • [x] I have not snuck in any "extra" small tweaks changes

coditamar avatar Apr 22 '23 21:04 coditamar

Run the linter please

ntindle avatar Apr 22 '23 21:04 ntindle

Also let’s add some more realistic test cases for the content we expect to see

ntindle avatar Apr 22 '23 21:04 ntindle

Not sure why this needs the api key. Will look a bit later today when I’m at my laptop

ntindle avatar Apr 22 '23 22:04 ntindle

Codecov Report

Patch coverage has no change and project coverage change: -8.16 :warning:

Comparison is base (d6ef9d1) 46.75% compared to head (7051cd2) 38.59%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2952      +/-   ##
==========================================
- Coverage   46.75%   38.59%   -8.16%     
==========================================
  Files          63       63              
  Lines        3016     3016              
  Branches      496      496              
==========================================
- Hits         1410     1164     -246     
- Misses       1493     1786     +293     
+ Partials      113       66      -47     

see 16 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Apr 22 '23 22:04 codecov[bot]

Also let’s add some more realistic test cases for the content we expect to see

I intentionally wanted to keep it very simple, to start lean. And as you can see, we already find interesting behavior, that required using mocks

coditamar avatar Apr 22 '23 22:04 coditamar

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Apr 22 '23 23:04 github-actions[bot]

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

github-actions[bot] avatar Apr 22 '23 23:04 github-actions[bot]

Two unit-tests failures seems unrelated to the PR

coditamar avatar Apr 23 '23 12:04 coditamar