KAG  by OpenSPG

Logical reasoning framework for domain knowledge bases

created 10 months ago
7,540 stars

Top 7.0% 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

5 days ago

Responsiveness

1 day

Pull Requests (30d)
5
Issues (30d)
37
Star History
836 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), and
7 more.

mindsdb by mindsdb

0.5%
35k
AI query engine for federated data sources
created 7 years ago
updated 1 day ago
Feedback? Help us improve.