Back to Projects
RAG Platform

Enterprise RAG Platform

High-precision hybrid vector retrieval over 5M+ knowledge records with GraphRAG knowledge graph traversals.

πŸ“– Project Overview

This project delivers a production-grade Retrieval-Augmented Generation (RAG) platform. It utilizes a hybrid retrieval strategy combining sparse keyword matching (BM25) with dense vector searches on Weaviate, followed by metadata filters and a re-ranking pipeline.

To address context limits and cross-document dependencies, it implements GraphRAG utilizing a Neo4j graph schema to map conceptual entities and their relationships. This allows the system to traverse multi-hop connections, providing contextually rich prompts to LLMs and cutting hallucination rates significantly.

βš™οΈ Deployment Checklist & Runbook

1

Initialize Weaviate Schema

Create schemas for vector indexes, configuring HNSW search parameters and distance metrics:

python
import weaviate

client = weaviate.Client("http://weaviate.rag-system.svc:8080")
class_obj = {
    "class": "DocumentChunk",
    "vectorizer": "text2vec-openai",
    "vectorIndexConfig": {
        "distance": "cosine",
        "efConstruction": 128,
        "maxConnections": 64
    }
}
client.schema.create_class(class_obj)
2

Deploy Graph Schemas (Neo4j)

Establish graph constraints to ensure unique index keys for entities during imports:

cypher
CREATE CONSTRAINT unique_entity IF NOT EXISTS
FOR (e:Entity) REQUIRE e.id IS UNIQUE;

CREATE INDEX relationship_type FOR ()-[r:RELATED_TO]-() REQUIRE r.weight IS DEFINED;
3

Setup Ingestion Service

Provision the ingestion backend with hybrid index scaling triggers:

bash
helm install rag-ingestion charts/rag-ingestion \
  --set replicaCount=3 \
  --set resources.requests.memory="2Gi" \
  -n rag-platform

πŸ”„ Configuration & Key Parameters

Param Key Module Location Purpose
WEAVIATE_URL config.py The target URL for the vector repository.
NEO4J_URI config.py Database connection address for entity mappings.
HYBRID_ALPHA retriever.py Alpha parameter (0=BM25 only, 1=Vector only, 0.5=Equal weight).
RERANK_MODEL reranker.py The cross-encoder model to re-evaluate top retrieval matches.

πŸ“Š Architectural Workflow

graph TD
    Docs[Ingested Documents] -->|Split / Chunk| Embedder[Embeddings Engine]
    Embedder -->|Upload Vectors| Weaviate[(Weaviate DB)]
    Docs -->|Extract Entities| GraphExtract[Graph Compiler]
    GraphExtract -->|Upload Relations| Neo4j[(Neo4j DB)]
    
    Query[User Query] -->|Hybrid Retrieval| Weaviate
    Query -->|Multi-Hop Path| Neo4j
    Weaviate -->|Top Candidates| Reranker[Re-ranking Model]
    Neo4j -->|Context Graph Nodes| Reranker
    Reranker -->|Synthesized Context| Generator[LLM Generation Node]
    Generator -->|Final Answer| User([Response])
            

πŸ› οΈ Useful CLI Reference

# Run schema indexing script: python scripts/index_documents.py --dir ./data # Monitor Weaviate container nodes: curl -s http://localhost:8080/v1/nodes # Audit Graph constraints in Neo4j: cypher-shell -u neo4j -p password "SHOW CONSTRAINTS;" # Test retrieval latency performance: pytest tests/test_retrieval.py -s
πŸ“‹ Code copied to clipboard!