CodeSherpa is a code interpreter ChatGPT plugin. It's designed to execute code and run commands locally in a Docker container. Read the Quickstart section to try it out.
First and foremost, beware the perils of code execution. While this ChatGPT plugin can be delightfully playful and curious, akin to a newborn puppy exploring its world, this endearing trait also implies it might chew on your favorite slippers—or worse, execute code that wasn't meant to be run. Always run the plugin in a Docker container, not on your host machine.
Here's a highlight reel demonstrating what you can do.. See more examples here
codesherpa.ChatGPT.Code.Interpreter.prompts.-.music.csv.demo-1-highlight.mp4
- June 21, 2023:
- The ChatGPT plugin servic will now fetch the
openapi.json
generated be the server. Also added request example data which is included in the api spec. This reduces the size of the plugin manifestdescription_for_model
. - Updated the README section on future work.
- The ChatGPT plugin servic will now fetch the
- June 18, 2023: Added
docker-compose.yml
- May 31, 2023: Introduced new file upload interface via
upload.html
and corresponding server endpoint, allowing you to upload files atlocalhost:3333/upload
or by telling ChatGPT you want to upload a file or have a file you want to work with:Refactored Python code execution using
ast
module for enhanced efficiency. Local server and manifest file updates to support these features. Minor updates to REPL execution, error handling, and code formatting. - May 22, 2023: Refactored README to provide clear and concise instructions for building and running CodeSherpa.
- May 20, 2023: CodeSherpa now supports multiple programming languages, including Python, C++, and Rust.
Ensure the following software is installed on your system:
- Python 3.10
- Docker
- Docker Compose (optional). Download Docker Desktop or the plugin to use Docker Compose
Here are the steps to get CodeSherpa up and running swiftly:
Option 1: Using Docker image from Github Packages
# Pull the Docker image
docker pull ghcr.io/iamgreggarcia/codesherpa:latest
# Run the Docker image locally
docker compose up
Option 2: Using the repository and Make commands
# Clone the repository
git clone https://github.com/iamgreggarcia/codesherpa.git
# Navigate to the repository directory
cd codesherpa
# Build the Docker image using Make
make build-docker
# Run the Docker image locally
make run-docker-localserver
Option 3: Using the repository and Docker commands
Instead of Make commands, you can use the following Docker commands directly or use Docker Compose
# Clone the repository
git clone https://github.com/iamgreggarcia/codesherpa.git
# Navigate to the repository directory
cd codesherpa
# Build the Docker image
docker build -t codesherpa .
# Run the Docker image locally
docker run -p 3333:3333 codesherpa python3 -c "import localserver.main; localserver.main.start()"
# OR use Docker Compose
docker compose up
Whichever option you choose, CodeSherpa will be accessible at localhost:3333.
- Navigate to the ChatGPT UI, and access the plugin store.
- Select "Develop your own plugin".
- In the plugin URL input, enter
localhost:3333
. Your ChatGPT should now be able to use CodeSherpa's features.
Below are some examples. Please note that portions of these videos are edited and/or sped up for brevity.
Vector.field.on.a.sphere.animation.mp4
Most of us have seen the ChatGPT Code Interpreter Video Demo, which is the inspiration for this project. So I thought it fitting to ask similar questions as those in the OpenAI video demo.
- Asking about properties of the function
1/sin(x)
:
codesherpa.ChatGPT.Code.Interpreter.prompts.-.demo.mp4
- Uploading a music.csv dataset for analysis and visualization. View the ChatGPT conversation
codesherpa.ChatGPT.Code.Interpreter.prompts.-.music.csv.demo-1.mp4
The new functions
parameter in the latest GPT models (gpt-4-0613
, gpt-3.5-turbo-16k-0613
, and gpt-4-32k-0613
which I don't have access to 🙄) effectively unlocks the capability to build your own "plugin service", similar to ChatGPT Plugins.
As such, I want to make a standalone version of codesherpa that doesn't require plugin developer access, loggin into ChatGPT, etc., only an API.
I've already translated the openapi.json
spec into a functions
parameter for the relevant endpoints using a simple tool called Func-it
It transforms your openapi spec into a drop-in ready functions parameter in a programming language of your choice. I suspect OpenAI does something similar during the plugin registration flow, converting openapi specs into functions that the model can call.
Next steps:
- Create the frontend, which I'll most likely do using Vercel's AI sdk or their chat template
- Configure an agent, using this notebook in the OpenAI Cookbook
Stay tuned!
I welcome contributions! If you have an idea for a feature, or want to report a bug, please open an issue, or submit a pull request.
Steps to contribute:
- Fork this repository.
- Create a feature branch
git checkout -b feature/YourAmazingIdea
. - Commit your changes
git commit -m 'Add YourAmazingIdea'
. - Push to the branch
git push origin feature/YourAmazingIdea
. - Submit a Pull Request.
This project is licensed under the terms of the MIT license.