Skip to main content

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 / postgresql installed.

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 hashes)

Uploaded Source

Built Distribution

lit_data_layers-0.1.4-py3-none-any.whl (11.4 kB view hashes)

Uploaded Python 3

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