Skip to main content

Command line REPL for GPT-based tools

Project description

gpt-repl

Interactively play with GPT-based tools from the command line

PyPi License

Description

gpt-repl is a REPL interface for interacting with GPT-based tools. The base mode is synth-chat which mimics ChatGPT functionality using the normal OpenAI GPT-3 API and iterative self-summary.

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

Screen Shot 2022-12-16 at 6 09 31 PM

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpt-repl-0.4.16.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gpt_repl-0.4.16-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file gpt-repl-0.4.16.tar.gz.

File metadata

  • Download URL: gpt-repl-0.4.16.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for gpt-repl-0.4.16.tar.gz
Algorithm Hash digest
SHA256 f783d687dcdb8c34976061c33d262b4f4d090167bbf756562e9bc9ac2e981a85
MD5 a2c689d7b5ed6428246fdb8f25ad6ea9
BLAKE2b-256 383b61b3cbf5a4a92d0d283e1909dc63b90783b921425ea718d8430b140df991

See more details on using hashes here.

File details

Details for the file gpt_repl-0.4.16-py3-none-any.whl.

File metadata

  • Download URL: gpt_repl-0.4.16-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for gpt_repl-0.4.16-py3-none-any.whl
Algorithm Hash digest
SHA256 6f6f2e522622cb2f18638a667c6e8279b404e9caa4c9d0304173389299baea1b
MD5 8d1702e0bce769f4d70cdd1de15bfb1e
BLAKE2b-256 20c8ba0e7d414cc14d1c226f9acdab2baa5a6e17c71acaea23bbf446b7eed965

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page