2 releases
0.0.1-beta.1 | Mar 15, 2023 |
---|---|
0.0.1-alpha.1 | Mar 14, 2023 |
#6 in #powers
17KB
175 lines
answer
answer
any question right from your terminal,
using the same
large language model
that powers
ChatGPT.
$ echo "🌭 = 🥪?" | answer
No, a hot dog (🌭) is not the same as a sandwich (🥪).
While they both consist of bread and a filling,
a sandwich typically has separate slices of bread,
while a hot dog has a single bun that is sliced
on the top and filled with a sausage.
Read the installation and usage instructions below.
Installation
From source (recommended)
Either clone the repository to your machine and install from it, or install directly from GitHub. Both options require Rust and Cargo to be installed.
# Option 1: cloning and installing from the repository
$ git clone https://github.com/schneiderfelipe/answer.git
$ cd answer && cargo install --path=answer/
# Option 2: installing directly from GitHub
$ cargo install --git=https://github.com/schneiderfelipe/answer
Environment Setup
Before using answer
,
you need to set up your environment to use
OpenAI's chat completion API
(the same technology that powers OpenAI's most advanced language model,
ChatGPT).
To set up your environment,
you'll need to have a secret API key from OpenAI,
which can be obtained at
OpenAI's online platform.
Next, set an environment variable in your shell as follows:
export OPENAI_API_KEY="sk-...a1b2"
Usage
With your environment set up, you're ready to start using the command-line application. Here's an example:
$ echo "Date of birth of Malcolm X?" | answer
The date of birth of Malcolm X is May 19, 1925.
You can also get answer
s in context by providing a YAML file containing
the initial part of a chat history.
For example:
# birthdates.yml
messages:
- role: system
content: >-
You are a date of birth checker.
Given the name of a person,
your job is to specify the date of birth of said person.
$ echo "Malcolm X" | answer birthdates.yml
Malcolm X was born on May 19th, 1925.
The file format closely resembles both OpenAI's higher-level API and its lower-level ChatML format.
Unsafe code usage
This project forbids unsafe code usage.
License: MIT
Dependencies
~17–31MB
~510K SLoC