AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

[DRAFT] allow python code only to be compiled/validated

Open Boostrix opened this issue 2 years ago • 2 comments

trivial addition, might be useful to some folks - at least could make it into the docs to demonstrate how to extend the current command manager with custom commands (I don't seem to have wiki access and don't know if I can simply open a PR to get this added to the wiki?):

mainly useful to save bandwidth (API tokens), so that Python code can be compiled first before being executed. A simple form of validation. But -if extended- could also work to address a few RFEs such as executing calculations/expressions (regex, think sed/awk!) directly, like:

  • #286
  • #3412
  • #3775

Background

Changes

Documentation

Test Plan

PR Quality Checklist

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

Boostrix avatar May 11 '23 14:05 Boostrix

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) May 11, 2023 3:01pm

vercel[bot] avatar May 11 '23 14:05 vercel[bot]

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.08 :tada:

Comparison is base (8f31196) 60.99% compared to head (5776169) 61.07%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4112      +/-   ##
==========================================
+ Coverage   60.99%   61.07%   +0.08%     
==========================================
  Files          73       73              
  Lines        3310     3317       +7     
  Branches      542      543       +1     
==========================================
+ Hits         2019     2026       +7     
  Misses       1152     1152              
  Partials      139      139              
Impacted Files Coverage Δ
autogpt/commands/execute_code.py 72.36% <100.00%> (+2.80%) :arrow_up:

: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 May 11 '23 14:05 codecov[bot]

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

github-actions[bot] avatar May 26 '23 17:05 github-actions[bot]

I like this idea. It could be very effective when integrated into write_file, checking the syntax automatically when the extension is .py and throwing an error if it fails.

Pwuts avatar Sep 08 '23 12:09 Pwuts

Is this something that you consider trivial to be reviewed/added or should I clean up/update the merge request ?

Boostrix avatar Oct 05 '23 22:10 Boostrix