@DanKornas: Your text corpus shouldn’t stay trapped in paragraphs. kg-gen is a Python package for extracting knowledge graphs from …
Summary
kg-gen is an open-source Python package that uses language models (via LiteLLM and DSPy) to extract knowledge graphs from plain text or conversation messages, featuring chunking, clustering, and flexible provider routing.
View Cached Full Text
Cached at: 05/21/26, 05:39 PM
Your text corpus shouldn’t stay trapped in paragraphs.
kg-gen is a Python package for extracting knowledge graphs from plain text or conversation-style message arrays.
It helps you turn raw text into entities, edge labels, and relations by using language models for structured extraction, with LiteLLM for provider routing and DSPy for structured output generation.
Key features:
• Text-to-graph extraction – turns a string into entities, relation types, and subject-relation-object triples • Large-text chunking – process longer inputs in smaller chunks with a chunk_size parameter • Entity + relation clustering – group similar entities and edges during generation or after • Message-array processing – handles role/content messages while preserving order and boundaries • Model-provider flexibility – routes calls through LiteLLM for OpenAI, Ollama, Anthropic, Gemini, Deepseek, and others
It’s open-source (MIT license).
Link in the reply
Similar Articles
@DanKornas: Agent tutorials are noisy. This repo gives you the path. LangGraph 101 is a hands-on tutorial repo for learning LangCha…
LangGraph 101 is an open-source tutorial repo for learning LangChain, LangGraph, and Deep Agents through notebooks and runnable agent examples, organized into fundamental and production-patterns tracks.
Sharing all KGC 2026 decks. More production-grade KG systems than I've seen at any conference. [D]
The article shares decks from the Knowledge Graph Conference (KGC) 2026, highlighting a trend of enterprises deploying production-grade knowledge graphs for reasoning and governance rather than just vector retrieval.
Construction of Knowledge Graph based on Language Model
Review paper from Kunming University surveys how pre-trained language models automate knowledge-graph construction and introduces LLHKG, a lightweight-LLM framework matching GPT-3.5 performance.
Generating training datasets for legal chatbots in Korean
This paper presents a method for generating large-scale, labeled training datasets for legal chatbots in Korean using Local Grammar Graphs, achieving 91% F1-score with a DIET classifier.
Better Later Than Sooner: Neuro-Symbolic Knowledge Graph Construction via Ontology-grounded Post-extraction Correction
This paper proposes a neuro-symbolic framework for constructing ontology-grounded knowledge graphs from text by deferring consistency corrections to a post-extraction stage, reducing token usage while improving KG consistency and maintaining QA performance.