A simple command-line tool for conversing with ChatGPT

Overview

daberu

daberu License

A simple command-line tool for conversing with ChatGPT.

"daberu" is a Japanese translation of "chatting".

$ daberu -h
ChatGPT client tool that reads your message from stdin and writes the response to stdout

Usage: daberu [OPTIONS] --api-key <OPENAI_API_KEY>

Options:
      --api-key <OPENAI_API_KEY>  OpenAI API key [env: OPENAI_API_KEY]
      --log <LOG_FILE_PATH>       Log file path to save the conversation history. If the file already exists, the history will be considered in the next conversation
      --model <MODEL>             ChatGPT model name [env: CHATGPT_MODEL=] [default: gpt-3.5-turbo] [possible values: gpt-4, gpt-4-0314, gpt-4-32k, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-0301]
      --system <SYSTEM_MESSAGE>   If specified, the system role message will be added to the beginning of the conversation [env: CHATGPT_SYSTEM_MESSAGE=]
      --verbose                   If specified, HTTP request and response body JSONs are printed to stderr
  -h, --help                      Print help
  -V, --version                   Print version

Installation

$ cargo install daberu
$ export OPENAI_API_KEY="YOUR API KEY"

Usage Examle

// Conversation without history.
$ echo hi | daberu
Hello! How can I assist you today?

// Conversation with history.
$ echo "Translate to Japanese: 'hi'" | daberu --log chat.log
こんにちは

$ echo "Next, translate to Spanish" | daberu --log chat.log
hola

$ jq . chat.log
[
  {
    "role": "user",
    "content": "Translate to Japanese: 'hi'\n"
  },
  {
    "role": "assistant",
    "content": "こんにちは"
  },
  {
    "role": "user",
    "content": "Next, translate to Spanish\n"
  },
  {
    "role": "assistant",
    "content": "hola"
  }
]

The following example utilizes shell pipeline to get advice from ChatGPT about an existing file:

$ git clone https://github.com/sile/daberu
$ cd daberu/

$ echo 'How to improve the following code?:' | cat - src/main.rs | daberu
The code looks concise and well-structured. A few suggestions to further improve it could be:

1. Add more documentation to the code, especially to the `Args` struct and its fields. This will help users understand the purpose and usage of each field.

2. Handle errors and display meaningful error messages to the user. Right now, the code uses the `orfail` crate to return an error message, but it doesn't provide any additional context or information about the error. Consider adding more descriptive error messages or logging errors to a file.

3. Add unit tests to verify the correctness of the code. This is especially important since the code relies on external libraries and APIs.

4. Consider adding more features to the ChatGPT client tool, such as allowing users to specify the input and output files, or enabling interactive mode where the user can have multiple conversations with the model.

In the next example, a system role message is used to instruct ChatGPT:

$ git diff d8be79e..cb34a00 | daberu --system 'Please write consice changelog entries for the following diff.'
- Added author, license, description, homepage, repository, and readme fields to Cargo.toml
- Removed documentation badge and Actions Status badge from README.md
- Added an example utilizing shell pipeline to get advice from ChatGPT about an existing file to README.md

References

You might also like...
Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Rust FileOps Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're w

A dead simple functional testing tool for command line applications

Pharaoh : build that test pyramid! What it is Pharaoh is a dead simple, no permission needed, functional test runner for command line applications, wr

A simple command line tool for creating font palettes for engines like libtcod

palscii A simple command line tool for creating font palettes for engines like libtcod. Usage This can also be viewed by running palscii --help. palsc

☘️ A simple command line tool to manage your Minecraft Bedrock worlds
☘️ A simple command line tool to manage your Minecraft Bedrock worlds

☘️ Haze A simple command line tool to manage your Minecraft Bedrock worlds Haze allows you to keep your project's worlds out of the com.mojang directo

A tool for chatting using the ChatGPT API, written in Rust CLI.
A tool for chatting using the ChatGPT API, written in Rust CLI.

ChatGPT CLI A tool for chatting using the ChatGPT API, written in Rust CLI. You can use this tool to chat, just by setting your API Key. You can modif

Rust-powered CLI tool designed to simplify and streamline the release process with help of ChatGPT
Rust-powered CLI tool designed to simplify and streamline the release process with help of ChatGPT

$ releasecraftsman 👷🏻‍♂️🛠 Automate Your Release Process with Precision and Ease. 🎁 Features Generate well-crafted release notes using GPT-3.5 and

A CLI tool that uses ChatGPT to automatically generate commit messages.

Auto Git Commit This project is a tool that uses the OpenAI GPT model to automatically generate commit messages for Git commits based on the changes m

Command-line HTTP client for sending a POST request to specified URI on each stdin line.

line2httppost Simple tool to read lines from stdin and post each line as separate POST request to a specified URL (TCP connection is reused though). G

rip is a command-line deletion tool focused on safety, ergonomics, and performance

rip (Rm ImProved) rip is a command-line deletion tool focused on safety, ergonomics, and performance. It favors a simple interface, and does not imple

Releases(0.1.0)
Owner
Takeru Ohta
Takeru Ohta
This is a simple command-line interface tool that allows you to interact with ChatGPT from OpenAI or Azure.

HeyGPT This is a simple command-line interface tool that allows you to interact with ChatGPT from OpenAI or Azure. You can use it to: Chat with ChatGP

Philip 5 Mar 28, 2023
Koi is a simple tool built to let you use ChatGPT through the command line

Koi is a simple tool built to let you use ChatGPT through the command line. It adds the ability to let ChatGPT run commands on your computer in order to help you out, or to help you out with complicated tasks.

Shivam Sharma 9 Mar 28, 2023
a command-line tool that transforms a Git repository into a minimal format for ChatGPT queries

gprepo /dʒiːpiːˈɹi:pi:oʊ/ a command-line tool that transforms a Git repository into a minimal format for ChatGPT queries. Features Excludes LICENSE an

null 6 Apr 20, 2023
ChatGPT-rs is a lightweight ChatGPT client with a graphical user interface, written in Rust

ChatGPT-rs is a lightweight ChatGPT client with a graphical user interface, written in Rust. It allows you to chat with OpenAI's GPT models through a simple and intuitive interface.

null 7 Apr 2, 2023
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
chatgpt from the command line 🤖💬

Talk to ChatGPT from your terminal. Quickstart First you'll need to install the CLI: cargo install chatgpt-cli Then, you'll need to make sure your ca

Juan Gonzalez 9 Mar 23, 2023
A command-line interface for interacting with the ChatGPT API from OpenAI

cligpt cligpt is a command-line interface for interacting with the ChatGPT API from OpenAI. With cligpt, you can quickly and easily generate text by s

Felipe S. S. Schneider 6 Apr 4, 2023
A simple common-line interface for ChatGPT API.

heygpt A simple common-line interface for ChatGPT API. ?? Streaming output! ?? One-shot mode to get a quick answer ?? Interactive mode to have a conve

Eric Fu 88 Apr 17, 2023
Pink is a command-line tool inspired by the Unix man command.

Pink is a command-line tool inspired by the Unix man command. It displays custom-formatted text pages in the terminal using a subset of HTML-like tags.

null 3 Nov 2, 2023
A command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects.

CCake CCake is a command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects. Goals To be easily und

Boston Vanseghi 4 Oct 24, 2022