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
-
Clone the repository.
-
Install dependencies:
npm install
- 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
- [email protected]
- Twitter: @kristoferlund
- Discord: kristofer#1475