KAG

Stale
GitHub Python Apache-2.0

Description

KAG is a logical form-guided reasoning and retrieval framework based on OpenSPG engine and LLMs for building logical reasoning and factual Q&A solutions for professional domain knowledge bases, effectively overcoming the limitations of traditional RAG vector similarity models.

Key Features

  • Bidirectional knowledge-text indexing: KG nodes cross-reference original text chunks for complete context preservation
  • Logic form-guided hybrid reasoning: transforms natural language into formal logical inference combining exact match, text retrieval, numerical computation, and semantic reasoning
  • Schema-constrained knowledge construction: supports both free-form information extraction and structured domain expert knowledge representation
  • Conceptual semantic alignment: leverages semantic reasoning to mitigate noise from OpenIE extraction
  • Multi-hop factual Q&A: supports complex cross-entity multi-hop reasoning scenarios
  • Dual-mode private and public knowledge bases: integrates LBS, WebSearch and other public data sources via MCP protocol

Use Cases

💡 Medical domain Q&A: combining clinical guidelines and case knowledge bases for evidence-based medical reasoning
💡 Legal compliance review: cross-referencing regulations in a knowledge base for compliance assessment
💡 Enterprise knowledge management: integrating unstructured documents with structured business data into a unified knowledge graph
💡 Financial research analysis: extracting facts from reports and performing logical reasoning to generate investment insights

Categories

Quick Start

1. Install Docker and Docker Compose
2. Download docker-compose.yml and start services: docker compose up
3. Access the KAG interface via Web UI
4. Create a knowledge base and upload documents
5. Choose Simple Mode or Deep Reasoning mode for Q&A

Related Projects