Skip to main content

ChatPlayground for LLMs

Project description

Chat Playground

Twitter Follow pypi python Build Status codecov License

A simple local chat playground with power user features. All messages are stored as JSON files in a local directory, making it easy to sync them with a cloud service like Dropbox or Google Drive and access them from multiple devices while protecting your privacy.

Motivation

The ChatGPP web app is a great way to play with LLMs, but it has a few limitations:

  • It's not possible to edit messages without deleting everything below.
  • It's hard to see what the explored alternatives are for a given message.
  • It's hard to see what the explored alternatives are for a given message thread.
  • It's not possible to change the model settings or the model type (GPT3.5/4) later on.

Installation

Node.JS

To install Chat Playground, first, make sure you have Node.js installed. You can use conda to install Node.js as follows:

conda install -c conda-forge nodejs

Or, to install a specific version of Node.js (this one worked for me on my MacBook---so this will not work on Linux):

conda install -c conda-forge nodejs=18.15.0=h26a3f6d_0

Chat Playground

Once Node.js is installed, you can install Chat Playground using pip or pipx (if you have nodejs available in your base environment):

pipx install chatplayground

OpenAI Key :key:

Ensure that your OpenAI key is set in an OPENAI_API_KEY environment variable. You then can run the playground with

chatplayground

Features

  • Preview of possible alternative message threads as an exposee view.
  • Preview of possible alternatives at the message level.
  • Editing messages within a message thread without deleting everything below.
  • Forking message threads (similar to the ChatGPT web app).
  • Messages stored as JSON files in a local directory.
  • Easy sync with cloud services like Dropbox or Google Drive.
  • Real-time updates from the filesystem to the UI.
  • Atomic changes of the stored messages.

Screenshots

./docs/app_interface.png

./docs/message_alternatives.png

./docs/thread_exposee.png

Code & Layout

This project was written in ~25 hours using Pynecone. The code is currently in one big Python file, which may benefit from refactoring into a package with multiple files. However, the code is mostly simple and it was quite productive to keep everything together.

There are a few issues with the current code (in part due to Pynecone's early stage of development):

  • No tests currently.
  • Calling event functions in State classes requires passing self, even though it shouldn't: self.state_event_function(self).
  • Issues with streaming events from the OpenAI request to the UI, requiring a hacky workaround for updates to propagate to the UI correctly.
  • Known Pynecone issues, as mentioned in the code.

Despite these issues, the project came together very quickly with PyneCone and works quite well.

Documentation

Contributing

Bug fixes, feature requests, and pull requests are welcome! If you have any questions or suggestions, please open an issue on GitHub.

License

Chat Playground is licensed under AGPL3.0. If you require a commercial license for any part of the project, please contact the author.

Hopefully, this project will inspire new UX paradigms for working with LLMs in the future.

Credits

This package was created using PyneCone with Cookiecutter and the waynerv/cookiecutter-pypackage project template.

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

chatplayground-1.2.0.tar.gz (81.6 kB view details)

Uploaded Source

Built Distribution

chatplayground-1.2.0-py3-none-any.whl (81.3 kB view details)

Uploaded Python 3

File details

Details for the file chatplayground-1.2.0.tar.gz.

File metadata

  • Download URL: chatplayground-1.2.0.tar.gz
  • Upload date:
  • Size: 81.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for chatplayground-1.2.0.tar.gz
Algorithm Hash digest
SHA256 d7705b001020af81212da961a572efb0aad446bc8b87b85ab82bcbc6b93d0a29
MD5 397b79fcf09590404583bfbfa6c0a5b9
BLAKE2b-256 33ddbdcd3c868bd4cf2206c82e9df15da5fbc644b0ca12b6774663da0a5b3345

See more details on using hashes here.

File details

Details for the file chatplayground-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chatplayground-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 613612f6c5d48cfae2615bdf7163af914d93b7a1c26ea35d7b342a75b3cedf13
MD5 cb1d4b293a3ad75feffa5b031d28d213
BLAKE2b-256 42392d496072e0d9db42736c6895ae0c700affd7f9a94b2b1c84a949501f3c72

See more details on using hashes here.

Supported by

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