/AgentSmith

Primary LanguagePythonMIT LicenseMIT

Agent Smith - GPT-4 Code Generator and Self Corrector

License: MIT

Objective

This Python script is a example of how to use the GPT-4 model to generate code(TODO) and self correct if there is runtime error.

The script uses OpenAI's natural language processing (NLP) capabilities to create new tasks based on the objective and generate code based on the task.

warning! This script uses GPT-4 and may make many repeated calls to the API. Remember to regularly check your API usage and billing.

Dependencies

pip install black
pip install flake8
  • Python 3.6+
  • OpenAI GPT-4
  • Setup OpenAI API key in environment variable OPENAI_API_KEY

Installation

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Usage

python agent_smith.py buggy_script.py "subtract" 20 3 

Special Thanks

It is inspired by Wolverine for its healing abilities.