Skip to content

Chainlit Data Persistency

The Chainlit data layer allows you to persist conversations in chainlit. This project uses a dockerized fork for easier deployment and setup.

In OpenRAG, one can activate Chainlit data layer following these steps:

In fact, chainlit authentication is necessary for data persistency. Set chainlit authentication if not already done (refer to the chainlit auth guide)

To deploy the Chainlit data layer service, add the following variable:

.env
# Persistency services: postgres (localstack (AWS emulator deployed locally)
CHAINLIT_DATALAYER_COMPOSE=extern/chainlit-datalayer/compose.yaml

This provides 2 services:

  • a postgres database to store users, feedback, chat history, etc
  • “s3 bucket” emulator to store elements (files attached in the chat).
  • Variables for the postgres data
.env
DATABASE_URL=postgresql://root:root_password@rdb:5432/chainlit
  • Variables for chainlit to use the S3 Bucket Add the following variables to your .env so that chainlit can use them to connect to the locally deployed S3 bucket
.env
## S3 bucket configuration.
BUCKET_NAME=my-bucket
APP_AWS_ACCESS_KEY=random-key
APP_AWS_SECRET_KEY=random-key
APP_AWS_REGION=eu-central-1
DEV_AWS_ENDPOINT=http://localstack:4566