ProjectBuild an AI-Powered Digital Bank with RAG: the explanation · Module 8: Document ingestion, from file to chunks · part 10 of 20
Part 10 · Module 8: Document ingestion, from file to chunks

Module 8: Document ingestion, from file to chunks

24 min read·
About 40 minutes · Needs: Module 6 (auth and roles), Module 5 (the data model for documents and chunks) helps · Code: backend/app/rag/ingest.py, backend/app/rag/parsing.py, backend/app/rag/chunking.py, backend/app/api/routes/documents.py

Where this fits

WHERE THIS FITS The Kestrel Bank system this module CLIENT API LAYER FastAPI SAFETY AGENT LangGraph MODELS RETRIEVAL DATA AND INGESTION Postgres, Redis QUALITY Langfuse Customer app React Admin app React FastAPI REST + streaming Auth + RBAC tokens, roles Document upload admin only, checked Guardrails injection, PII Router small or large Agent LangGraph Banking tools ledger, transfers LLMs Groq, Gemini Retrieval hybrid + rerank Ingestion parse, chunk, embed PostgreSQL + pgvector ledger, chunks, state Redis limits, queue Observability Langfuse, metrics, logs Evaluation golden set, release gate
Ingestion (blue) runs from the admin's upload through the API and Redis queue into Postgres, where retrieval later finds it.

The assistant can only quote rules that are in its index. This module is how a rule gets there: an admin uploads a file, and a pipeline turns it into small, searchable pieces in Postgres. Module 9 then retrieves the right pieces. If ingestion gets a heading or a table wrong, every later answer built on it is wrong too.

The rest of this project is yours to keep

This project is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan