Work public

rag-hybrid-chatbot

Hybrid RAG combining Vector Search and Knowledge Graph with adaptive query routing and CRAG. Upload PDF, MD, or TXT, ask, get cited answers.

  • rag
  • hybrid
  • knowledge-graph
  • qdrant
  • networkx
  • crag
  • citations
Repo
github.com/mj-deving/rag-hybrid-chatbot
Published
2026-05-26

The problem

Vector search and knowledge graphs answer different questions. Vector search finds passages semantically close to a query. Knowledge graphs find entities and the relationships between them. A real user query often needs both: a passage to read and an entity graph to reason over.

Most RAG implementations pick one and pretend the other is not needed.

How it works

The pipeline ingests a document, extracts entities and relationships into a NetworkX graph, and embeds chunks into Qdrant. At query time an adaptive router decides whether this query benefits from vector context, graph context, or both. CRAG sits above the retrieval as an opt-in quality gate that flags weak retrievals before they hit the model.

Every answer carries citations to the source chunks. Upload a PDF, an MD, or a TXT. Ask a question. Get an answer with sources attached.

Stack

Python backend with FastAPI. Qdrant for vectors. NetworkX for the graph. CRAG as the quality gate. Source-cited responses are the default, not an option.