GithubHelp home page GithubHelp logo

kristoferlund / duet-gpt Goto Github PK

View Code? Open in Web Editor NEW
163.0 6.0 12.0 5.62 MB

A conversational semi-autonomous developer assistant. AI pair programming without the copypasta.

License: MIT License

TypeScript 100.00%
agent ai assistant cli gpt gpt-4 llm openai

duet-gpt's Introduction

DuetGPT

๐ŸŽ‰ News: DuetGPT no longer uses langchain but instead OpenAI functions. This means a significant improvement in reliability and performance.

DuetGPT is an experimental AI powered CLI tool and semi-autonomous agent that helps developers with coding tasks and file system tasks. The developer describes tasks to the AI who then issues commands or follow-up questions for clarification. After approval by the developer, DuetGPT automatically executes the commands issued by the AI.

DuetGPT also does really well as a general bash helper.

Works with OpenAI models:

  • gpt-3.5-turbo-0613 (does not produce any great code though)
  • gpt-4-0613

Example tasks:

  • Refactor index.js: add inline comments, improve variable naming.
  • Write a bash script that lists all cars in the database.
  • Find all files in current directory and subdirectories that contain the word "DuetGPT"
  • Write a PR description based on the commit messages in the PR.

DuetGPT builds on OpenAI's GPT-4 language model and uses its conversational capabilities to engage in a two-way conversation with the developer. It uses the newly released feature of the OpenAI API that allows the AI to make function calls.

โš ๏ธ DuetGPT has no guardrails! Make sure you understand the commands given by the AI before executing them. โš ๏ธ

Here is a 30 second demo, use DuetGPT to build a Node.js app that draws a mandelbrot fractal using ASCII characters to the console:

mandelbrot.mp4

Setup

Install the DuetGPT CLI tool globally using npm:

npm install -g duet-gpt

Usage

To start DuetGPT, run the following command:

duet-gpt

You will be prompted to enter your OpenAI API key. You can find your API key on the OpenAI dashboard.

     _            _              _
    | |          | |            | |
  __| |_   _  ___| |_ __ _ _ __ | |_
 / _` | | | |/ _ \ __/ _` | '_ \| __|
| (_| | |_| |  __/ || (_| | |_) | |_
 \__,_|\__,_|\___|\__\__, | .__/ \__|
                      __/ | |
                     |___/|_|

โ”Œ  DuetGPT
โ”‚
โ—†  Please enter your OpenAI API key:
โ”‚  sk-XXXโ€ฆ
โ””

Setup for development

  1. Clone the repository.

  2. Install dependencies:

npm install
  1. Run DuetGPT using yarn:
npm start

Sample interaction

For the purposes of illustrating how interactions work, I chose a super simple task. Let's say you want to add .yarn/cache to .gitignore. Here is how to ask DuetGPT to help you with that:

     _            _              _
    | |          | |            | |
  __| |_   _  ___| |_ __ _ _ __ | |_
 / _` | | | |/ _ \ __/ _` | '_ \| __|
| (_| | |_| |  __/ || (_| | |_) | |_
 \__,_|\__,_|\___|\__\__, | .__/ \__|
                      __/ | |
                     |___/|_|

โ”Œ  DuetGPT
โ”‚
โ—‡  LLM and memory started
โ”‚
โ”Œ ๐Ÿค– โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                                                                            โ”‚
โ”‚                                                                                                                            โ”‚
โ”‚    My mission is to collaborate with you as a developer by providing specific bash or file modification commands to help   โ”‚
โ”‚    you complete your development-related tasks, while effectively engaging in two-way interactions.                        โ”‚
โ”‚                                                                                                                            โ”‚
โ”‚                                                                                                                            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ—‡  What would you like to do?
โ”‚  Add .yarn/cache to .gitignore
โ”‚
โ—‡  AI response received
โ”‚
โ”Œ ๐Ÿค– โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                            โ”‚
โ”‚                                                                            โ”‚
โ”‚    First, I need to check if .gitignore exists in the current directory.   โ”‚
โ”‚                                                                            โ”‚
โ”‚     ยง BASH                                                                 โ”‚
โ”‚                                                                            โ”‚
โ”‚     1 ls .gitignore                                                        โ”‚
โ”‚                                                                            โ”‚
โ”‚                                                                            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ—‡  What would you like to do?
โ”‚  Run command
โ”‚
โ”Œ ๐Ÿ’ป โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                โ”‚
โ”‚   .gitignore   โ”‚
โ”‚                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ—‡  AI response received
โ”‚
โ”Œ ๐Ÿค– โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                        โ”‚
โ”‚                                                                        โ”‚
โ”‚    I will now append '.yarn/cache' to your existing .gitignore file.   โ”‚
โ”‚                                                                        โ”‚
โ”‚     ยง BASH                                                             โ”‚
โ”‚                                                                        โ”‚
โ”‚     1 echo ".yarn/cache" >> .gitignore                                 โ”‚
โ”‚                                                                        โ”‚
โ”‚                                                                        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ—‡  What would you like to do?
โ”‚  Run command
โ”‚
โ”Œ ๐Ÿ’ป โ”€โ”€โ”€โ”€โ”
โ”‚        โ”‚
โ”‚   OK   โ”‚
โ”‚        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ—†  What would you like to do?
โ”‚  Not sure
โ””

Known issues

  • When proposing changes to large files, the AI may return incomplete results. The gpt-4 context window is limited, DuetGPT works best with small files - one function per file is ideal.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Author

License

MIT

duet-gpt's People

Contributors

kristoferlund avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

duet-gpt's Issues

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.