1 unstable release
0.1.0 | Mar 19, 2023 |
---|
#710 in Cargo plugins
11KB
69 lines
Ask GPT
This project is a simple command-line interface (CLI) tool for interacting with OpenAI's API including (ChatGPT, GPT-4). The tool allows users to send text to a GPT model and receive generated responses.
Prerequisites
Rust programming language installed (>= 1.68.0) An OpenAI API key (you can obtain one by signing up at https://openai.com)
Setup
- Download the binary from the crates.io repository
cargo install ask-gpt
- Then, you'll need to make sure your cargo bin directory is in your path. You can do this by adding the following to your ~/.bashrc or ~/.zshrc:
export PATH="$PATH:$HOME/.cargo/bin"
- Create a .env file in the project directory and add your OpenAI API key:
Replace your_openai_api_key with your actual OpenAI API key.
touch .env
echo "OPENAI_KEY=your_openai_api_key" > .env
Usage
- Enter your input text, finishing with an empty line:
Enter the content (finish input with an empty line):
Hello, how are you?
- The tool will send the input to the GPT-3.5 Turbo model and print the generated response:
ChatGpt: Hello! I'm doing well, thank you. How can I help you today?
To exit the program, press Ctrl+C.
Contribute
- Clone the repository:
git clone https://github.com/dave-hay/ask-gpt.git
cd ask-gpt
- Create a .env file in the project directory and add your OpenAI API key:
Replace your_openai_api_key with your actual OpenAI API key.
touch .env
echo "OPENAI_KEY=your_openai_api_key" > .env
- Build the project:
cargo build --release
- Run the executable:
./target/release/ask-gpt
License
This project is licensed under the MIT License. See the LICENSE file for details.
Dependencies
~7–19MB
~258K SLoC