#chatgpt #chat-bot #cli #cli-tool #ai

bin+lib simple-chatgpt

This crate is a simple ChatGPT library for chatbot and CLI tool using this library

3 releases (stable)

1.0.1 Aug 18, 2023
1.0.0 Aug 3, 2023
0.1.0 Aug 3, 2023

#2271 in Command line utilities

32 downloads per month

Custom license

20KB
464 lines

Simple ChatGPT library and CLI for Rust

This project is the Rust chatgpt library, or a CLI tool that utilizes this library.

Getting Started

$ cargo run -- Say hello!
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/chatgpt`
Hello! How can I assist you today?
>> Make one pun.
Sure, here's a pun for you:

I'm reading a book on anti-gravity. It's impossible to put down! 📚🚀
>>

Pless Ctrl+C or Ctrl+D stop prompt if you need.

If you want to use it as a library, see lib.rs and chatgpt.rs.

Prerequisites

You must have previously created an OpenAI API key and set it to the OPENAI_API_KEY environment variable.

Define the OPENAI_DEBUG=1 environment variable if you want to see what happens when an unexpected error occurs.

Installing

$ cargo install --force --path .
...
$

Installed to ~/.cargo/bin/chatgpt.

Running the tests

$ cargo test
...
$

And coding style tests

$ cargo fmt
...
$

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~18–28MB
~438K SLoC