A command-line interface (CLI) tool built with Go that allows users to interact with ChatGPT, a powerful language model developed by OpenAI. This tool utilizes modules like Cobra, Viper, and go-gpt3 to provide an intuitive and efficient way to communicate with ChatGPT.
The directory strcuture is as follows:
main.go
: The entry point of the CLI tool, containing the main function and command execution logic.response.go
: The file that defines thegetResponse
function, responsible for interacting with the ChatGPT API.
Before running cliGPT, make sure you have the following prerequisites:
- Go programming language installed (version 1.16 or higher)
- An OpenAI API key for ChatGPT
- Git installed (for dependency management)
-
Clone the repository:
git clone https://github.com/RishabhKodes/cliGPT.git cd cliGPT
-
Create a
.env
file in the root directory and add your OpenAI API key:echo "API_KEY=YOUR_API_KEY" >> .env
-
Build the project:
go build .
This will create a
cliGPT
executable in the same directory that will be used to run the CLI tool.
To use the ChatGPT CLI tool, follow these steps:
-
In the root directory of the project, run the CLI tool with the following command:
./cliGPT
-
The CLI tool will prompt you to enter a question or command. Type your input and press Enter.
-
The ChatGPT CLI tool will communicate with the ChatGPT API and provide a response based on your input.
-
To exit the CLI tool, type
quit
and press Enter.
Contributions make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request