Chatbot for chatting with PDFs via a RAG system that provides the LLM with only the relevant document chunks. A chat memory is built in, allowing long discussions with the document.
src/
└── rag
├── __init__.py # Global variables of app
├── __main__.py # Entry point of app
├── cli.py # Entry point of Typer CLI app
├── app.py # Entry point of FastAPI app
├── routes.py # Routes of FastAPI app
├── pipeline.py # Langchain chain functions
├── interface.py # Chainlit interface definitionYou must have installed python3.12 with pip. This project use uv as a virtual environment manager. To install it, run the following command:
pip install --upgrade pip
pip install uvThen, create a virtual environment and install the dependencies:
uv syncIf your IDE don't create the virtual environment automatically, you can create it manually with the following command:
uv venv
source .venv/bin/activateAfter this you must copy paste the .env.example file to .env and fill it with your own values.
cp .env.example .envYou can run the CLI with the following command:
uv run src/ragpython src/ragYou can run the tests with the following command:
pytestYou will find coverage report in the htmlcov folder, just open the index.html file in your browser.
This project use ruff for formatting and linting. You can launch both with uv custom command. To do this, run the following command:
uv run lintThis project use Docker, docker-compose and docker tools for publish and deploy the app.
You can run in local the container with the following command:
docker compose -f compose.prod.yml up --buildYou can update the preprod or prod with the following command:
make update-preprod
