A tool that automatically generates Python scripts based on user descriptions and self-corrects errors.
- Generates Python scripts from natural language descriptions
- Automatically executes the generated scripts
- Detects and handles errors in the generated code
- Installs missing Python modules as needed
- Automatically corrects faulty code with the help of AI
- Python 3.6 or higher
- Azure OpenAI API access
- The following Python packages:
- openai
- python-dotenv
- Clone the repository
- Install dependencies:
pip install openai python-dotenv - Create a
.envfile with the required API credentials:GLOBAL_LLM_SERVICE="***" AZURE_OPENAI_CHAT_DEPLOYMENT_NAME="***" AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME="***" AZURE_OPENAI_ENDPOINT="***" AZURE_OPENAI_API_KEY="***"
Start the program with:
python main.py
Describe the desired script when prompted. The tool will attempt to generate an appropriate Python script, execute it, and correct it if necessary.
- The user describes the desired script
- The tool generates a suitable Python script using Azure OpenAI
- The generated script is automatically executed
- If errors occur:
- Missing modules are identified and optionally installed
- Syntax errors or other problems are detected and the code is automatically corrected
- The corrected script is executed again