4 releases (2 breaking)

0.4.0 Nov 30, 2024
0.3.1 Sep 24, 2024
0.3.0 Sep 24, 2024
0.2.0 Sep 19, 2024

#1361 in Web programming

Download history 122/week @ 2024-09-16 286/week @ 2024-09-23 36/week @ 2024-09-30 1/week @ 2024-10-07 7/week @ 2024-10-14 1/week @ 2024-11-18 105/week @ 2024-11-25 25/week @ 2024-12-02

131 downloads per month
Used in jutella-xmpp

MIT license

75KB
1K SLoC

jutella

License crates.io docs.rs

Chatbot API client library and CLI interface. Currently supports OpenAI chat API, including OpenAI and Azure endpoints.

Command line interface

To get started with CLI, put your API key and endpoint into ~/.config/jutella.toml. See a config example.

Screenshot

Invoking the CLI with jutella -x makes it copy every response to clipboard on X11.

Installation

  1. Install cargo from https://rustup.rs/.
  2. Install the CLI from crates.io with cargo install jutella.
  3. Alternatively, clone the repo and build the CLI with cargo build --release. The resulting executable will be target/release/jutella.

Library

To use the chat API, initialize ChatClient with OPENAI_API_KEY and ChatClientConfig:

let mut chat = ChatClient::new(Auth::Token(api_key), ChatClientConfig::default())?;

Request replies via ChatClient::ask():

let answer = chat.ask("What is the highest point on Earth?".to_string()).await?;
println!("{answer}");

ChatClient keeps the conversation context and uses it with every ask() to generate the reply.

Dependencies

~18–35MB
~403K SLoC