All-in-One Wrapper: rag_complete.py

Overview

The rag_complete.py script acts as the “Easy Button”. It combines the entire pipeline—reading documents, embedding, and inference chatting—into a single executable file.

Flow / Behavior

The script auto-detects if the database exists to decide whether to run the Ingestion phase or jump straight to Inference.

graph TD
    A["Start"] --> B{"Database Found?"}
    B -->|No / Re-run| C["📥 Ingestion Phase"]
    B -->|Yes| D["💬 Inference Phase"]
    
    subgraph "Ingestion Phase"
    C --> C1["Load Embedding Model"]
    C1 --> C2["Read 'docs' folder"]
    C2 --> C3["Split into Parent/Child Chunks"]
    C3 --> C4["Generate Vectors"]
    C4 --> C5["Save FAISS Index & Metadata"]
    end

    subgraph "Inference Phase"
    D --> D1["Load LLM & FAISS"]
    D1 --> D2["Wait for User Query"]
    D2 --> D3["Search Vector DB"]
    D3 --> D4["Retrieve Parent Context"]
    D4 --> D5["Generate Answer"]
    end

Usage Examples

python rag_complete.py

Last Updated: 2026-05-01