A simple command-line interface (CLI) for interacting with OpenAI's API to fetch completions and generate responses in Markdown format. Built using Rust.
- Ask questions to OpenAI and receive responses formatted in Markdown.
- Configuration management for API key and base URI.
- User-friendly command structure.
-
Install Rust: Make sure you have Rust installed. If not, you can install it from rustup.rs.
-
Clone the Repository:
git clone https://github.com/yourusername/openai-cli.git cd roh-cli
To build and use your Rust CLI in the terminal, follow these steps:
-
Build Your CLI: Navigate to your Rust project directory in the terminal and run:
cargo build --release
This command compiles your CLI and places the executable in the
target/release
directory. -
Run Your CLI: You can run the CLI directly from the terminal using:
./target/release/roh
-
Add to PATH (optional): If you want to use your CLI globally without specifying the path, you can add the
target/release
directory to yourPATH
environment variable or move the binary to a directory that is already in yourPATH
, like/usr/local/bin
:mv ./target/release/roh /usr/local/bin/
-
Make It Executable (if necessary): If you're on Unix-like systems, you might need to make the binary executable:
chmod +x /usr/local/bin/roh
Now you should be able to run your CLI from anywhere in the terminal by just typing roh
.
Before using the CLI, you need to configure it with your OpenAI API key and the base URI. Run the following command:
roh config <API_KEY> <BASE_URI>
To ask a question, use the ask
command followed by your question:
roh ask "What is the capital of France?"
To view your current configuration, use the get-config
command:
roh get-config
roh ask "Explain the theory of relativity."
If there are any errors during the request, an error message will be displayed in the terminal.
Feel free to open issues or submit pull requests for any features or fixes.
This project is licensed under the MIT License.