How omarkhaled4418/rag-chat works
RAG Chat is a headless REST service for ingesting documents and answering questions from their indexed content. Clients upload PDF/TXT files or submit raw text; the API delegates ingestion to the RAG engine, which extracts and chunks text before indexing it. Search uses hybrid keyword and FAISS retrieval; chat passes retrieved context and session history to an OpenAI-compatible LLM, with JSON and SSE response modes. The API also exposes document, index, health, and history management. Relationships reflect the sampled source and README; unsampled route details are represented only where documented.
Main entry points: rag_engine.py RAG Orchestrator · routes.py REST Routes · vector_store.py Hybrid Vector Store · llm.py LLM Client
Components 13
HTTP API
- REST Routes
app/routes.py - RAG Orchestrator
app/rag_engine.py - Runtime Configuration
app/config.py
Document Ingestion
- File Ingestion
app/routes.py - Raw Text Ingestion
app/routes.py - Text Extraction
app/pdf_parser.py - Text Chunking
app/chunker.py
Retrieval and Index
- Hybrid Vector Store
app/vector_store.py - Embedding Model
app/embedder.py
Answer Generation
- Session History
app/chat_history.py - LLM Client
app/llm.py - OpenAI-Compatible LLM
Other components
- HTTP Client
Connections 16
- HTTP Client → REST Routes: sends requests
README.md - REST Routes → RAG Orchestrator: dispatches operations
app/routes.py - REST Routes → Runtime Configuration: reads settings
app/routes.py - REST Routes → Session History: manages sessions
README.md - REST Routes → File Ingestion: accepts files
README.md - REST Routes → Raw Text Ingestion: accepts text
app/routes.py - File Ingestion → RAG Orchestrator: invokes ingestion
app/routes.py - Raw Text Ingestion → RAG Orchestrator: invokes ingestion
app/routes.py - RAG Orchestrator → Text Extraction: extracts text
app/rag_engine.py - RAG Orchestrator → Text Chunking: chunks pages
app/rag_engine.py - RAG Orchestrator → Hybrid Vector Store: indexes and searches
app/rag_engine.py - Hybrid Vector Store → Embedding Model: generates embeddings
app/vector_store.py - RAG Orchestrator → Session History: reads and saves turns
app/rag_engine.py - RAG Orchestrator → LLM Client: generates answers
app/rag_engine.py - LLM Client → OpenAI-Compatible LLM: sends completions
app/llm.py - REST Routes → RAG Orchestrator: manages documents and index
README.md