Back to projects

AI / Retrieval application

RAG Agent

A Streamlit document assistant using recursive text splitting, MiniLM embeddings, persistent Chroma cosine search, document selection, and optional web-search augmentation.

PythonStreamlitChromaMiniLMLangChain
View repository
RAG AGENT
DOCUMENTS → RETRIEVAL → GROUNDED ANSWERS

01 / COMPONENTS & DATA FLOW

Inside the system.

  1. 01Files → text
  2. 02Chunks → MiniLM
  3. 03Chroma retrieval
  4. 04Guardrails + answer

Multi-format ingestion

DocumentProcessor reads PDFs, Word documents, spreadsheets, JSON, CSV, Markdown, and text. Its default splitter uses 1,000-character chunks with 200-character overlap and preserves metadata.

Persistent semantic index

VectorStore embeds chunks with all-MiniLM-L6-v2 and stores them in a Chroma PersistentClient collection configured for cosine distance. Ingestion validates chunks, checks generated IDs, and adds records in batches.

Inspectable answer path

RAGPipeline checks the query, retrieves candidates, applies selected-document filtering, optionally searches the web, and builds an answer with separate document and web source collections.

02 / IMPLEMENTATION DECISIONS

Why it works this way.

Evidence and answer travel together

The result includes context quality, source records, guardrail warnings, and per-request metrics such as processing time and retrieved source counts. Those fields let the UI expose the route to an answer.

Selection filtering has a limit

The pipeline retrieves twice the requested candidate count and then filters by selected filenames. A highly selective request can still return fewer passages than requested.

03 / SCOPE & TRADEOFFS

The implementation boundary.

A public application implementation, not evidence of measured production throughput. Filename selection is a retrieval preference and should not be described as tenant authorization.

04 / READ THE IMPLEMENTATION

Follow it into the code.