This is an early release preview. You may encounter bugs.
KGGen logo
Unclaimed

Tool memory data-wrangling

KGGen

Most teams still treat text and chat logs as flat strings. kg-gen turns them into a usable knowledge graph in one call:

C 47/100 GitHub score ? This grade is derived from GitHub signals, not user votes. Open for the full breakdown.
Discussion

01 / Summary

About KGGen.

Kg Gen is a Python library that extracts knowledge graphs from plain text with a language model. You pass in a string or a list of chat messages, and it returns the entities, the relation types, and the subject, relation, object triples it found. Uses include building a graph to support retrieval-augmented generation (RAG), generating synthetic graph data for model training and testing, and analyzing how concepts in a text relate.

Long inputs can be split into chunks, and similar entities and relations can be clustered (for example merging "AI" with "artificial intelligence") during generation or afterward, optionally guided by a context string. Separate graphs can be aggregated into one. For conversations, role information and message order are preserved, so relations can link speakers to the concepts they mention.

Model calls go through LiteLLM, so any provider it supports works, including OpenAI, Anthropic, Gemini, DeepSeek, and local models through Ollama, with an optional custom API base URL. Structured output is generated with DSPy. The project also ships an MCP server that gives AI agents persistent graph memory, a graph visualizer, and MINE, a benchmark for knowledge graph extraction described in the accompanying paper.

  • Text to graph: extracts entities, relation types, and triples from plain text in one call
  • Conversation input: processes message arrays while keeping roles and message order
  • Chunking: splits large texts into chunks of a set size before extraction
  • Clustering: merges near-duplicate entities and relations, optionally guided by context
  • Graph aggregation: combines several generated graphs into one
  • Model choice: any LiteLLM provider, including OpenAI, Anthropic, Gemini, DeepSeek, and Ollama
  • Visualization: renders a graph to an HTML view in the browser
  • MCP server: exposes graph memory to AI agents and MCP clients
  • MINE benchmark: an evaluation for knowledge graph extraction quality

02 / Discussion CREDIBILITY-GATED

Discussion

Reading is open to everyone. Posting and voting need a verified identity or a GitHub grade of B or higher.

  • No discussions yet.

04 / Build

Build with KGGen.

Browse the catalog for frameworks, tools, and harnesses, each scored on real GitHub credibility.

Get KGGen →

Browse the catalog