KAG  by OpenSPG

Logical reasoning framework for domain knowledge bases

Created 1 year ago
7,884 stars

Top 6.6% on SourcePulse

GitHubView on GitHub
Project Summary

KAG is a framework for building logical reasoning and factual question-answering solutions for specialized knowledge bases, targeting professional domains. It aims to overcome limitations of traditional RAG by integrating knowledge graphs and logical forms, enabling multi-hop reasoning and factual accuracy.

How It Works

KAG employs a "Knowledge and Chunk Mutual Indexing" structure to integrate contextual text with knowledge graphs. It uses conceptual semantic reasoning for knowledge alignment, mitigating noise from OpenIE. A schema-constrained approach supports expert knowledge representation. The core is a logical form-guided hybrid reasoning and retrieval engine with planning, reasoning, and retrieval operators, allowing mixed execution of exact match, text retrieval, numerical calculation, and semantic reasoning.

Quick Start & Requirements

  • Product Mode: Requires Docker and Docker Compose. Download docker-compose-west.yml and run docker compose -f docker-compose-west.yml up -d. Access at http://127.0.0.1:8887 with default credentials openspg/openspg@kag.
  • Developer Mode: Requires Python 3.8+ (Windows) or 3.10+ (macOS/Linux), Git, and Conda (macOS/Linux). Clone the repo, create a Conda environment (or venv), and install with pip install -e ..
  • System Requirements: macOS Monterey 12.6+, CentOS 7/Ubuntu 20.04+, or Windows 10 LTSC 2021+. WSL 2/Hyper-V needed for Windows Docker.

Highlighted Details

  • Introduced "Simple Mode" and "Deep Reasoning" for optimized user experience.
  • Supports streaming inference output and automatic rendering of graph indexes.
  • Includes an open_benchmark directory for comparing RAG methods.
  • Offers a "Lightweight Build" mode reducing knowledge construction costs.

Maintenance & Community

  • Active development with recent updates in April 2025.
  • Future plans include conversational tasks, model releases, and front-end open-sourcing.
  • Community channels include GitHub, a website, Discord, and WeChat.

Licensing & Compatibility

  • Licensed under Apache License 2.0.
  • Permissive license suitable for commercial use and integration with closed-source projects.

Limitations & Caveats

  • The kag-model component is not yet open-sourced.
  • The framework is still evolving, with version 0.7 released in April 2025.
Health Check
Last Commit

1 month ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
17
Star History
259 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.