Hyper-Extract

yifanfeng97活跃维护

用 LLM 把非结构化文本抽取成结构化知识,一条命令即可生成图、超图以及时空信息,适合搭建知识图谱和 RAG 数据管线。

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

v0.12.0发布于 2026-11-05 03:43 UTC4,239star +23 / 7 天491fork同步于 2026-11-10 11:38 UTC

怎么上手

由 README 提炼,执行前请确认
curl -LsSf https://astral.sh/uv/install.sh | sh
uv tool install hyperextract
he config init -p openai -k YOUR_OPENAI_API_KEY
硬件要求按 README 说明

README 未给出显存要求;本地 vLLM 部署需 GPU(README 称 free but needs a GPU),云端 API 方式无本地硬件要求。

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用一条命令把非结构化文档转成图谱、超图与时空知识结构的 CLI 工具

用 LLM 把非结构化文本抽取成结构化知识,一条命令即可生成图、超图以及时空信息,适合搭建知识图谱和 RAG 数据管线。

核心能力

  • 支持 9 种知识结构,含图谱、超图与时空图
  • 内置 11+ 抽取引擎,含 GraphRAG、LightRAG、Hyper-RAG
  • 提供 80+ YAML 模板,覆盖金融、法律、医疗等领域
  • 按来源增量更新,旧事实可回滚并可审计出处
  • 可导出为 Obsidian 库,用 wikilinks 串联笔记

容易踩的坑

