Skip to content

A robust Rust CLI for OpenAI's API, instantly generating Markdown responses and empowering developers to leverage AI effortlessly.

Notifications You must be signed in to change notification settings

effortlesslabs/roh-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roh CLI

A simple command-line interface (CLI) for interacting with OpenAI's API to fetch completions and generate responses in Markdown format. Built using Rust.

Features

  • Ask questions to OpenAI and receive responses formatted in Markdown.
  • Configuration management for API key and base URI.
  • User-friendly command structure.

Installation

  1. Install Rust: Make sure you have Rust installed. If not, you can install it from rustup.rs.

  2. Clone the Repository:

    git clone https://github.com/yourusername/openai-cli.git
    cd roh-cli

Usage

To build and use your Rust CLI in the terminal, follow these steps:

  1. 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.

  2. Run Your CLI: You can run the CLI directly from the terminal using:

    ./target/release/roh
  3. Add to PATH (optional): If you want to use your CLI globally without specifying the path, you can add the target/release directory to your PATH environment variable or move the binary to a directory that is already in your PATH, like /usr/local/bin:

    mv ./target/release/roh /usr/local/bin/
  4. 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.

Configuration

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>

Asking Questions

To ask a question, use the ask command followed by your question:

roh ask "What is the capital of France?"

Viewing Configuration

To view your current configuration, use the get-config command:

roh get-config

Example

roh ask "Explain the theory of relativity."

Error Handling

If there are any errors during the request, an error message will be displayed in the terminal.

Contributing

Feel free to open issues or submit pull requests for any features or fixes.

License

This project is licensed under the MIT License.

About

A robust Rust CLI for OpenAI's API, instantly generating Markdown responses and empowering developers to leverage AI effortlessly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages