rust-chatgpt-cli
is a command-line interface (CLI) application that allows you to interact with OpenAI's ChatGPT API. You can start new conversations, list and delete existing ones, and process chatbot prompts.
- Rust installed on your system
- OpenAI API Key
- Clone this repository:
git clone https://github.com/yourusername/rust-chatgpt-cli.git
- Set your OpenAI API key as an environment variable:
export OPENAI_KEY=your_openai_key
- Navigate to the project directory:
cd rust-chatgpt-cli
- Build the project:
cargo build --release
- Run the application:
./target/release/rust-chatgpt-cli [FLAGS] [OPTIONS]
-n, --new-conversation
: Start a new conversation-l, --list
: List all conversations-d, --del INDEX
: Delete a conversation by its indexprompt
: Enter your prompt (can be a single or multiple words)
All the features with (🚧) are under still under construction.
- Start a new conversation (🚧):
./target/release/rust-chatgpt-cli -n What is the meaning of life?
- List all conversations (🚧):
./target/release/rust-chatgpt-cli -l
- Delete a conversation by index (🚧):
./target/release/rust-chatgpt-cli -d 2
- Provide a prompt:
./target/release/rust-chatgpt-cli Tell me a joke.
- Use stdin for the prompt:
echo "What is your favorite color?" | ./target/release/rust-chatgpt-cli
- Use a file to build your prompt, then pipe it to chatgpt.
$ cat > prompt
You are a computer science lecturer at a university.
You excel at explaining programming concepts to student.
Could you please explain what a hashtable is?
^C
$ cat prompt | ./target/release/rust-chatgpt-cli
Note: (🚧) You can combine the -n
flag with a prompt to start a new conversation with the given prompt.
Please feel free to open an issue or submit a pull request with your contributions.
This project is licensed under the MIT License - see the LICENSE file for details.