January 1, 2024SHOWCASE · LLM
App template:

GCP Logo Deploy with GCP | Render Logo Deploy with Render

RAG pipeline run locally with up-to-date knowledge: get answers based on documents stored locally

This pipeline is similar to the contextful pipeline, but relies on local computations, rather than querying external API. To do that it uses HuggingFace for the chat model and Sentence Transformers for the embedding model.

How to run the project

Setup environment:

Set your env variables in the .env file placed in this directory.

PATHWAY_DATA_DIR= # If unset, defaults to ./data/. If running with Docker, when you change this variable you may need to change the volume mount.
PATHWAY_PERSISTENT_STORAGE= # Set this variable if you want to use caching

Run with Docker

To run jointly the Alert pipeline and a simple UI execute:

docker compose up --build

Then, the UI will run at http://0.0.0.0:8501 by default. You can access it by following this URL in your web browser.

The docker-compose.yml file declares a volume bind mount that makes changes to files under data/ made on your host computer visible inside the docker container. The files in data/live are indexed by the pipeline - you can paste new files there and they will impact the computations.

Run manually

Alternatively, you can run each service separately.

Make sure you have installed poetry dependencies.

poetry install --with examples

Then run:

poetry run python app.py

If all dependencies are managed manually rather than using poetry, you can alternatively use:

python app.py

To run the Streamlit UI, run:

streamlit run ui/server.py --server.port 8501 --server.address 0.0.0.0

Querying the pipeline

To query the pipeline, you can call the REST API:

curl --data '{
  "user": "user",
  "query": "How to connect to Kafka in Pathway?"
}' http://localhost:8080/ | jq

or access the Streamlit UI at 0.0.0.0:8501.