# LLM Extraction & KG Construction

> Core inference logic, prompt construction, and RDF/Nanopublication serialization.

- Skill: `docxology/llm-extraction-kg-construction` (Agent Skill, multi-file: 16 files)
- Install (CLI): `npx get-skill add docxology/llm-extraction-kg-construction`
- Raw SKILL.md: https://api.skillmd.com/api/skills/docxology/llm-extraction-kg-construction/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: docxology (https://skillmd.com/u/docxology)
- Updated: 2026-11-16
- Page: https://skillmd.com/skills/docxology/llm-extraction-kg-construction

---


# Instructions

You are interacting with the `src/knowledge_graph/` module. This handles the transition from natural language text to structured assertions via Large Language Models.

## Agentic Interface (MCP Strategy)

1. **Config-Driven Orchestration**: Never hardcode LLM parameters (models, temperature, minimum confidence thresholds) within Python scripts. Bind them tightly to `LLMConfig` structures derived securely from `config.yaml`.
2. **Robust Categorization**: Respect strict boundaries on confidence gating. When crafting or modifying prompt templates, ensure the extraction schema firmly permits "irrelevant", "neutral", and "don't know" states to neutralize base-model hallucination tendencies.
3. **Streaming Persistence**: Assertions must emit safely to disk via incremental JSON Lines or valid TriG records. High-volume document processing should not accumulate global lists in RAM.

