-
Notifications
You must be signed in to change notification settings - Fork 44.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor AIConfig to Sanitize Input for Goal Parameters #3492
Refactor AIConfig to Sanitize Input for Goal Parameters #3492
Conversation
The `remove_color_codes` function now accepts any type of input that can be cast to a string. Previously, it was only accepting string input and not casting non-string types to string which was causing errors in some cases. The changes were made to both logs.py and its corresponding test file.
Details: - Modified `ai_config.py` to correctly handle and sanitize user input for AI goals and convert them to formatted strings, to fix an issue where some specially formatted ai_settings.yaml files were causing goals to load as list[dict] - `test_ai_config.py` includes a test for the `sanitize_input` function in `AIConfig` class. - Removed unnecessary tests from `test_logs.py`
…3t/Auto-GPT into fix_remove_colors_dict_bug
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #3492 +/- ##
==========================================
+ Coverage 58.78% 59.14% +0.35%
==========================================
Files 68 68
Lines 3062 3062
Branches 433 502 +69
==========================================
+ Hits 1800 1811 +11
+ Misses 1131 1120 -11
Partials 131 131
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the way we save to the ai_config.yaml need to be fixed as well? Putting some quotes around all the text items?
It is a possibility. I'll take a look. However, the prompting sub-community is directly editing the ai_settings.yaml file. Many of them are opting for a static ai_settings.yaml and providing the actual instructions in a separate file that GPT-4 can directly parse: 1, 2. Spitballing: we could move the goals from AI settings to long-term memory. Or we could keep any user-provided initial instructions as free-form prompts, which is the approach that these projects usually take. |
Confirmed. AIConfig.save()'s doing the right thing. |
Did you run black on your repo? Our linter is flagging a failure due to trailing whitespace in your test file |
Found it manually. Black wasn't detecting it.Squashed. |
Background
Refactor AIConfig to Sanitize Input for Goal Parameters
A user reported errors with
remove_color_codes
and some ai_settings combinations. Investigations showed that some ai_settings formats can cause goals to load asdicts
, not strings.Specifically, if a goal is defined as:
Changes
Details:
ai_config.py
to correctly handle and sanitize user input for AI goals and convert them to formatted strings, to fix an issue where some specially formatted ai_settings.yaml files were causing goals to load as list[dict]test_ai_config.py
includes a test for thesanitize_input
function inAIConfig
class.Documentation
No documentation change needed
Test Plan
Tests were updated
PR Quality Checklist