Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.
docs: improve onboarding for multi-provider support (#57)
yifanfeng974dd765cebb36
diff --git a/README.md b/README.mdindex a1c3b50..84756fe 100644--- a/README.md+++ b/README.md@@ -155,13 +155,50 @@ Hyper-Extract relies on the LLM's structured output capability (`json_schema` or## ⚡ 30-Second Quick Start+**1. Install:**+```bash-# Install+# Install uv first (if you haven't)+curl -LsSf https://astral.sh/uv/install.sh | sh++# Install Hyper-Extract CLIuv tool install hyperextract+# or: pipx install hyperextract+```-# Configure API key-he config init -k YOUR_OPENAI_API_KEY+**2. Configure your provider** (pick one):++**OpenAI:**+```bash+he config init -p openai -k YOUR_OPENAI_API_KEY+```+**Anthropic (Claude):**+```bash+he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY+he config embedder -p openai -k YOUR_OPENAI_API_KEY+```++**DeepSeek:**+```bash+he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+he config embedder -p openai -k YOUR_OPENAI_API_KEY+```++**Bailian (Alibaba Cloud):**+```bash+he config init -p bailian -k YOUR_BAILIAN_API_KEY+```++**Local vLLM:**+```bash+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+```++**3. Extract, query & visualize:**++```bash# Extract knowledge from a documenthe parse examples/en/tesla.md -t general/biography_graph -o ./output/ -l en@@ -175,6 +212,8 @@ he show ./output/he export obsidian ./output/ -o ./vault/```+> **Which provider should I use?** OpenAI and Bailian provide both LLM and embedding models in one API. Anthropic and DeepSeek are LLM-only (pair them with an OpenAI embedder for search/chat). Local vLLM is free but requires a GPU. DeepSeek is the most cost-effective option (~$0.001-0.005/page vs ~$0.01-0.05/page for OpenAI gpt-4o-mini).+<details><summary><b>🐍 Python API</b> (click to expand)</summary><br>diff --git a/README_ZH.md b/README_ZH.mdindex b0796d8..17392bc 100644--- a/README_ZH.md+++ b/README_ZH.md@@ -155,13 +155,50 @@ Hyper-Extract 依赖大语言模型的结构化输出能力(`json_schema` 或## ⚡ 30 秒快速上手+**1. 安装:**+```bash-# 安装+# 先安装 uv(如果还没有)+curl -LsSf https://astral.sh/uv/install.sh | sh++# 安装 Hyper-Extract CLIuv tool install hyperextract+# 或:pipx install hyperextract+```-# 配置 API Key-he config init -k YOUR_OPENAI_API_KEY+**2. 配置你的 provider**(任选其一):++**OpenAI:**+```bash+he config init -p openai -k YOUR_OPENAI_API_KEY+```+**Anthropic (Claude):**+```bash+he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY+he config embedder -p openai -k YOUR_OPENAI_API_KEY+```++**DeepSeek:**+```bash+he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+he config embedder -p openai -k YOUR_OPENAI_API_KEY+```++**百炼(阿里云):**+```bash+he config init -p bailian -k YOUR_BAILIAN_API_KEY+```++**本地 vLLM:**+```bash+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+```++**3. 提取、查询与可视化:**++```bash# 从文档提取知识he parse examples/zh/sushi.md -t general/biography_graph -o ./output/ -l zh@@ -175,6 +212,8 @@ he show ./output/he export obsidian ./output/ -o ./vault/```+> **该用哪个 provider?** OpenAI 和百炼同时提供 LLM 和 embedding 模型。Anthropic 和 DeepSeek 仅提供 LLM(搜索/聊天功能需搭配 OpenAI 的 embedder)。本地 vLLM 免费但需要 GPU。DeepSeek 最经济(约 $0.001-0.005/页,而 OpenAI gpt-4o-mini 约 $0.01-0.05/页)。+<details><summary><b>🐍 Python API</b>(点击展开)</summary><br>diff --git a/docs/en/cli/commands/config.md b/docs/en/cli/commands/config.mdindex 4266d18..d395839 100644--- a/docs/en/cli/commands/config.md+++ b/docs/en/cli/commands/config.md@@ -28,6 +28,7 @@ Initialize configuration. This is the **lazy one-step setup** — if you pass `-- **OpenAI preset**: `gpt-4o-mini` + `text-embedding-3-small`- **Bailian preset**: `qwen3.6-plus` + `text-embedding-v4`- **DeepSeek preset**: `deepseek-v4-flash` (LLM only — no embedder preset)+- **Anthropic preset**: `claude-opus-4-8` (LLM only — no embedder preset, pair with an OpenAI-compatible embedder)```bashhe config init [OPTIONS]@@ -37,7 +38,7 @@ he config init [OPTIONS]| Option | Short | Description ||--------|-------|-------------|-| `--provider` | `-p` | Provider preset (`openai` / `bailian` / `deepseek` / `vllm`) |+| `--provider` | `-p` | Provider preset (`openai` / `anthropic` / `deepseek` / `bailian` / `vllm`) || `--api-key` | `-k` | API key for both LLM and embedder || `--base-url` | `-u` | Custom API base URL (optional) |@@ -55,6 +56,10 @@ he config init -p bailian -k sk-your-api-key-here# DeepSeek (LLM only — pair with an OpenAI-compatible embedder)he config llm -p deepseek -k sk-your-deepseek-keyhe config embedder -p openai -k sk-your-openai-key++# Anthropic (LLM only — pair with an OpenAI-compatible embedder)+he config llm -p anthropic -k sk-your-anthropic-key+he config embedder -p openai -k sk-your-openai-key```This saves the preset's default model and API URL automatically.@@ -109,6 +114,7 @@ he config llm [OPTIONS]| Option | Short | Description ||--------|-------|-------------|+| `--provider` | `-p` | Provider preset (e.g. `openai`, `anthropic`, `deepseek`, `bailian`, `vllm`) || `--api-key` | `-k` | LLM API key || `--model` | `-m` | LLM model name || `--base-url` | `-u` | Custom API base URL |@@ -151,6 +157,7 @@ he config embedder [OPTIONS]| Option | Short | Description ||--------|-------|-------------|+| `--provider` | `-p` | Provider preset (e.g. `openai`, `anthropic`, `deepseek`, `bailian`, `vllm`) || `--api-key` | `-k` | Embedder API key || `--model` | `-m` | Embedder model name || `--base-url` | `-u` | Custom API base URL |diff --git a/docs/en/cli/configuration.md b/docs/en/cli/configuration.mdindex ce98fd0..ba5117c 100644--- a/docs/en/cli/configuration.md+++ b/docs/en/cli/configuration.md@@ -1,6 +1,6 @@# CLI Configuration Reference-Configuration guide for Hyper-Extract CLI, supporting **OpenAI**, **DeepSeek**, **Alibaba Cloud Bailian**, and **Local vLLM** deployments.+Configuration guide for Hyper-Extract CLI, supporting **OpenAI**, **Anthropic**, **DeepSeek**, **Alibaba Cloud Bailian**, and **Local vLLM** deployments.---@@ -28,6 +28,32 @@ Choose your deployment method and follow the steps.- **LLM**: `qwen3.6-plus`- **Embedder**: `text-embedding-v4`+=== "Anthropic (Claude)"++ Anthropic provides LLM only — pair with an OpenAI-compatible embedder:++ ```bash+ he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY+ ```++ This creates `~/.he/config.toml` with:+ - **LLM**: `claude-opus-4-8` (Anthropic)+ - **Embedder**: `text-embedding-3-small` (OpenAI)++=== "DeepSeek"++ DeepSeek provides LLM only — pair with an OpenAI-compatible embedder:++ ```bash+ he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY+ ```++ This creates `~/.he/config.toml` with:+ - **LLM**: `deepseek-v4-flash` (DeepSeek, auto-disables thinking mode)+ - **Embedder**: `text-embedding-3-small` (OpenAI)+=== "Local vLLM"Start the LLM and Embedding services first, then configure separately:@@ -139,6 +165,22 @@ he config embedder --unsethe config llm -p bailian -k sk-your-key -m qwen-plus```+=== "Anthropic (Claude)"++ ```bash+ # LLM via Anthropic, Embedder via OpenAI+ he config llm -p anthropic -k sk-ant-your-key+ he config embedder -p openai -k sk-your-openai-key+ ```++=== "DeepSeek"++ ```bash+ # LLM via DeepSeek, Embedder via OpenAI+ he config llm -p deepseek -k sk-your-key+ he config embedder -p openai -k sk-your-openai-key+ ```+=== "Local vLLM"```bashdiff --git a/docs/en/cli/index.md b/docs/en/cli/index.mdindex 1b4432f..a3b3d38 100644--- a/docs/en/cli/index.md+++ b/docs/en/cli/index.md@@ -40,7 +40,7 @@ he --version| `he build-index` | Build/rebuild search index | `-f` force rebuild || `he clean` | Remove a KA's index (or the whole KA) | `-a` all, `-y` yes || `he list` | List templates and methods | `template` or `method` |-| `he config` | Manage configuration | `init`, `show`, `set` |+| `he config` | Manage configuration | `init`, `show`, `llm`, `embedder` |---@@ -102,6 +102,15 @@ flowchart TBhe config embedder -p openai -k YOUR_OPENAI_API_KEY```+=== "Anthropic (Claude)"++ Anthropic provides LLM only — pair with an OpenAI-compatible embedder:++ ```bash+ he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY+ ```+=== "Local vLLM"First install [vLLM](https://docs.vllm.ai/) and start both services:diff --git a/docs/en/getting-started/cli-quickstart.md b/docs/en/getting-started/cli-quickstart.mdindex 566b836..88d42fb 100644--- a/docs/en/getting-started/cli-quickstart.md+++ b/docs/en/getting-started/cli-quickstart.md@@ -48,8 +48,19 @@ Choose your deployment method and run the corresponding configuration command:-m BAAI/bge-m3```+=== "Anthropic (Claude)"++ Anthropic provides LLM only — pair with an OpenAI-compatible embedder for search/chat:++ ```bash+ he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY+ ```+This creates a configuration file at `~/.he/config.toml`. You only need to do this once.+> **Note:** Anthropic and DeepSeek provide LLM only. For search (`he search`) and chat (`he talk`) features, pair them with an OpenAI-compatible embedder as shown above.+---## Step 2: Download Sample Document@@ -224,7 +235,7 @@ he build-index ./output/## Troubleshooting**"No API key found"**-→ Run `he config init -k YOUR_API_KEY`+→ Run `he config init -p openai -k YOUR_OPENAI_API_KEY` (or use `-p bailian`, `-p deepseek`, etc.)**"Template not found"**→ List available templates with `he list template`diff --git a/docs/en/getting-started/installation.md b/docs/en/getting-started/installation.mdindex 3a3cec3..c91a918 100644--- a/docs/en/getting-started/installation.md+++ b/docs/en/getting-started/installation.md@@ -10,6 +10,14 @@ If you want to use the `he` command from anywhere:=== "uv (recommended)"+ Install [uv](https://docs.astral.sh/uv/) first (if you haven't):++ ```bash+ curl -LsSf https://astral.sh/uv/install.sh | sh+ ```++ Then install Hyper-Extract:+```bashuv tool install hyperextract```@@ -20,6 +28,8 @@ If you want to use the `he` command from anywhere:pipx install hyperextract```+ > Don't have pipx? Install it with `pip install pipx`.+---## Install as Python Library@@ -51,7 +61,7 @@ If you want to use Hyper-Extract in your Python code:You should see something like:```- Hyper-Extract CLI version 0.1.3.dev0+ Hyper-Extract CLI version 0.4.0```=== "Python"@@ -68,11 +78,13 @@ If you want to use Hyper-Extract in your Python code:If you want to contribute or modify the source code:```bash-# Clone the repositorygit clone https://github.com/yifanfeng97/hyper-extract.gitcd hyper-extract-# Install in editable mode with dev dependencies+# Install with uv (recommended)+uv sync --extra dev++# Or with pippip install -e ".[dev]"```diff --git a/docs/en/getting-started/python-quickstart.md b/docs/en/getting-started/python-quickstart.mdindex 70089e6..d9c1446 100644--- a/docs/en/getting-started/python-quickstart.md+++ b/docs/en/getting-started/python-quickstart.md@@ -38,9 +38,35 @@ Create a `.env` file:echo "OPENAI_API_KEY=your-api-key" > .env```-**Option B — Bailian, DeepSeek, or vLLM**+**Option B — Other providers (Anthropic, DeepSeek, Bailian, vLLM)**-See the [Provider Configuration Guide](../python/guides/provider-configuration.md) for platform-specific setup.+Set the appropriate environment variables in `.env`:++```bash+# Anthropic+ANTHROPIC_API_KEY=sk-ant-xxx+OPENAI_API_KEY=sk-xxx # for embeddings++# DeepSeek+DEEPSEEK_API_KEY=sk-xxx+OPENAI_API_KEY=sk-xxx # for embeddings++# Bailian (Alibaba Cloud)+OPENAI_API_KEY=sk-xxx+OPENAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1+```++Then configure the client in your script:++```python+from hyperextract import create_client, Template++# Example: DeepSeek LLM + OpenAI embedder+llm, emb = create_client(llm="deepseek", embedder="openai:text-embedding-3-small")+ka = Template.create("general/biography_graph", language="en", llm_client=llm, embedder=emb)+```++See the [Provider Configuration Guide](../python/guides/provider-configuration.md) for full details.---@@ -241,15 +267,13 @@ def main():result.show()print("\nDone!")-```---if __name__ == "__main__":main()```++---## What's Next?diff --git a/docs/en/python/guides/provider-configuration.md b/docs/en/python/guides/provider-configuration.mdindex faa7717..b838045 100644--- a/docs/en/python/guides/provider-configuration.md+++ b/docs/en/python/guides/provider-configuration.md@@ -25,6 +25,19 @@ llm, emb = create_client("bailian", api_key="sk-xxx")# Or override model: create_client("bailian:qwen3.6-plus", api_key="sk-xxx")```+### Anthropic (Claude)++```python+from hyperextract import create_client, AutoGraph++# Anthropic is LLM only — pair it with an OpenAI-compatible embedder.+# Keys: ANTHROPIC_API_KEY (or CLAUDE_API_KEY) for the LLM, OPENAI_API_KEY for embeddings.+llm, emb = create_client(+ llm="anthropic", # default model: claude-opus-4-8 (override with "anthropic:<model>")+ embedder="openai:text-embedding-3-small",+)+```+### DeepSeek```python@@ -76,6 +89,7 @@ print(f"Nodes: {len(graph.nodes)}, Edges: {len(graph.edges)}")|----------|---------|| **OpenAI** | `he config init -p openai -k sk-xxx` || **Bailian** | `he config init -p bailian -k sk-xxx` |+| **Anthropic** | `he config llm -p anthropic -k sk-ant-xxx` + `he config embedder -p openai -k sk-xxx` || **DeepSeek** | `he config llm -p deepseek -k sk-xxx` + `he config embedder -p openai -k sk-xxx` || **vLLM** | `he config init` → select "local vLLM" || **Mixed** (LLM=Bailian, Embedder=vLLM) | `he config llm -p bailian -k sk-xxx` + `he config embedder -p vllm -u http://localhost:8001/v1 -k dummy` |diff --git a/docs/en/resources/faq.md b/docs/en/resources/faq.mdindex b7a60c3..dba125a 100644--- a/docs/en/resources/faq.md+++ b/docs/en/resources/faq.md@@ -20,7 +20,7 @@ Hyper-Extract is an LLM-powered knowledge extraction framework that transforms u### Is it free?-The software is open-source (Apache-2.0). You need to provide your own OpenAI API key for LLM calls.+The software is open-source (Apache-2.0). You need an API key from a supported LLM provider (OpenAI, Anthropic, DeepSeek, Alibaba Bailian, or local vLLM).---@@ -29,7 +29,7 @@ The software is open-source (Apache-2.0). You need to provide your own OpenAI AP### What are the requirements?- Python 3.11+-- OpenAI API key+- An API key from any supported provider (OpenAI, Anthropic, DeepSeek, Bailian, or local vLLM)### How do I install it?@@ -58,31 +58,59 @@ pip install hyperextract### Where do I set my API key?**Option 1**: CLI+```bash-he config init -k YOUR_API_KEY+# OpenAI / Bailian (one-step)+he config init -p openai -k YOUR_API_KEY+he config init -p bailian -k YOUR_API_KEY++# Anthropic / DeepSeek (LLM + separate embedder)+he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+he config embedder -p openai -k YOUR_OPENAI_API_KEY```**Option 2**: Environment variable+```bash-export OPENAI_API_KEY=your-api-key+export OPENAI_API_KEY=your-api-key # OpenAI/Bailian+export ANTHROPIC_API_KEY=your-api-key # Anthropic+export DEEPSEEK_API_KEY=your-api-key # DeepSeek```-**Option 3**: .env file+**Option 3**: `.env` file```OPENAI_API_KEY=your-api-key```### Can I use a different LLM provider?-Yes, set the base URL:+Yes! Hyper-Extract supports OpenAI, Anthropic, DeepSeek, Alibaba Bailian, and local vLLM out of the box:++```bash+# OpenAI / Bailian+he config init -p openai -k YOUR_API_KEY++# DeepSeek / Anthropic (LLM only, pair with OpenAI embedder)+he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+he config embedder -p openai -k YOUR_OPENAI_API_KEY+```++For custom OpenAI-compatible endpoints:```bash-he config set llm.base_url https://your-provider.com/v1+he config llm --base-url https://your-provider.com/v1 -k YOUR_API_KEY```+See [Provider System](../concepts/provider-system.md) for the full compatibility list.+### Which models are supported?-- OpenAI models (gpt-4o, gpt-4o-mini, etc.)-- Any OpenAI-compatible API+- **OpenAI**: gpt-4o, gpt-4o-mini, gpt-5+- **Anthropic**: claude-opus-4-8, claude-sonnet-4-6, claude-haiku-4-5+- **DeepSeek**: deepseek-v4-flash, deepseek-v4-pro+- **Alibaba Bailian**: qwen-plus, qwen-turbo, qwen3.6-plus+- **Local vLLM**: Any model served via vLLM (e.g. Qwen/Qwen3.5-9B)++See [Provider System](../concepts/provider-system.md) for the full compatibility table.---@@ -196,9 +224,10 @@ data_dict = result.data.model_dump()### "API key not found"-Run:```bash-he config init -k YOUR_API_KEY+# Specify your provider+he config init -p openai -k YOUR_API_KEY+# or: -p bailian, -p deepseek, etc.```### "Template not found"diff --git a/docs/en/resources/troubleshooting.md b/docs/en/resources/troubleshooting.mdindex 6e6c37a..5659938 100644--- a/docs/en/resources/troubleshooting.md+++ b/docs/en/resources/troubleshooting.md@@ -44,12 +44,19 @@ Solutions to common issues.1. **CLI Configuration** (recommended):```bash- he config init -k YOUR_API_KEY+ # OpenAI / Bailian (one-step)+ he config init -p openai -k YOUR_API_KEY++ # Anthropic / DeepSeek (LLM + separate embedder)+ he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY```2. **Environment Variable**:```bashexport OPENAI_API_KEY=your-api-key+ export ANTHROPIC_API_KEY=your-api-key # for Anthropic+ export DEEPSEEK_API_KEY=your-api-key # for DeepSeek```3. **Verify Configuration**:@@ -65,8 +72,9 @@ Solutions to common issues.1. Verify key is correct2. Check for extra spaces-3. Try regenerating key in OpenAI dashboard-4. Check if key has available credits+3. For Anthropic: ensure `ANTHROPIC_API_KEY` (not `OPENAI_API_KEY`)+4. For DeepSeek: ensure `DEEPSEEK_API_KEY` (not `OPENAI_API_KEY`)+5. Check if key has available credits/quota---diff --git a/docs/en/tutorials/knowledge-base/step1-setup.md b/docs/en/tutorials/knowledge-base/step1-setup.mdindex 3b23b96..eec455c 100644--- a/docs/en/tutorials/knowledge-base/step1-setup.md+++ b/docs/en/tutorials/knowledge-base/step1-setup.md@@ -76,6 +76,16 @@ backup_dir: "./backups"## Management Script+### Prerequisites++Install the required packages:++```bash+pip install pyyaml hyperextract python-dotenv+```++> **Note:** The management script uses `pyyaml` for config files and `python-dotenv` for loading API keys. These are not included in Hyper-Extract's default dependencies.+### kb_manager.py (Starter)```python@@ -175,6 +185,8 @@ EOF### 2. Run Setup+Ensure `pyyaml` and `python-dotenv` are installed (see [Prerequisites](#prerequisites) above):+```bashpython kb_manager.py```diff --git a/docs/zh/cli/commands/config.md b/docs/zh/cli/commands/config.mdindex 7c6b23e..992047b 100644--- a/docs/zh/cli/commands/config.md+++ b/docs/zh/cli/commands/config.md@@ -28,6 +28,7 @@ he config [COMMAND] [OPTIONS]- **OpenAI preset**: `gpt-4o-mini` + `text-embedding-3-small`- **百炼 preset**: `qwen3.6-plus` + `text-embedding-v4`- **DeepSeek preset**: `deepseek-v4-flash`(仅 LLM —— 无嵌入预设)+- **Anthropic preset**: `claude-opus-4-8`(仅 LLM —— 无嵌入预设,请搭配 OpenAI 兼容嵌入器)```bashhe config init [OPTIONS]@@ -37,7 +38,7 @@ he config init [OPTIONS]| 选项 | 简写 | 描述 ||--------|-------|-------------|-| `--provider` | `-p` | 提供商 preset (`openai` / `bailian` / `deepseek` / `vllm`) |+| `--provider` | `-p` | 提供商 preset (`openai` / `anthropic` / `deepseek` / `bailian` / `vllm`) || `--api-key` | `-k` | LLM 和嵌入模型的 API 密钥 || `--base-url` | `-u` | 自定义 API 基础 URL(可选) |@@ -55,6 +56,10 @@ he config init -p bailian -k sk-your-api-key-here# DeepSeek(仅 LLM —— 请搭配 OpenAI 兼容嵌入器)he config llm -p deepseek -k sk-your-deepseek-keyhe config embedder -p openai -k sk-your-openai-key++# Anthropic(仅 LLM —— 请搭配 OpenAI 兼容嵌入器)+he config llm -p anthropic -k sk-your-anthropic-key+he config embedder -p openai -k sk-your-openai-key```执行后会自动保存对应 preset 的默认模型和 API 地址。@@ -109,6 +114,7 @@ he config llm [OPTIONS]| 选项 | 简写 | 描述 ||--------|-------|-------------|+| `--provider` | `-p` | 提供商 preset(如 `openai`、`anthropic`、`deepseek`、`bailian`、`vllm`) || `--api-key` | `-k` | LLM API 密钥 || `--model` | `-m` | LLM 模型名称 || `--base-url` | `-u` | 自定义 API 基础 URL |@@ -151,6 +157,7 @@ he config embedder [OPTIONS]| 选项 | 简写 | 描述 ||--------|-------|-------------|+| `--provider` | `-p` | 提供商 preset(如 `openai`、`anthropic`、`deepseek`、`bailian`、`vllm`) || `--api-key` | `-k` | 嵌入模型 API 密钥 || `--model` | `-m` | 嵌入模型名称 || `--base-url` | `-u` | 自定义 API 基础 URL |diff --git a/docs/zh/cli/configuration.md b/docs/zh/cli/configuration.mdindex 6013f9c..1128f56 100644--- a/docs/zh/cli/configuration.md+++ b/docs/zh/cli/configuration.md@@ -1,6 +1,6 @@# CLI 配置参考-Hyper-Extract CLI 的配置指南,支持 **OpenAI**、**DeepSeek**、**阿里云百炼** 和 **本地 vLLM** 部署方式。+Hyper-Extract CLI 的配置指南,支持 **OpenAI**、**Anthropic**、**DeepSeek**、**阿里云百炼** 和 **本地 vLLM** 部署方式。---@@ -28,6 +28,32 @@ Hyper-Extract CLI 的配置指南,支持 **OpenAI**、**DeepSeek**、**阿里- **LLM**: `qwen3.6-plus`- **嵌入模型**: `text-embedding-v4`+=== "Anthropic (Claude)"++ Anthropic 仅提供 LLM —— 请搭配 OpenAI 兼容嵌入器:++ ```bash+ he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY+ ```++ 这会创建 `~/.he/config.toml`:+ - **LLM**: `claude-opus-4-8` (Anthropic)+ - **嵌入模型**: `text-embedding-3-small` (OpenAI)++=== "DeepSeek"++ DeepSeek 仅提供 LLM —— 请搭配 OpenAI 兼容嵌入器:++ ```bash+ he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY+ ```++ 这会创建 `~/.he/config.toml`:+ - **LLM**: `deepseek-v4-flash` (DeepSeek,自动关闭思考模式)+ - **嵌入模型**: `text-embedding-3-small` (OpenAI)+=== "本地 vLLM"需先启动 LLM 和 Embedding 两个服务,然后分别配置:@@ -139,6 +165,22 @@ he config embedder --unsethe config llm -p bailian -k sk-your-key -m qwen-plus```+=== "Anthropic (Claude)"++ ```bash+ # LLM 用 Anthropic,Embedding 用 OpenAI+ he config llm -p anthropic -k sk-ant-your-key+ he config embedder -p openai -k sk-your-openai-key+ ```++=== "DeepSeek"++ ```bash+ # LLM 用 DeepSeek,Embedding 用 OpenAI+ he config llm -p deepseek -k sk-your-key+ he config embedder -p openai -k sk-your-openai-key+ ```+=== "本地 vLLM"```bashdiff --git a/docs/zh/cli/index.md b/docs/zh/cli/index.mdindex c249bd6..d2d93af 100644--- a/docs/zh/cli/index.md+++ b/docs/zh/cli/index.md@@ -40,7 +40,7 @@ he --version| `he build-index` | 构建/重建搜索索引 | `-f` 强制重建 || `he clean` | 删除 KA 的索引(或整个 KA) | `-a` all, `-y` yes || `he list` | 列出模板和方法 | `template` 或 `method` |-| `he config` | 管理配置 | `init`, `show`, `set` |+| `he config` | 管理配置 | `init`, `show`, `llm`, `embedder` |---@@ -102,6 +102,15 @@ flowchart TBhe config embedder -p openai -k YOUR_OPENAI_API_KEY```+=== "Anthropic (Claude)"++ Anthropic 仅提供 LLM —— 请搭配 OpenAI 兼容嵌入器:++ ```bash+ he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY+ ```+=== "本地 vLLM"需先安装 [vLLM](https://docs.vllm.ai/) 并分别启动 LLM 和 Embedding 服务:@@ -206,7 +215,7 @@ he parse doc.md -m light_rag```bash# 英文-he parse doc.md -t general/biography_graph -l zh+he parse doc.md -t general/biography_graph -l en# 中文he parse doc.md -t general/biography_graph -l zhdiff --git a/docs/zh/getting-started/cli-quickstart.md b/docs/zh/getting-started/cli-quickstart.mdindex be985b9..79af322 100644--- a/docs/zh/getting-started/cli-quickstart.md+++ b/docs/zh/getting-started/cli-quickstart.md@@ -48,8 +48,19 @@-m BAAI/bge-m3```+=== "Anthropic (Claude)"++ Anthropic 仅提供 LLM —— 搜索/对话功能需搭配 OpenAI 兼容的 embedder:++ ```bash+ he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY+ ```+这会在 `~/.he/config.toml` 创建配置文件,只需配置一次。+> **注意:** Anthropic 和 DeepSeek 仅提供 LLM。如需使用搜索(`he search`)和对话(`he talk`)功能,请按上文所示搭配 OpenAI 兼容的 embedder。+---## 第 2 步:下载示例文档@@ -219,7 +230,7 @@ he build-index ./output/## 故障排除**"No API key found"**-→ 运行 `he config init -k YOUR_API_KEY`+→ 运行 `he config init -p openai -k YOUR_OPENAI_API_KEY`(或使用 `-p bailian`、`-p deepseek` 等)**"Template not found"**→ 使用 `he list template` 查看可用模板diff --git a/docs/zh/getting-started/installation.md b/docs/zh/getting-started/installation.mdindex 021a3d3..e580c58 100644--- a/docs/zh/getting-started/installation.md+++ b/docs/zh/getting-started/installation.md@@ -10,6 +10,14 @@ Hyper-Extract 需要 **Python 3.11+**。=== "uv (推荐)"+ 首先安装 [uv](https://docs.astral.sh/uv/)(如果尚未安装):++ ```bash+ curl -LsSf https://astral.sh/uv/install.sh | sh+ ```++ 然后安装 Hyper-Extract:+```bashuv tool install hyperextract```@@ -20,6 +28,8 @@ Hyper-Extract 需要 **Python 3.11+**。pipx install hyperextract```+ > 没有安装 pipx?运行 `pip install pipx` 安装。+---## 安装为 Python 库@@ -51,7 +61,7 @@ Hyper-Extract 需要 **Python 3.11+**。您应该看到类似输出:```- Hyper-Extract CLI version 0.1.3.dev0+ Hyper-Extract CLI version 0.4.0```=== "Python"@@ -68,11 +78,13 @@ Hyper-Extract 需要 **Python 3.11+**。如果您想贡献或修改源代码:```bash-# 克隆仓库git clone https://github.com/yifanfeng97/hyper-extract.gitcd hyper-extract-# 以可编辑模式安装开发依赖+# 使用 uv 安装(推荐)+uv sync --extra dev++# 或使用 pippip install -e ".[dev]"```diff --git a/docs/zh/getting-started/python-quickstart.md b/docs/zh/getting-started/python-quickstart.mdindex 3e8ebfd..c3bbb18 100644--- a/docs/zh/getting-started/python-quickstart.md+++ b/docs/zh/getting-started/python-quickstart.md@@ -38,9 +38,35 @@ pip install hyperextractecho "OPENAI_API_KEY=your-api-key" > .env```-**方式 B — 百炼、DeepSeek 或 vLLM**+**方式 B — 其他 Provider(Anthropic、DeepSeek、百炼、vLLM)**-平台特定配置见 [Provider 配置指南](../python/guides/provider-configuration.md)。+在 `.env` 中设置相应的环境变量:++```bash+# Anthropic+ANTHROPIC_API_KEY=sk-ant-xxx+OPENAI_API_KEY=sk-xxx # 用于 embeddings++# DeepSeek+DEEPSEEK_API_KEY=sk-xxx+OPENAI_API_KEY=sk-xxx # 用于 embeddings++# 百炼(阿里云)+OPENAI_API_KEY=sk-xxx+OPENAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1+```++然后在脚本中配置客户端:++```python+from hyperextract import create_client, Template++# 示例:DeepSeek LLM + OpenAI embedder+llm, emb = create_client(llm="deepseek", embedder="openai:text-embedding-3-small")+ka = Template.create("general/biography_graph", language="zh", llm_client=llm, embedder=emb)+```++详见 [Provider 配置指南](../python/guides/provider-configuration.md)。---@@ -241,7 +267,6 @@ if __name__ == "__main__":```-```---diff --git a/docs/zh/python/guides/provider-configuration.md b/docs/zh/python/guides/provider-configuration.mdindex 03c7fbe..692f49e 100644--- a/docs/zh/python/guides/provider-configuration.md+++ b/docs/zh/python/guides/provider-configuration.md@@ -25,6 +25,19 @@ llm, emb = create_client("bailian", api_key="sk-xxx")# 或换模型: create_client("bailian:qwen3.6-plus", api_key="sk-xxx")```+### Anthropic (Claude)++```python+from hyperextract import create_client, AutoGraph++# Anthropic 仅提供 LLM——请搭配 OpenAI 兼容嵌入器。+# 密钥:LLM 使用 ANTHROPIC_API_KEY(或 CLAUDE_API_KEY),嵌入使用 OPENAI_API_KEY。+llm, emb = create_client(+ llm="anthropic", # 默认模型:claude-opus-4-8(用 "anthropic:<model>" 覆盖)+ embedder="openai:text-embedding-3-small",+)+```+### DeepSeek```python@@ -75,6 +88,7 @@ print(f"节点: {len(graph.nodes)}, 关系: {len(graph.edges)}")|------|------|| **OpenAI** | `he config init -p openai -k sk-xxx` || **百炼** | `he config init -p bailian -k sk-xxx` |+| **Anthropic** | `he config llm -p anthropic -k sk-ant-xxx` + `he config embedder -p openai -k sk-xxx` || **DeepSeek** | `he config llm -p deepseek -k sk-xxx` + `he config embedder -p openai -k sk-xxx` || **vLLM** | `he config init` → 选择「本地 vLLM」 || **混合部署**(LLM=百炼 + Embedding=本地) | `he config llm -p bailian -k sk-xxx` + `he config embedder -p vllm -u http://localhost:8001/v1 -k dummy` |diff --git a/docs/zh/resources/faq.md b/docs/zh/resources/faq.mdindex fcb1ef2..edb9a19 100644--- a/docs/zh/resources/faq.md+++ b/docs/zh/resources/faq.md@@ -20,7 +20,7 @@ Hyper-Extract 是一个基于大语言模型的知识提取框架,可以将非### 它是免费的吗?-本软件是开源的(Apache-2.0 协议)。您需要提供自己的 OpenAI API 密钥来进行大语言模型调用。+本软件是开源的(Apache-2.0 协议)。您需要从支持的 LLM 提供商获取 API 密钥(OpenAI、Anthropic、DeepSeek、阿里云百炼或本地 vLLM)。---@@ -29,7 +29,7 @@ Hyper-Extract 是一个基于大语言模型的知识提取框架,可以将非### 系统要求是什么?- Python 3.11+-- OpenAI API 密钥+- 任意支持的提供商的 API 密钥(OpenAI、Anthropic、DeepSeek、百炼或本地 vLLM)### 如何安装?@@ -58,31 +58,59 @@ pip install hyperextract### 在哪里设置 API 密钥?**选项 1**:命令行+```bash-he config init -k YOUR_API_KEY+# OpenAI / 百炼(一步到位)+he config init -p openai -k YOUR_API_KEY+he config init -p bailian -k YOUR_API_KEY++# Anthropic / DeepSeek(LLM + 独立嵌入器)+he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+he config embedder -p openai -k YOUR_OPENAI_API_KEY```**选项 2**:环境变量+```bash-export OPENAI_API_KEY=your-api-key+export OPENAI_API_KEY=your-api-key # OpenAI/百炼+export ANTHROPIC_API_KEY=your-api-key # Anthropic+export DEEPSEEK_API_KEY=your-api-key # DeepSeek```-**选项 3**:.env 文件+**选项 3**:`.env` 文件```OPENAI_API_KEY=your-api-key```### 可以使用其他大语言模型提供商吗?-可以,设置 base URL:+可以!Hyper-Extract 开箱即用支持 OpenAI、Anthropic、DeepSeek、阿里云百炼和本地 vLLM:++```bash+# OpenAI / 百炼+he config init -p openai -k YOUR_API_KEY++# DeepSeek / Anthropic(仅 LLM,需搭配 OpenAI 嵌入器)+he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+he config embedder -p openai -k YOUR_OPENAI_API_KEY+```++对于自定义的 OpenAI 兼容端点:```bash-he config set llm.base_url https://your-provider.com/v1+he config llm --base-url https://your-provider.com/v1 -k YOUR_API_KEY```+参见 [Provider 系统](../concepts/provider-system.md) 了解完整兼容性列表。+### 支持哪些模型?-- OpenAI 模型(gpt-4o、gpt-4o-mini 等)-- 任何兼容 OpenAI API 的接口+- **OpenAI**:gpt-4o、gpt-4o-mini、gpt-5+- **Anthropic**:claude-opus-4-8、claude-sonnet-4-6、claude-haiku-4-5+- **DeepSeek**:deepseek-v4-flash、deepseek-v4-pro+- **阿里云百炼**:qwen-plus、qwen-turbo、qwen3.6-plus+- **本地 vLLM**:通过 vLLM 提供的任意模型(如 Qwen/Qwen3.5-9B)++参见 [Provider 系统](../concepts/provider-system.md) 了解完整兼容性表格。---@@ -196,9 +224,10 @@ data_dict = result.data.model_dump()### "API key not found"-运行:```bash-he config init -k YOUR_API_KEY+# 指定您的提供商+he config init -p openai -k YOUR_API_KEY+# 或:-p bailian、-p deepseek 等```### "Template not found"diff --git a/docs/zh/resources/troubleshooting.md b/docs/zh/resources/troubleshooting.mdindex 6040e8a..af62c32 100644--- a/docs/zh/resources/troubleshooting.md+++ b/docs/zh/resources/troubleshooting.md@@ -42,12 +42,19 @@1. **CLI 配置**(推荐):```bash- he config init -k YOUR_API_KEY+ # OpenAI / 百炼(一步到位)+ he config init -p openai -k YOUR_API_KEY++ # Anthropic / DeepSeek(LLM + 独立嵌入器)+ he config llm -p deepseek -k YOUR_DEEPSEEK_API_KEY+ he config embedder -p openai -k YOUR_OPENAI_API_KEY```2. **环境变量**:```bashexport OPENAI_API_KEY=your-api-key+ export ANTHROPIC_API_KEY=your-api-key # 用于 Anthropic+ export DEEPSEEK_API_KEY=your-api-key # 用于 DeepSeek```3. **验证配置**:@@ -62,8 +69,9 @@**解决方案**:1. 验证密钥是否正确2. 检查是否有额外的空格-3. 尝试在 OpenAI 控制台重新生成密钥-4. 检查密钥是否有可用额度+3. Anthropic:确保使用 `ANTHROPIC_API_KEY`(而非 `OPENAI_API_KEY`)+4. DeepSeek:确保使用 `DEEPSEEK_API_KEY`(而非 `OPENAI_API_KEY`)+5. 检查密钥是否有可用额度/配额---diff --git a/docs/zh/tutorials/knowledge-base/step1-setup.md b/docs/zh/tutorials/knowledge-base/step1-setup.mdindex 8505f59..f430fc2 100644--- a/docs/zh/tutorials/knowledge-base/step1-setup.md+++ b/docs/zh/tutorials/knowledge-base/step1-setup.md@@ -76,6 +76,16 @@ backup_dir: "./backups"## 管理脚本+### 前置依赖++安装所需的包:++```bash+pip install pyyaml hyperextract python-dotenv+```++> **注意:** 管理脚本使用 `pyyaml` 处理配置文件,使用 `python-dotenv` 加载 API 密钥。这些不包含在 Hyper-Extract 的默认依赖中。+### kb_manager.py(入门版)```python@@ -175,6 +185,8 @@ EOF### 2. 运行设置+确保已安装 `pyyaml` 和 `python-dotenv`(参见上方的前置依赖部分):+```bashpython kb_manager.py```