Welcome to Opus Interpreter! ๐ A magical Python data science environment where you can use Anthropic's Claude in tandem with a secure sandbox to generate and execute Python code on the fly. This project leverages Claude and the Code Interpreter API by e2b to create a seamless, interactive data science experience. Say goodbye to repetitive coding and hello to effortless productivity! ๐ฉโจ
The script as well this readme were created entirely by im-a-good-gpt2-chatbot
- Anthropic Claude API Integration: Claude-3 is your AI data scientist.
- Dynamic Code Generation: Generate Python code based on your user message.
- Interactive Execution:
- Execute Python code in a secure environment.
- Fetch execution results, logs, and any visualizations.
- Execute Python Code: Run Python code in a Jupyter notebook-like environment.
- Files & Logs Management: Save results, tracebacks, and logs for future reference.
- Tools Integration:
- execute_python: Execute Python code in a separate cell.
- Secure Python Sandbox: Execute Python code in a controlled environment.
- Filesystem Access:
- Read/write files.
- Download files generated during execution.
- Python: Ensure you have Python 3.8 or above installed.
- API Keys:
- Anthropic Claude API Key.
- E2B Code Interpreter API Key.
-
Clone the Repository:
git clone https://github.com/Doriandarko/opus-interpreter.git cd opus-interpreter
-
Install Dependencies:
pip install -r requirements.txt
-
Create a
.env
File: Add your API keys to a.env
file in the root directory:# .env file ANTHROPIC_API_KEY=<your_anthropic_api_key> E2B_API_KEY=<your_e2b_api_key>
-
Run the Script:
python opus-interpreter.py
-
Chat with Claude:
- Enter your message to ask Claude for code snippets or analysis.
- Use
quit
to exit.
- Data Analysis: "Analyze this dataset and show me a summary."
- Visualization: "Create a scatter plot comparing columns X and Y."
- Code Generation: "Write a Python function to calculate Fibonacci numbers."
- System Prompt: Sets up Claude as a Python data scientist.
- Tool Definition:
execute_python
: Executes Python code in a secure environment.
- Chat Functionality:
- chat: Handles user messages and interprets Claude's response.
- code_interpret: Executes Python code and manages results, logs, and files.
All wizards and data enthusiasts are welcome to contribute! Feel free to:
- Open issues for bugs or feature requests.
- Submit pull requests with improvements.
This project is licensed under the MIT License.
Feel free to reach out with questions or suggestions. Remember, Claude and Code Interpreter are here to help you level up your data science game! ๐ฏ