yifanfeng97/Hyper-Extract

GitHub: yifanfeng97/Hyper-Extract

一个由 LLM 驱动的知识提取框架,通过命令行将非结构化文档转化为知识图谱、超图和时空图等结构化知识。

Stars: 1678 | Forks: 195

Hyper-Extract Logo

**智能知识提取 CLI** **一条命令,将文档转化为结构化知识。** [📖 英文版](./README.md) · [中文版](./README_ZH.md) [![PyPI Version](https://img.shields.io/pypi/v/hyperextract)](https://pypi.org/project/hyperextract/) [![Python Version](https://img.shields.io/badge/python-3.11%2B-blue)](https://python.org) [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE) [![Status](https://img.shields.io/badge/status-active-success)]() [![Docs](https://img.shields.io/badge/docs-online-blue)](https://yifanfeng97.github.io/Hyper-Extract/latest/)

Hero & Workflow
Hyper-Extract 是一个智能的、由 LLM 驱动的知识提取与演化框架。它极大地简化了将高度非结构化文本转化为持久化、可预测且具有强类型的**知识抽象**的过程。它能轻松地将信息提取为多种格式——从简单的**集合**(列表/集)和 **Pydantic 模型**,到复杂的**知识图谱**、**超图**,甚至是**时空图**。 ## ✨ 核心功能 | | | |:---|:---| | 🔷 **8 种知识结构** | 从简单的列表到高级的图、超图和时空图 | | 🧠 **10+ 种提取引擎** | GraphRAG、LightRAG、Hyper-RAG、KG-Gen 等——开箱即用 | | 📝 **80+ YAML 模板** | 涵盖金融、法律、医疗、中医、工业和通用领域的零代码提取 | | 🔄 **增量演化** | 随时输入新文档以扩展和完善您的知识库 | ## 🎯 您可以用它做什么?
📄 研究人员 — 将论文转化为知识图谱
输入一份 20 页的学术论文,获取关键概念、作者和引文的交互式图谱。 ``` he parse paper.pdf -t general/academic_graph -o ./paper_kb/ he show ./paper_kb/ ```
🏦 金融分析师 — 从财报中提取实体
从非结构化报告中自动识别公司、高管、财务指标及其关系。 ``` he parse earnings.md -t finance/earnings_graph -o ./finance_kb/ he search ./finance_kb/ "What are the key risk factors?" ```
🔒 本地部署 — 使用 vLLM 让数据保留在本地
通过 vLLM 在本地运行 Qwen3.5-9B + bge-m3。数据绝不离开您的机器。 ``` 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", ) ```
## 🚀 支持的平台与模型 Hyper-Extract 依赖于 LLM 的结构化输出能力(`json_schema` 或 Function Calling)。 | 平台 | 已验证模型 | |----------|-----------------| | **OpenAI** | gpt-4o, gpt-4o-mini, gpt-5 | | **阿里云百炼** | qwen-plus, qwen-turbo, deepseek-r1 | | **Local vLLM** | Qwen3.5-9B (GPTQ-Marlin) | **Embedding 模型**(语义搜索)兼容任何 OpenAI 兼容的 endpoint:`text-embedding-3-small`、`text-embedding-v4`(百炼)、`bge-m3`(本地 vLLM)。 ## ⚡ 30 秒快速开始 ``` # 安装 uv tool install hyperextract # 配置 API key he config init -k YOUR_OPENAI_API_KEY # 从文档中提取知识 he parse examples/en/tesla.md -t general/biography_graph -o ./output/ -l en # 查询 he search ./output/ "What are Tesla's major achievements?" # 可视化 he show ./output/ ```
🐍 Python API(点击展开)
``` 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() ```
## 📈 为什么选择 Hyper-Extract? | 功能 | GraphRAG | LightRAG | KG-Gen | ATOM | **Hyper-Extract** | | :------ | :------: | :------: | :----: | :--: | :---------------: | | 知识图谱 | ✅ | ✅ | ✅ | ✅ | ✅ | | 时间图 | ✅ | ❌ | ❌ | ✅ | ✅ | | 空间图 | ❌ | ❌ | ❌ | ❌ | ✅ | | 超图 | ❌ | ❌ | ❌ | ❌ | ✅ | | 领域模板 | ❌ | ❌ | ❌ | ❌ | ✅ | | 交互式 CLI | ✅ | ❌ | ❌ | ❌ | ✅ | | 多语言 | ✅ | ❌ | ❌ | ❌ | ✅ | ## 🧩 支持的知识结构 从简单到复杂——为您的数据选择合适的结构: Knowledge Structures Matrix **示例 — AutoGraph 可视化:** AutoGraph Visualization
📋 底层原理是什么?(架构与模板)
Hyper-Extract 遵循**三层架构**: - **Auto-Types** — 8 种强类型数据结构(Model、List、Set、Graph、Hypergraph、Temporal Graph、Spatial Graph、Spatio-Temporal Graph) - **Methods** — 提取算法:KG-Gen、GraphRAG、LightRAG、Hyper-RAG、Cog-RAG 等 - **Templates** — 涵盖 6 个领域的 80 多种预设。零代码设置。 Architecture **模板示例(Graph 类型):** ``` 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}' ``` - [浏览所有 80+ 模板](./hyperextract/templates/presets/) - [创建自定义模板](./hyperextract/templates/DESIGN_GUIDE.md)
## 📚 文档与资源 | 资源 | 链接 | | :------- | :--- | | 完整文档 | [yifanfeng97.github.io/Hyper-Extract](https://yifanfeng97.github.io/Hyper-Extract/latest/) | | CLI 指南 | [命令行界面](https://yifanfeng97.github.io/Hyper-Extract/latest/cli/) | | Provider 系统 | [模型兼容性与本地部署](https://yifanfeng97.github.io/Hyper-Extract/latest/concepts/provider-system/) | | 模板库 | [80+ 预设](./hyperextract/templates/presets/) | | 示例 | [可运行代码](./examples/) | ## 🤝 贡献与许可 欢迎贡献!请提交 [Issues](https://github.com/yifanfeng97/hyper-extract/issues) 和 [PRs](https://github.com/yifanfeng97/hyper-extract/pulls)。 基于 **Apache-2.0** 许可。 ## ⭐ Star 历史 [![Star History Chart](https://api.star-history.com/svg?repos=yifanfeng97/hyper-Extract&type=Date)](https://star-history.com/#yifanfeng97/hyper-Extract&Date)
标签:DLL 劫持, IPv6支持, Petitpotam, Python, 信息抽取, 大语言模型, 无后门, 逆向工具, 非结构化数据