Hyper-Extract 模型兼容性全表:哪些 LLM 支持 json_schema 结构化抽取?一次看懂
【免费下载链接】Hyper-ExtractHypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.项目地址: https://gitcode.com/GitHub_Trending/hy/Hyper-Extract
Hyper-Extract 是一个用 LLM 把非结构化文本转换为结构化知识的开源工具,核心依赖function calling(json_schema 结构化输出)来驱动 AutoGraph、AutoList 等抽取类型。本文整理一份完整模型兼容性清单:哪些云模型、本地模型支持 json_schema 抽取,哪些会踩坑,以及如何一行命令切换 Provider。
为什么只有支持 function calling 的模型才能用?
Hyper-Extract 的内部抽取管线统一走 LangChain 的with_structured_output,并强制指定method="function_calling"(见 hyperextract/types/base.py):
- 它会把你的 Pydantic Schema 转成JSON Schema,通过工具调用下发给模型
- 模型必须"原生听懂"这个工具定义,才能保证输出 100% 符合结构
- 如果模型只支持
json_object(在 prompt 里提一句 "json" 让模型自由发挥),就会出现两种典型翻车:- 报错
messages must contain the word 'json' - 返回的不是 JSON,或 JSON 结构缺字段
- 报错
所以判断标准只有一个:模型是否支持 function calling / structured output。
📋 云端模型兼容性全表
| 平台 | 已验证模型 | 函数调用 | 是否可用 | 备注 |
|---|---|---|---|---|
| OpenAI | gpt-4o / gpt-4o-mini / gpt-5 | ✅ | ✅ | 官方原生支持,首选推荐 |
| Anthropic | claude-opus-4-8 / claude-sonnet-4-6 / claude-haiku-4-5 | ✅(工具调用) | ✅ | 仅提供 LLM,无嵌入接口,需搭配 OpenAI 兼容 Embedding;需安装hyperextract[anthropic] |
| Google Gemini | gemini-3.8-flash / gemini-2.5-flash / gemini-2.5-pro | ✅(工具调用) | ✅ | 同上,无成熟嵌入路径;需安装hyperextract[google] |
| DeepSeek | deepseek-v4-flash / deepseek-v4-pro | ✅ | ✅ | OpenAI 兼容;V4 默认开启 thinking 模式,Hyper-Extract 会自动关闭以保证 json_schema 抽取可用 |
| OrcaRouter | orcarouter/auto、openai/gpt-4o-mini、anthropic/claude-haiku-4-5 等 | ✅ | ✅ | OpenAI 兼容网关,一把密钥路由 150+ 模型 |
| 阿里云百炼 | qwen-plus / qwen-turbo / qwen3.6-plus / deepseek-r1 | ✅ | ✅ | 开箱即用 |
| 阿里云百炼 | qwen-max / deepseek-v3 | ❌ | ❌ | 仅支持 json_object,不兼容 function calling |
⚠️百炼用户注意:如果你用 qwen-max 或 deepseek-v3 遇到
messages must contain the word 'json'错误、或模型不返回 JSON,说明该模型不支持 function calling,请切换到qwen-plus、qwen-turbo 或 deepseek-r1。
🖥️ 本地部署:vLLM + Qwen3.5-9B
没有 API Key 也能玩。官方验证过的本地组合:
| 角色 | 模型 | 量化方式 | 显存占用 | 验证状态 |
|---|---|---|---|---|
| LLM | Qwen3.5-9B | GPTQ-Marlin 4bit | ~8GB | ✅ AutoList / AutoGraph |
| Embedding | BAAI/bge-m3 | 无 | ~2GB | ✅ 语义搜索 |
两个关键坑位:
- 必须关闭 thinking 模式——Thinking 模型会输出
</think>标签,与"从首个 token 起就是 JSON"的约束解码冲突。启动 vLLM 时加参数--default-chat-template-kwargs '{"enable_thinking": false}' - 量化选 GPTQ-Marlin,AWQ 在 vLLM 0.21.0 中存在兼容性问题
云端 Embedding 方面,text-embedding-3-small(1536 维)和百炼text-embedding-v4(1024 维)均已验证可用。
🔌 一行代码切换 Provider
所有平台共用同一个create_client()接口,只改第一行就能换模型(源码见 hyperextract/utils/client.py):
from hyperextract import create_client # OpenAI(默认 gpt-4o-mini + text-embedding-3-small) llm, emb = create_client("openai", api_key="sk-xxx") # 百炼(默认 qwen3.6-plus + text-embedding-v4) llm, emb = create_client("bailian", api_key="sk-xxx") # DeepSeek(thinking 自动关闭) llm, emb = create_client( llm="deepseek", embedder="openai:text-embedding-3-small", ) # 本地 vLLM llm, emb = create_client( llm="vllm:Qwen3.5-9B@http://localhost:8000/v1", embedder="vllm:bge-m3@http://localhost:8001/v1", api_key="dummy", )字符串简写格式支持provider:model@url三段式,例如"bailian:qwen-plus"覆盖 LLM 但保留预设 Embedding。完整配置选项参考 docs/zh/python/guides/provider-configuration.md,各平台可直接运行的示例脚本在 examples/providers/ 目录下(openai_demo.py、bailian_demo.py 等)。
CLI 用户则只需:he config init -p bailian -k sk-xxx。
✅ 选型速查:30 秒决定用哪个模型
- 图省事、效果稳→ OpenAI gpt-4o-mini,官方原生支持,零配置
- 国内直连、中文任务→ 百炼 qwen-plus / qwen3.6-plus,避开 qwen-max
- 低成本推理→ DeepSeek v4-flash(thinking 自动帮你关)
- 一把钥匙开 150+ 模型→ OrcaRouter 网关
- 完全离线→ 本地 vLLM 部署 Qwen3.5-9B(4bit 量化,8GB 显卡起步)
完整兼容性说明与 vLLM 部署命令详见 docs/zh/concepts/provider-system.md。
【免费下载链接】Hyper-ExtractHypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.项目地址: https://gitcode.com/GitHub_Trending/hy/Hyper-Extract
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考