How noovoy-ai/northwestern-rag-backend works
Purpose and Entrypoint
This is a Python retrieval-augmented question-answering service over handbook/manual content. The runtime entrypoint is main.py; its browser-facing interface is static/index.html. Source material, chunk artifacts, and a persisted Chroma vector database are committed alongside the service.
Query/API Layer
main.py likely owns application startup, request handling, retrieval invocation, and response generation. It forms the boundary between the static client at static/index.html and backend AI/vector dependencies. Environment-provided credentials are modeled by .env.example.
Document Ingestion Pipeline
Content is prepared through dedicated ingestion scripts:
• ingest.py
• ingest_manual.py
• handbook_vectordb_ready.md
These stages convert the handbook/manual into retrieval-ready chunks and populate the vector store. manual_chunks.json is an intermediate or inspectable chunk representation, while all.md appears to be a consolidated source document.
Persistent Vector Retrieval Store
Chroma is the system’s durable retrieval boundary. Its persisted local state is under:
• chroma_db/chroma.sqlite3
• chroma_db/91b81201-fb56-4dd5-a54b-ed174626aace/data_level0.bin
• chroma_db/a68aae4c-635f-4534-b922-0e09514fd3a3/link_lists.bin
The application queries this embedded database at runtime; ingestion mutates it. This makes vector data a deployable stateful artifact rather than an externally managed database.
Export/Portability Path
export_db.py exports the persisted vector collection, with vectordb_export.json serving as an interchange or backup artifact. This provides a path to inspect, migrate, or reconstruct retrieval data independently of the binary Chroma files.
Runtime and Deployment
The application is containerized by Dockerfile and composed through docker-compose.yml, likely including persistent storage for the local Chroma directory. Python dependencies are declared in requirements.txt. CI/CD deployment automation is defined in .github/workflows/deploy.yml.
Primary Flow and Boundaries
1. Manual content in all.md/handbook_vectordb_ready.md is chunked by ingestion scripts.
2. Chunks and embeddings are persisted to chroma_db/.
3. A user interacts through static/index.html.
4. main.py receives the query, retrieves relevant chunks from Chroma, and uses configured AI services to produce an answer.
5. Retrieval artifacts can be exported through export_db.py.
Key boundaries are browser-to-backend HTTP, backend-to-vector-store retrieval, and backend-to-external model/embedding services configured via environment variables.
Main entry points: main.py QA application · chroma.sqlite3 Chroma vector store · docker-compose.yml Service composition · manual_chunks.json Manual chunks
Components 17
Ingestion pipeline
- Consolidated manual
all.md - Prepared handbook
handbook_vectordb_ready.md - General ingestion
ingest.py - Manual ingestion
ingest_manual.py - Manual chunks
manual_chunks.json
Query runtime
- Browser client
static/index.html - QA application · Handles queries, retrieval, and answer generation.
main.py - AI credentials
.env.example - Model and embedding APIs
Persistent retrieval data
- Chroma vector store · Durable local retrieval state queried at runtime and written by ingestion.
chroma_db/chroma.sqlite3 - Vector index files
chroma_db/91b81201-fb56-4dd5-a54b-ed174626aace/data_level0.bin - Vector store export
export_db.py - Portable collection export
vectordb_export.json
Container and deployment
- Application image
Dockerfile - Service composition · Runs the application with persistent local vector data.
docker-compose.yml - Python dependencies
requirements.txt - Deployment workflow
.github/workflows/deploy.yml
Connections 17
- Browser client → QA application: HTTP queries
- QA application → Chroma vector store: similarity retrieval
- QA application → Model and embedding APIs: answer generation
- QA application → AI credentials: loads credentials
- Consolidated manual → General ingestion: ingests
- Prepared handbook → Manual ingestion: ingests
- General ingestion → Manual chunks: creates chunks
- Manual ingestion → Manual chunks: creates chunks
- Manual chunks → Chroma vector store: embeds and persists
- Chroma vector store → Vector index files: stores vectors
- Chroma vector store → Vector store export: exports collection
- Vector store export → Portable collection export: writes
- Python dependencies → Application image: installed during build
- Application image → Service composition: runs image
- Service composition → QA application: hosts service
- Service composition → Chroma vector store: persists local state
- Deployment workflow → Service composition: deploys