A Command-Line Interface (CLI) written in Rust that interacts with the OpenAI API for generating AI responses. This CLI allows you to have interactive conversations with an AI model powered by OpenAI's GPT-3.5 Turbo.
Before using this CLI, make sure you have the following:
- Rust programming language and Cargo package manager installed
- OpenAI API key (sign up at OpenAI to get an API key)
To use this CLI, follow these steps:
-
Clone the repository:
git clone https://github.com/0xwerz/manai.git
-
Change directory to the repository:
cd manai
-
Build the CLI using Cargo:
cargo build --release
The CLI requires your OpenAI API key to function. You can either set the API key as an environment variable or provide it interactively when prompted.
Create a file named .env
in the project directory and add the following line, replacing YOUR_API_KEY
with your actual API key:
OPENAI_API_KEY=YOUR_API_KEY
If the API key is not set as an environment variable, the CLI will prompt you to enter the API key when you run it for the first time. The API key will be saved in the .env file for future use.
The CLI provides two modes of operation: interactive mode and single prompt mode.
To start the interactive mode, run the following command:
manai --interactive
In interactive mode, the CLI will continuously prompt you for input and provide AI-generated responses. Enter your prompt
after the Prompt: message, and the AI
response will be displayed as AI:.
To exit the interactive mode, press Ctrl + C.
To generate a single AI response for a specific prompt, run the following command:
manai <Your prompt goes here>
Replace <Your prompt goes here>
with the prompt you want to use. The AI response will be displayed in the console.
Here's an example of using the CLI in single prompt mode: