The openai-rust project is a command-line interface (CLI) tool written in Rust, designed to interact with OpenAI APIs. It supports multiple features like interactive chatting, translation, generating commit messages, writing code, and debugging code.
- Interactive Chat: Engage in an interactive chat session.
- Translate: Translate text from a specified file.
- Generate Commit Message: Automatically generate a commit message for a given change.
- Write Code: Generate code based on a given prompt.
- Debug Code: Debug code with a specified issue.
- Installation
- Clone the repository and build the project:
git clone https://github.com/yoichiojima-2/openai-rust.git
cd openai-rust
cargo build --release
Run the tool using the following commands:
Start Interactive Chat
cargo run -- interactive
cargo run -- translate <path-to-text-file>
cargo run -- commit-message <path-to-file>
cargo run -- code <prompt>
cargo run -- debug <path-to-file> <issue>
- Rust
- Clap
- Tokio
To start an interactive chat session:
cargo run -- interactive
To translate text from a specified file:
cargo run -- translate path/to/text/file.txt
To generate a commit message for a given file:
cargo run -- commit-message path/to/file.txt
To generate code based on a given prompt:
cargo run -- code "Implement a binary search algorithm"
To debug code with a specified issue:
cargo run -- debug path/to/code/file.rs "The function does not return the correct value"
Ensure that you have the necessary permissions and access to the specified files when running these commands.
This project is licensed under the MIT License. See the LICENSE file for more details.