A collection of data layers for Chainlit, persist state on your own infrastructure!
Project description
lit-data-layers
Provides Custom Data Layer for Chainlit apps. Supports multiple databases and data stores.
Installation
PostgreSQL
Note: Make sure you have
libpq-dev/postgresqlinstalled.
pip install "lit-data-layers[postgres]"
export LIT_DATABASE_URL=postgresql+asyncpg://user:pass@localhost/test
SQLite
pip install "lit-data-layers[sqlite]"
export LIT_DATABASE_URL=sqlite+aiosqlite:///db.sqlite3
Usage
import asyncio
import chainlit.data as cl_data
from lit_data_layers.sqldb import SqlDataLayer
layer = SqlDataLayer()
asyncio.get_event_loop().run_until_complete(layer.initialize_database())
cl_data._data_layer = layer
Compatibility Chart
Features that have been tested.
| Method | SQLite | PostgreSQL |
|---|---|---|
| get_user | ✅ | |
| create_user | ✅ | |
| delete_user_session | ||
| upsert_feedback | ✅ | |
| create_element | ||
| get_element | ||
| delete_element | ||
| create_step | ✅ | |
| update_step | ||
| delete_step | ||
| get_thread | ✅ | |
| get_thread_author | ✅ | |
| delete_thread | ✅ | |
| list_threads | ✅ | |
| update_thread | ✅ |
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
lit_data_layers-0.1.4.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lit_data_layers-0.1.4.tar.gz.
File metadata
- Download URL: lit_data_layers-0.1.4.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
986e4126d91adf49d1cdeacbfc5637b9932916ece98c3e65fafde6b396149fda
|
|
| MD5 |
9002a1ebfe0e242203e125191c5c9a81
|
|
| BLAKE2b-256 |
f8c9e0cae230c3254b71794d965207d97597ce83f593813a097f4a9bf027dbb0
|
File details
Details for the file lit_data_layers-0.1.4-py3-none-any.whl.
File metadata
- Download URL: lit_data_layers-0.1.4-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae31b26f47c79657438aa246191c91cffc3bf0833373e3d962178d3fa979e9c3
|
|
| MD5 |
adacb8a9bc2a108be9e48712e75ca785
|
|
| BLAKE2b-256 |
8c34568825745da0ff5cf267d97a8f85249ad9d4edb6b27e1b59c61ff97961e7
|