ask-gpt

Crates.ioask-gpt
lib.rsask-gpt
version0.1.0
sourcesrc
created_at2023-03-19 21:43:37.756073
updated_at2023-03-19 21:43:37.756073
descriptionCLI tool for interacting with OpenAI's API including ChatGPT + GPT-4.
homepagehttps://github.com/dave-hay/ask-gpt
repositoryhttps://github.com/dave-hay/ask-gpt
max_upload_size
id814709
size34,320
Dave Hay (dave-hay)

documentation

README

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

  1. Download the binary from the crates.io repository
cargo install ask-gpt
  1. 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"
  1. 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

  1. Enter your input text, finishing with an empty line:
Enter the content (finish input with an empty line):
Hello, how are you?
  1. 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

  1. Clone the repository:
git clone https://github.com/dave-hay/ask-gpt.git
cd ask-gpt
  1. 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
  1. Build the project:
cargo build --release
  1. Run the executable:
./target/release/ask-gpt

License

This project is licensed under the MIT License. See the LICENSE file for details.

Commit count: 0

cargo fmt