A streaming Python CLI leveraging OpenAI GPT for code assistance, including code verification, rewriting, and general queries.
What follows assumes youve started a session with "tgpt".
Besides being able to answer arbitrary queries with <query>, you can also use the tool to verify and rewrite code. To verify code, simply type the .verify command followed by the full path of the file you want to verify:
.verify file_to_verify.pyRewrite code with the .rewrite command:
.rewrite file_to_rewrite.pyRewritten code will be saved as a .draft file, e.g., file_to_rewrite.py.draft. Just type your questions or commands to interact with the tool and enjoy real-time GPT-powered assistance!
This quickstart guide walks you through setting up the tgpt project on your machine using the provided install_tgpt.sh.
To set up and run the tgpt project, follow these steps:
- Download or clone the
tgptrepository to your local machine. - Open your terminal and navigate to the location where you saved the
install_tgpt.shscript. - Make the script executable by running:
chmod +x install_tgpt.sh
- Run the script:
The script will prompt you for your OpenAI API key if it's not already set in your
./install_tgpt.sh
.zshrcfile. - Restart your terminal or source your
.zshrcconfiguration by running:source ~/.zshrc
- Open the
prompts.pyfile and populate theREWRITE_CODE_PROMPTandVERIFY_CODE_PROMPTvariables before running the script. You may also want to modify your system prompt insystem_prompt.py
Now, you can use the tgpt command to start a session:
tgpt