KnowledgeNode tree
Documents are represented as headings, paragraphs, tables, figures, notes, and warnings. Tables remain atomic and hierarchy is preserved through parent identifiers and heading paths.
FoundryRAG is a hybrid retrieval system designed for industrial and engineering documents. It preserves hierarchy, reconstructs full sections, exposes the complete retrieval trace, and runs with either Microsoft Foundry Local or Azure AI services.

The project was built as an observable retrieval system with explicit architectural controls, measurable behavior, and source-level verification.
Documents are represented as headings, paragraphs, tables, figures, notes, and warnings. Tables remain atomic and hierarchy is preserved through parent identifiers and heading paths.
Retrieved evidence is not sent as an isolated sentence. Sibling nodes from the same parent section are reconstructed to restore complete technical context.
When confidence is low, the system performs at most one additional retrieval round without entering an unpredictable agent loop.
If reliable generation is not possible, FoundryRAG returns an explicit failure message and still exposes the retrieved references.
The interface exposes nodes, sources, pages, rerank scores, query tracks, retrieval hops, and stage-level latency.
Node-tree and entity-graph logic stay local while retrieval and generation backends can switch between local and Azure services.
The same structural and retrieval logic can be executed locally or with Azure services.

FastAPI connects the chat interface, ingestion pipeline, retrieval system, SQLite storage, entity graph, and local or cloud LLM backends.

Local mode uses SQLite, SentenceTransformer, and Foundry Local. Cloud mode integrates Azure Blob Storage, Azure AI Search, and Azure OpenAI.
Each stage has a focused responsibility and is observable through interface telemetry.
PDF, DOCX, Markdown, and XLSX files are parsed into a KnowledgeNode tree. Hash deduplication prevents repeated ingestion and an entity graph is created.
The question is rewritten into up to three domain-agnostic variants. Embeddings can be generated locally or through Azure OpenAI.
BM25 captures exact terminology while dense search captures semantic similarity. Reciprocal Rank Fusion combines both result sets.
A cross-encoder reranks candidates. The grader applies deduplication, keyword overlap, and score filtering.
Full parent sections are reconstructed. If confidence remains low, one bounded follow-up retrieval hop is allowed.
The final context is sent to Foundry Local or Azure OpenAI. Loop detection and honest failure handling protect answer reliability.

Typed node extraction, structure-aware chunking, deduplication, storage, and entity graph construction.

Query rewrite, hybrid retrieval, reranking, grading, context optimization, bounded follow-up, and generation.
The advanced pipeline was compared against a naive dense baseline using the same evaluation set and Top-5 configuration.
| Pipeline | Precision@5 | Recall@5 | MRR |
|---|---|---|---|
| Naive dense retrieval | 0.857 | 0.857 | 0.857 |
| Advanced FoundryRAG | 0.893 | 0.982 | 0.905 |

Every major stage is measured and displayed.

Selected context, rerank scores, filters, and source evidence are available for inspection.
FoundryRAG exposes how evidence was found, ranked, reconstructed, and used.
Shows selected nodes, node type, document, reranking score, and context membership.
Source citations open the original technical document for direct verification.
Technical terms and section-level relationships are visualized as a discovery layer.




The interface combines knowledge-base management, technical QA, source evidence, explainability, and live telemetry.




Explore individual processing stages, reports, evaluation assets, and roadmap.

Domain-agnostic rewriting and local or Azure embeddings.

BM25 and dense retrieval with Reciprocal Rank Fusion.

Reranking, grading, compression, reconstruction, and adaptive budgeting.

Confidence-based bounded multi-hop retrieval.

Grounded prompt construction, loop detection, and telemetry.
FoundryRAG moves beyond flat chunk retrieval by combining typed document structure, hybrid search, adaptive reconstruction, bounded multi-hop reasoning, source inspection, entity exploration, and cloud-ready deployment.