GithubHelp home page GithubHelp logo

nowindnowave / codesherpa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iamgreggarcia/codesherpa

0.0 0.0 0.0 18.19 MB

A code interpreter ChatGPT plugin.

License: MIT License

JavaScript 0.78% Python 16.59% TypeScript 70.34% CSS 1.92% Makefile 0.81% HTML 8.55% Dockerfile 1.01%

codesherpa's Introduction

CodeSherpa

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.

Disclaimer

🚨 Allowing ChatGPT to execute code could be dangerous.

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

Recent Updates

  • 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 manifest description_for_model.
    • Updated the README section on future work.
  • 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 at localhost:3333/upload or by telling ChatGPT you want to upload a file or have a file you want to work with: upload-demo 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.

Quickstart

Prerequisites

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

Installation and Running CodeSherpa

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.

Connecting CodeSherpa to ChatGPT

  1. Navigate to the ChatGPT UI, and access the plugin store.
  2. Select "Develop your own plugin".
  3. In the plugin URL input, enter localhost:3333. Your ChatGPT should now be able to use CodeSherpa's features.

Examples

Below are some examples. Please note that portions of these videos are edited and/or sped up for brevity.

Ploting a vector field on a sphere creating an animated gif (short):

Vector.field.on.a.sphere.animation.mp4

Demo of the Demo: Recreating the ChatGPT Code Interpreter Video Demo

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
codesherpa.ChatGPT.Code.Interpreter.prompts.-.music.csv.demo-1.mp4

Future Work

Standalone Code Interpreter

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:

  1. Create the frontend, which I'll most likely do using Vercel's AI sdk or their chat template
  2. Configure an agent, using this notebook in the OpenAI Cookbook

Stay tuned!

Contributing

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:

  1. Fork this repository.
  2. Create a feature branch git checkout -b feature/YourAmazingIdea.
  3. Commit your changes git commit -m 'Add YourAmazingIdea'.
  4. Push to the branch git push origin feature/YourAmazingIdea.
  5. Submit a Pull Request.

License

This project is licensed under the terms of the MIT license.

codesherpa's People

Contributors

iamgreggarcia avatar emsi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.