Command line REPL for GPT-based tools
Project description
gpt-repl
Interactively play with GPT-based tools from the command line
Description
ChatGPT can be a powerful tool, not just a conversation partner. It needs to be more configurable, both in how we interact with it and how it behaves.
gpt-repl
is a customizable REPL-like interface to GPT based tech. Multiple backends (or "modes") are supported, including ChatGPT, raw GPT-3, and a ChatGPT copycat called SynthChat.
SynthChat has similar behavior to ChatGPT, but offers a lot more control. For example, you can:
- Write the prefix of the next response
- Give instructions that will always be followed and never forgetten
- Control its persona (name, bio, personality)
- Set the randomness (or "temperature") of its responses
This project is still in the early stages of development. It will have bugs and frequent breaking changes.
Install
For now, Python >=3.9 is required. Use pip3
instead of pip
if necessary.
pip install -U gpt-repl
If you don't have an OpenAI API key create one here and set it:
export OPENAI_API_KEY="<your api key>"
Usage
gpt-repl @thread-name [-m mode-name]
Use gpt-repl modes
to list available REPL modes and gpt-repl threads
to list open threads.
Inside the REPL, type .help
for a list of commands and keyboard shortcuts. This is the current output of .help
:
Commands
.clear or .cl: Clears the terminal screen.
.copy or .cp: Copies the first code block in the most recent response to the clipboard.
.debug or .db: Triggers a breakpoint in the mode backend.
.editor or .e: Opens the current message in the text editor specified by $EDITOR.
.exit: Closes the REPL.
.help or help: Prints a list of available commands and a brief description of each.
.print or .pp: Prints the internal prompt representation
.publish or .pub: Publishes the current thread online and prints the URL.
.retry: or .r: Resubmits the most recent successful response.
.rename: Renames the current thread. The new name must be provided as an argument to this command, e.g. ".rename my_new_name". The old thread isn't deleted.
.reset or .rs: Resets the history of the thread.
.seed or .s: The text following .seed will be set as the conversation seed. Set no text to clear the seed.
.thread or .name: Prints the current thread name.
.threads: Lists all threads.Shortcuts
Enter: Submits the current message.
Tab: Adds a new line.
C+c: Closes the REPL.
C+d: Closes the REPL.
C+r: Search message history.
C+x-C+e: Opens the current message in the text editor specified by $EDITOR.Tips:
To shape your conversation, consider setting a conversation seed using the
.seed DESCRIPTION
command. Some examples:
.seed You must use Markdown headers on every message
.seed You must contantly use exclamation marks
.seed You must speak in rhymes
Seeds work best when set early in a conversation and are best phrased as commands.
If you don't like the most recent response, retry it with
.retry
If the thread has gone completely off the rails, reset it with
.reset
Many commands have shorter aliases e.g.
.seed
has.s
. See the command list for more info.
Custom Modes
Add a Python file that looks like this to $GPT_REPL_CONFIG_PATH/plugins/
. By default this will be ~/.config/gpt_repl/plugins/
.
See gpt_repl/modes for more complete examples.
Development
To install gpt-repl
from source:
git clone git@github.com:veered/gpt-repl.git
cd gpt-repl
pip install -U flit
flit install -s
Screenshot
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gpt_repl-0.4.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b67900c124f22c83844253f74e3219b0969c31538715ef6efd82c1032eb04f05 |
|
MD5 | 904d2ecae7cbc9074b85759f5bc467e8 |
|
BLAKE2b-256 | 08880171a07f8e7e22985d16ad93aecfe5dd5f106c2e277082b5059180ab5724 |