模型必须支持 function calling,否则结构化抽取无法工作;DeepSeek、Anthropic、Gemini 只提供 LLM,需另配 OpenAI 兼容的 embedding 服务;解析 PDF、Word 等格式需额外安装 hyperextract[ingest],Anthropic 与 Google 也需装对应 extra。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.12.0
  1. v0.12.0v0.12.0 — Nested Directory Support最新正式版2026-11-05 · 2026-11-05 03:43 UTC

    Feature release implementing #205: he parse / he feed directory mode now handles real-world knowledge-base layouts.

    📁 Recursive Directory Mode

    Directory inputs walk nested subdirectories — no more flattening or renaming files before ingestion:

    knowledge-base/
    ├── README.md            → source: README
    ├── 制度/安全/安全总则.md  → source: 制度/安全/安全总则
    └── 制度/环保/环保规定.md  → source: 制度/环保/环保规定
    
    • Per-file source ids are the path relative to the walked root, so same-named files in different subdirectories stay distinct in the provenance ledger — and he remove --document 制度/安全/安全总则 remains precise.
    • Top-level files keep their bare stem as the source id: existing KAs keep working without re-ingestion.
    • Hidden directories (.git, .venv, …) are pruned; symlinks are not followed.

    ↩️ Opt-out

    --flat restores the legacy top-level-only scan on both he parse and he feed.

    Full changelog: https://github.com/yifanfeng97/Hyper-Extract/compare/v0.11.2...v0.12.0

  2. v0.11.2v0.11.2 — llm.buzz & CloudGPU Presets + Provider Docs Cleanup2026-11-04 · 2026-11-04 03:18 UTC
    查看更新说明

    Patch release completing the provider-preset wave and correcting the v0.11.1 notes.

    🔌 llm.buzz preset ships

    The v0.11.1 notes incorrectly listed llm.buzz as included — the preset landed on main after that release was cut. It ships for real now: OpenAI-compatible gateway with vendor-prefixed ids (openai/gpt-5.4-mini), LLM-only, LLM_BUZZ_API_KEY. (#194)

    🔌 CloudGPU preset completed

    The CloudGPU preset was missing its default_embedder contract key; the preset-table test now enforces the full shape across every provider. (#193 follow-up)

    📚 Provider docs cleanup

    Provider lists in provider-system and the config guides had drifted into duplicates across the recent preset merges — deduplicated and completed (Atlas Cloud / Runcrate / Cerebras / Mistral / Moonshot / CloudGPU / llm.buzz each listed once, EN + ZH).

    Full changelog: https://github.com/yifanfeng97/Hyper-Extract/compare/v0.11.1...v0.11.2

  3. v0.11.1v0.11.1 — Provider Presets Shipping (0.11.0 Packaging Correction)2026-11-03 · 2026-11-03 08:32 UTC
    查看更新说明

    Packaging correction release: the v0.11.0 tag went out before the provider-preset merges landed, so its notes promised presets that were not in the built package. v0.11.1 ships them for real.

    🔌 Provider Presets (now actually included)

    • API Route — API_ROUTE_API_KEY, default gpt-6.1-sol (#190, @DennyHo0917)
    • Runcrate — open models + BAAI/bge-m3 embeddings on one key (RUNCRATE_API_KEY) (#192, @heydryft)
    • Atlas Cloud — vendor-prefixed aggregator ids (ATLASCLOUD_API_KEY) (#189)
    • Cheaper Inference — multi-lab gateway (CHEAPER_INFERENCE_API_KEY) (#186)
    • Ollama — local LLM + embeddings on localhost:11434 (#200)
    • CloudGPU — CLOUDGPU_API_KEY (#193)
    • llm.buzz — LLMBUZZ_API_KEY (#194)

    Everything else described in the v0.11.0 notes (preset regression fix, load-time validation, scoped chat) was already in that tag and carries over unchanged.

    Full changelog: https://github.com/yifanfeng97/Hyper-Extract/compare/v0.10.5...v0.11.1

  4. v0.11.0v0.11.0 — Preset Regression Fix, New Providers & Diagnostics2026-10-29 · 2026-10-29 00:22 UTC
    查看更新说明

    Feature release with a critical fix for anyone on v0.10.5.

    🛠️ Critical: 0.10.5 preset regression fixed

    v0.10.5's load-time identifiers check validated time_field/location_field against the wrong output section, breaking Template.create for 7 shipped presets:

    general/temporal_graph, general/spatial_graph, general/spatio_temporal_graph, general/biography_graph, finance/event_timeline, legal/case_fact_timeline, medicine/hospital_timeline

    They are now validated against relations.fields (matching the presets and the validator's HE-T006 rule), with regression tests covering both the presets and the negative cases. (#184)

    If you are on 0.10.5, upgrade to 0.11.0 to restore temporal/spatial templates.

    🔌 New Provider Presets

    • API Route — OpenAI-compatible, API_ROUTE_API_KEY, default gpt-6.1-sol. (#190, first contribution by @DennyHo0917)
    • Runcrate — open models (DeepSeek, GPT-OSS) + BAAI/bge-m3 embeddings on one key, free with a GitHub account. (#192, first contribution by @heydryft)

    🛡️ More Load-Time Validation & Diagnostics

    • Hypergraph relation_members in string/list form are field-checked at Template.create (previously crashed at feed time). (#185)
    • A graph-family template carrying naive item_id identifiers fails with the validator's HE-T003 guidance instead of a bare AttributeError. (#191)

    Full changelog: https://github.com/yifanfeng97/Hyper-Extract/compare/v0.10.5...v0.11.0

  5. v0.10.5v0.10.5 — Load-Time Template Validation & Friendly Local-Model Errors2026-09-29 · 2026-09-29 13:33 UTC
    查看更新说明

    Direct response to production feedback (华能电厂 hypergraph KA, 840 docs): a template-config error that used to surface as an unrelated crash now fails at load time with the exact cause named.

    🛡️ Load-Time Identifiers Validation

    A template whose identifiers reference fields not declared in output (e.g. relation_id: '{name}|{type}' while relations.fields omits type) previously loaded fine and crashed at first merge with ValueError: max() arg is an empty sequence — zero connection to the root cause.

    Now Template.create fails immediately:

    ValueError: relation_id references '{type}' but relations.fields does not declare 'type'
    

    Covers node_id, relation_id placeholders, relation_members, and time_field/location_field, across all five graph-family types.

    🧠 Friendly Local-Model Errors

    Without a config file, Template.create silently fell back to OpenAI defaults (gpt-4o-mini) — vllm/ollama users hit a cryptic auth error far from the cause. The error now lists all three ways forward: he config init, -p vllm local setup, or passing clients explicitly.

    🔒 ontomem 0.6.1 (companion release)

    • KeyExtractionError: 100% key-extraction failure now raises an aggregate error (count + distinct causes) instead of silently returning empty
    • key_extraction_failed warnings aggregate per distinct error (x118), no more alarm floods
    • remerge="mechanical": exact rollbacks on large shared keys use the deterministic field merge (seconds, no LLM) — fixes the 35+ min hang reported with runaway LLM generation on batch-built KAs; auto mode falls back automatically above 12 survivors per key

    Full changelog: https://github.com/yifanfeng97/Hyper-Extract/compare/v0.10.4...v0.10.5

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Smart Knowledge Extraction CLI

    Transform documents into structured knowledge with one command.

    📖 English Version · 中文版

    "Stop reading. Start understanding."
    "告别文档焦虑,让信息一目了然"

    ⚡ 30-Second Quick Start

    1. Install:

    # Install uv first (if you haven't)
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Install Hyper-Extract CLI
    uv tool install hyperextract
    # or: pipx install hyperextract
    

    2. Configure your provider (pick one):

    # OpenAI (LLM + embeddings in one key)
    he config init -p openai -k YOUR_OPENAI_API_KEY
    
    # DeepSeek (LLM only — pair with an OpenAI embedder, most cost-effective)
    he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY
    he config embedder -p openai -k YOUR_OPENAI_API_KEY
    
    # Local vLLM (free, on-premise)
    he config llm -p vllm -u http://localhost:8000/v1 -k dummy -m Qwen/Qwen3.5-9B
    he config embedder -p vllm -u http://localhost:8001/v1 -k dummy -m BAAI/bge-m3
    
    # Anthropic (Claude) — LLM only
    he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY
    he config embedder -p openai -k YOUR_OPENAI_API_KEY
    
    # Google Gemini — LLM only (default: gemini-3.8-flash)
    he config llm -p google -k YOUR_GOOGLE_API_KEY
    he config embedder -p openai -k YOUR_OPENAI_API_KEY
    
    # Alibaba Bailian (Qwen, LLM + embeddings in one key)
    he config init -p bailian -k YOUR_BAILIAN_API_KEY
    

    OpenAI and Bailian provide both LLM and embedding models in one API. Anthropic, Google Gemini, and DeepSeek are LLM-only (pair them with an OpenAI-compatible embedder). DeepSeek is the most cost-effective option (~$0.001-0.005/page).

    3. Extract, query & visualize:

    # Extract knowledge from a document
    he parse examples/en/tesla.md -t general/biography_graph -o ./output/ -l en
    
    # Query it
    he search ./output/ "What are Tesla's major achievements?"
    
    # Visualize
    he show ./output/
    
    # Export to an Obsidian vault (Markdown notes + [[wikilinks]])
    he export obsidian ./output/ -o ./vault/
    
    # Your sources change? Feed updates under the same source — old facts roll back automatically
    he feed ./output/ updated-tesla.md --source tesla.md
    
    # Tag and scope your searches
    he tag ./output/ --source tesla.md --add biography
    he search ./output/ "inventions" --tag biography
    
    # Audit: which documents contributed what?
    he info ./output/ --sources
    

    Which provider should I use? OpenAI and Bailian provide both LLM and embedding models in one API; Anthropic and DeepSeek are LLM-only (pair with an OpenAI embedder); local vLLM is free but needs a GPU. Full guide: Provider System.

    uv pip install hyperextract
    
    from hyperextract import Template
    
    ka = Template.create("general/biography_graph")
    
    with open("examples/en/tesla.md") as f:
        result = ka.parse(f.read())
    
    result.show()
    

    🔗 More examples: examples/en

    ✨ Core Features

    📄 Rich Document IngestionFeed PDF, Word, PowerPoint, Excel, HTML, EPUB and more — not just .txt/.md (pip install "hyperextract[ingest]")
    🔷 9 Knowledge StructuresFrom raw chunk corpora and simple Lists to advanced Graphs, Hypergraphs, and Spatio-Temporal Graphs
    🧠 11+ Extraction Engineschunk_rag (zero-cost baseline), GraphRAG, LightRAG, Hyper-RAG, KG-Gen, and more — ready to use
    📝 80+ YAML TemplatesZero-code extraction across Finance, Legal, Medical, TCM, Industry, and General domains
    🔄 Incremental Evolution & ProvenanceFeed new documents anytime — every source is attributed and the index updates incrementally; audit (he info --sources), roll back (he remove --document), or upsert updated versions as your sources change
    📤 Obsidian ExportTurn any extracted graph into an Obsidian vault — Markdown notes linked by [[wikilinks]]

    🎯 What Can You Do With It?

    Feed a 20-page academic paper, get an interactive graph of key concepts, authors, and citations.

    he parse paper.pdf -t general/academic_graph -o ./paper_kb/
    he show ./paper_kb/
    

    Automatically identify companies, executives, financial metrics, and their relationships from unstructured reports.

    he parse earnings.md -t finance/earnings_graph -o ./finance_kb/
    he search ./finance_kb/ "What are the key risk factors?"
    

    Run Qwen3.5-9B + bge-m3 locally via vLLM. No data leaves your machine.

    from hyperextract import create_client
    llm, emb = create_client(
        llm="vllm:Qwen3.5-9B@http://localhost:8000/v1",
        embedder="vllm:bge-m3@http://localhost:8001/v1",
        api_key="dummy",
    )
    

    Documents change. Hyper-Extract tracks every source so you can update, roll back, or audit without starting over.

    # Ingest with attribution — every fact is traceable to its source
    he feed ./ka/ contract-v1.md --source contract-v1
    he tag ./ka/ --source contract-v1 --add legal --add acme
    
    # Document updated? Re-feed under the same source — old facts roll back automatically
    he feed ./ka/ contract-v2.md --source contract-v1
    
    # Document is obsolete? Roll back everything it contributed
    he remove ./ka/ --document contract-v1
    
    # Remove a single wrong fact (LLM-assisted, with dry-run preview)
    he remove ./ka/ --edit-node Apple --fact "founded by Steve Jobs" --dry-run
    
    # Search only within legal-tagged documents
    he search ./ka/ "termination clause" --tag legal
    
    # Audit: which documents contributed what?
    he info ./ka/ --sources
    

    🚀 Supported Platforms & Models

    Hyper-Extract uses LangChain structured output with function calling. The model must support tool/function calling.

    PlatformVerified Models
    OpenAIgpt-4o, gpt-4o-mini, gpt-5
    Anthropicclaude-opus-4-8, claude-sonnet-4-6, claude-haiku-4-5
    Google Geminigemini-3.8-flash
    DeepSeekdeepseek-v4-flash, deepseek-v4-pro
    阿里云百炼qwen-plus, qwen-turbo, deepseek-r1
    Local vLLMQwen3.5-9B (GPTQ-Marlin)

    Embedding models (semantic search) work with any OpenAI-compatible endpoint: text-embedding-3-small, text-embedding-v4 (Bailian), bge-m3 (local vLLM).

    DeepSeek: V4 models default to "thinking" mode, which Hyper-Extract auto-disables so structured extraction works. Set DEEPSEEK_API_KEY. DeepSeek has no embeddings API:

    from hyperextract import create_client
    llm, emb = create_client(llm="deepseek", embedder="openai:text-embedding-3-small")
    

    Anthropic: Claude is used for the LLM (set ANTHROPIC_API_KEY, extra: pip install 'hyperextract[anthropic]'). No embeddings API:

    from hyperextract import create_client
    llm, emb = create_client(llm="anthropic", embedder="openai:text-embedding-3-small")
    

    Google Gemini: Gemini is used for the LLM (set GOOGLE_API_KEY or GEMINI_API_KEY, extra: pip install 'hyperextract[google]'). Default model is gemini-3.8-flash. No mature embedder path in this repo:

    from hyperextract import create_client
    llm, emb = create_client(llm="google", embedder="openai:text-embedding-3-small")
    

    📖 Full guide: Provider System & Local Model Support

    📈 Why Hyper-Extract?

    FeatureGraphRAGLightRAGKG-GenATOMHyper-Extract
    Knowledge Graph✅✅✅✅✅
    Temporal Graph✅❌❌✅✅
    Spatial Graph❌❌❌❌✅
    Hypergraph❌❌❌❌✅
    Domain Templates❌❌❌❌✅
    Interactive CLI✅❌❌❌✅
    Multi-language✅❌❌❌✅

    🧩 Supported Knowledge Structures

    From simple to complex — pick the right structure for your data:

    Example — AutoGraph visualization:

    Hyper-Extract follows a three-layer architecture:

    • Auto-Types — 9 strongly-typed data structures (Model, List, Set, Graph, Hypergraph, Temporal Graph, Spatial Graph, Spatio-Temporal Graph, Document corpus)
    • Methods — Extraction & retrieval algorithms: Chunk-RAG baseline, KG-Gen, GraphRAG, LightRAG, Hyper-RAG, Cog-RAG, and more
    • Templates — 80+ presets across 6 domains. Zero-code setup.

    Template example (Graph type):

    language: en
    name: Knowledge Graph
    type: graph
    tags: [general]
    description: 'Extract entities and their relationships.'
    output:
      entities:
        fields:
        - name: name
          type: str
        - name: type
          type: str
        - name: description
          type: str
      relations:
        fields:
        - name: source
          type: str
        - name: target
          type: str
        - name: type
          type: str
    identifiers:
      entity_id: name
      relation_id: '{source}|{type}|{target}'
    

    📰 What's New

    v0.12.0 — 📁 Nested directory support: he parse/he feed walk subdirectories recursively; same-named files stay distinct via relative-path source ids.

    📰 Full release notes · All releases

    📚 Documentation & Resources

    ResourceLink
    Full Documentationyifanfeng97.github.io/Hyper-Extract
    CLI GuideCommand-line interface
    Provider SystemModel compatibility & local deployment
    NewsRelease notes & highlights
    Template Gallery80+ presets
    ExamplesWorking code

    🔌 MCP Server

    Expose your knowledge abstracts to MCP-capable assistants (Claude Desktop, IDE agents) via the Model Context Protocol — read + export only.

    pip install 'hyperextract[mcp]'
    he-mcp        # stdio MCP server
    

    Tools: list_templates, info, search, ask (RAG), export_obsidian, export_graphml, export_csv, export_jsonld, export_cypher. Full guide: MCP Server docs.

    🤝 Contributing & License

    Contributions are welcome! Please submit Issues and PRs.
    Licensed under Apache-2.0.

    🔒 Security

    This project has been security assessed by MseeP.ai.

    AtomGit Mirror

    AtomGit mirror - a synchronized AtomGit mirror of Agent Reach for easier access and cloning in China. Hosted on AtomGit: https://atomgit.com/yifanfeng97/Hyper-Extract