Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/avnlp/agentic-med-diag/llms.txt

Use this file to discover all available pages before exploring further.

The system runs two retrieval channels concurrently — a semantic channel that operates over dense vector embeddings of document text, and a relational channel that processes entity/relationship triples from the knowledge graph built by the active backend. Both channels receive their inputs from the same initial backend retrieval call, but process fundamentally different evidence modalities in parallel. Once both channels have produced their sub-answers, the parent LangGraph state machine merges their outputs and synthesises a single, grounded final answer. Running the two channels in parallel rather than in sequence minimises latency and ensures that the synthesis step always has access to both text-based and graph-triple evidence before generating a response.

Semantic Channel

The semantic channel is responsible for retrieving and reasoning over text-based evidence — document chunks and reference lists surfaced by the Graph RAG backend’s dense vector search over Milvus embeddings. What it retrieves:
  • Relevant document passages indexed in Milvus and returned by the backend’s vector search
  • Reference document lists that identify the source documents for the retrieved chunks
Pipeline:
1

Sub-Query Grounding

Each semantic sub-query (with any #N back-references resolved from earlier hops) is grounded and prepared for issuance to the retrieval backend.
2

GraphRAG Retrieval

The grounded sub-query is issued to the active Graph RAG backend, which performs dense vector search over Milvus embeddings and returns the relevant document chunks and reference list sections from the structured backend context.
3

Semantic Filter

The retrieved document passages are filtered to remove noise and retain only the most relevant content for the current sub-query, reducing the context window burden for downstream steps.
4

Text Summary

The filtered passages are summarised into a compact representation that distills the key clinical evidence.
5

Sub-Answer Generation

The language model generates a sub-answer for the current hop, drawing on the text summary. This sub-answer is stored as a #N back-reference for subsequent sub-queries.
6

Logic Drafting

The reasoning chain connecting the retrieved text evidence to the sub-answer is made explicit, producing a structured draft of the logical steps taken.
7

Evidence Verification

The drafted logic and sub-answer are evaluated for faithfulness and sufficiency against the retrieved evidence. If coverage is insufficient, a signal is emitted to trigger the conditional expansion edge.
Input from context_filter by backend:
BackendSemantic Channel Receives
LightRAGDocument Chunks + Reference Document List
MiniRAGSources CSV
HyperGraphRAGSources CSV
PathRAGSources CSV

Relational Channel

The relational channel is responsible for retrieving and reasoning over structured entity/relationship triples from the knowledge graph built by the active backend. Rather than surfacing text passages, it processes typed entity/relationship data and returns explicit Subject–Predicate–Object triples as evidence. What it retrieves:
  • Entity nodes and their attributes from the backend’s knowledge graph storage
  • Typed relationship edges connecting query-relevant entities
  • For PathRAG: both high-level (thematic/concept) and low-level (mention-level) entity/relationship layers
Pipeline:
1

SPO Triple Queries

Each relational sub-query is expressed as a Subject–Predicate–Object triple query, with Entity#N placeholders resolved from earlier hops. These structured queries are issued to the Graph RAG backend, which retrieves the relevant triples from its knowledge graph storage (Neo4j for LightRAG; local working-directory storage for MiniRAG, PathRAG, and HyperGraphRAG).
2

KG Filter

The triples returned by the backend are filtered to retain only those most relevant to the current sub-query, removing spurious or low-confidence relationships.
3

Triplet List Summaries

The filtered triples are summarised into a structured list that captures the key entities and relationships in a form consumable by the language model.
4

Sub-Answer Generation

The language model generates a sub-answer for this channel using the summarised triplet evidence, producing the relational channel’s contribution to the synthesis step.
Input from context_filter by backend:
BackendRelational Channel Receives
LightRAGKnowledge Graph Data (Entity) JSON + Knowledge Graph Data (Relationship) JSON
MiniRAGEntities CSV + Relationships CSV
HyperGraphRAGEntities CSV + Relationships CSV (including hyperedges)
PathRAGHigh-level entity/relationship CSVs + low-level entity/relationship CSVs

context_filter

Before either channel begins processing, the parent graph calls context_filter on the raw context returned by the Graph RAG backend. Each backend structures its output differently — LightRAG returns a JSON object with four named sections, while MiniRAG, HyperGraphRAG, and PathRAG return CSV-formatted contexts with varying section layouts. The context_filter function knows how to parse each format and route each section to the correct channel.
Because context_filter encapsulates all format-specific parsing logic, switching between backends at runtime does not require any changes to the channel subgraphs themselves — only the context_filter output changes, and each channel simply receives the same logical inputs (text evidence vs. graph triple evidence) regardless of which backend produced them.
This clean separation ensures that each channel always receives exactly the evidence modality it is designed to process, keeping the semantic and relational pipelines backend-agnostic.

Synthesis

After both channels have completed their iterative retrieval-and-reasoning loops and produced sub-answers, the parent LangGraph state machine merges the two outputs. The synthesis step receives:
  • The semantic channel’s sub-answers and the text evidence that supports them
  • The relational channel’s sub-answers and the knowledge graph triples that support them
The language model uses the combined evidence to generate a single coherent final answer. By grounding the response in both retrieval modalities simultaneously, the synthesis step can resolve ambiguities that either channel alone might miss — confirming a textually implied drug interaction with an explicit SPO triple, or contextualising a graph relationship with a passage that explains its clinical significance.

Backends Overview

Explore the four supported Graph RAG backends — LightRAG, MiniRAG, PathRAG, and HyperGraphRAG — and their graph models.

Architecture

See how the parent LangGraph state machine coordinates the fan-out, parallel execution, and fan-in of both retrieval channels.

Build docs developers (and LLMs) love