Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,23 @@ he config embedder -p vllm -u http://localhost:8001/v1 -k dummy -m BAAI/bge-m3
```

<details>
<summary><b>More providers</b> — Anthropic (Claude), Alibaba Bailian, OrcaRouter…</summary>
<summary><b>More providers</b> — Anthropic (Claude), Google Gemini, Alibaba Bailian, OrcaRouter…</summary>
<br>

```bash
# 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 and DeepSeek are LLM-only (pair them with an OpenAI-compatible embedder). DeepSeek is the most cost-effective option (~$0.001-0.005/page).
> 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).

</details>

Expand Down Expand Up @@ -243,14 +247,15 @@ Hyper-Extract uses LangChain structured output with **function calling**. The mo
|----------|-----------------|
| **OpenAI** | gpt-4o, gpt-4o-mini, gpt-5 |
| **Anthropic** | claude-opus-4-8, claude-sonnet-4-6, claude-haiku-4-5 |
| **Google Gemini** | gemini-3.8-flash |
| **DeepSeek** | deepseek-v4-flash, deepseek-v4-pro |
| **阿里云百炼** | qwen-plus, qwen-turbo, deepseek-r1 |
| **Local vLLM** | Qwen3.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).

<details>
<summary><b>Provider notes</b> — DeepSeek & Anthropic pairing</summary>
<summary><b>Provider notes</b> — DeepSeek, Anthropic & Gemini pairing</summary>
<br>

> **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:
Expand All @@ -267,6 +272,13 @@ Hyper-Extract uses LangChain structured output with **function calling**. The mo
> 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:
>
> ```python
> from hyperextract import create_client
> llm, emb = create_client(llm="google", embedder="openai:text-embedding-3-small")
> ```

</details>

> 📖 Full guide: [Provider System & Local Model Support](https://yifanfeng97.github.io/Hyper-Extract/latest/concepts/provider-system/)
Expand Down
18 changes: 15 additions & 3 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,23 @@ he config embedder -p vllm -u http://localhost:8001/v1 -k dummy -m BAAI/bge-m3
```

<details>
<summary><b>更多 provider</b> — Anthropic (Claude)、阿里云百炼、OrcaRouter…</summary>
<summary><b>更多 provider</b> — Anthropic (Claude)、Google Gemini、阿里云百炼、OrcaRouter…</summary>
<br>

```bash
# Anthropic (Claude) —— 仅 LLM
he config llm -p anthropic -k YOUR_ANTHROPIC_API_KEY
he config embedder -p openai -k YOUR_OPENAI_API_KEY

# Google Gemini —— 仅 LLM(默认:gemini-3.8-flash)
he config llm -p google -k YOUR_GOOGLE_API_KEY
he config embedder -p openai -k YOUR_OPENAI_API_KEY

# 百炼(阿里云,Qwen,一个 key 同时提供 LLM 和 embedding)
he config init -p bailian -k YOUR_BAILIAN_API_KEY
```

> OpenAI 和百炼同时提供 LLM 和 embedding 模型;Anthropic 和 DeepSeek 仅提供 LLM(需搭配 OpenAI 兼容 embedder)。DeepSeek 最经济(约 $0.001-0.005/页)。
> OpenAI 和百炼同时提供 LLM 和 embedding 模型;Anthropic、Google Gemini 和 DeepSeek 仅提供 LLM(需搭配 OpenAI 兼容 embedder)。DeepSeek 最经济(约 $0.001-0.005/页)。

</details>

Expand Down Expand Up @@ -243,14 +247,15 @@ Hyper-Extract 通过 LangChain 结构化输出的 **function calling** 方法工
|----------|-----------------|
| **OpenAI** | gpt-4o, gpt-4o-mini, gpt-5 |
| **Anthropic** | claude-opus-4-8, claude-sonnet-4-6, claude-haiku-4-5 |
| **Google Gemini** | gemini-3.8-flash |
| **DeepSeek** | deepseek-v4-flash, deepseek-v4-pro |
| **阿里云百炼** | qwen-plus, qwen-turbo, deepseek-r1 |
| **本地 vLLM** | Qwen3.5-9B (GPTQ-Marlin) |

**嵌入模型**(语义搜索)支持任意 OpenAI 兼容端点:`text-embedding-3-small`、`text-embedding-v4`(百炼)、`bge-m3`(本地 vLLM)。

<details>
<summary><b>Provider 说明</b> — DeepSeek 与 Anthropic 的搭配方式</summary>
<summary><b>Provider 说明</b> — DeepSeek、AnthropicGemini 的搭配方式</summary>
<br>

> **DeepSeek:** V4 模型默认开启 "thinking" 模式,Hyper-Extract 会自动关闭以保证结构化抽取可用。设置 `DEEPSEEK_API_KEY`。DeepSeek 没有嵌入接口:
Expand All @@ -267,6 +272,13 @@ Hyper-Extract 通过 LangChain 结构化输出的 **function calling** 方法工
> llm, emb = create_client(llm="anthropic", embedder="openai:text-embedding-3-small")
> ```

> **Google Gemini:** Gemini 仅用于 **LLM**(设置 `GOOGLE_API_KEY` 或 `GEMINI_API_KEY`,额外依赖:`pip install 'hyperextract[google]'`)。默认模型为 `gemini-3.8-flash`。本仓库没有成熟的 embedder 路径:
>
> ```python
> from hyperextract import create_client
> llm, emb = create_client(llm="google", embedder="openai:text-embedding-3-small")
> ```

</details>

> 📖 完整指南:[Provider 系统与本地模型支持](https://yifanfeng97.github.io/Hyper-Extract/latest/zh/concepts/provider-system/)
Expand Down
4 changes: 4 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ python providers/deepseek_demo.py
# Anthropic
python providers/anthropic_demo.py

# Google Gemini
python providers/google_demo.py

# OrcaRouter
python providers/orcarouter_demo.py

Expand Down Expand Up @@ -50,6 +53,7 @@ examples/
│ ├── bailian_demo.py # Bailian (Alibaba Cloud) setup
│ ├── deepseek_demo.py # DeepSeek setup
│ ├── anthropic_demo.py # Anthropic setup
│ ├── google_demo.py # Google Gemini setup
│ ├── orcarouter_demo.py # OrcaRouter setup
│ └── vllm_demo.py # Local vLLM setup
├── en/ # English demos
Expand Down
4 changes: 4 additions & 0 deletions examples/README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ python providers/deepseek_demo.py
# Anthropic
python providers/anthropic_demo.py

# Google Gemini
python providers/google_demo.py

# OrcaRouter
python providers/orcarouter_demo.py

Expand Down Expand Up @@ -51,6 +54,7 @@ examples/
│ ├── bailian_demo.py # 百炼(阿里云)配置
│ ├── deepseek_demo.py # DeepSeek 配置
│ ├── anthropic_demo.py # Anthropic 配置
│ ├── google_demo.py # Google Gemini 配置
│ ├── orcarouter_demo.py # OrcaRouter 配置
│ └── vllm_demo.py # 本地 vLLM 配置
├── en/ # 英文演示
Expand Down
36 changes: 36 additions & 0 deletions examples/providers/google_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
Google Gemini Provider Demo

Extract entities and relationships using the Gemini Developer API.
Gemini has no mature embedder path in this repo, so pair it with an
OpenAI-compatible embedder. Requires `pip install 'hyperextract[google]'`.
Set GOOGLE_API_KEY or GEMINI_API_KEY. No real key is required to read
this file.

Usage:
GOOGLE_API_KEY=xxx OPENAI_API_KEY=sk-xxx python examples/providers/google_demo.py
"""

from hyperextract import create_client, AutoGraph

# Gemini for LLM, OpenAI for embeddings (no Gemini embedder path here)
llm, emb = create_client(
llm="google", # default: gemini-3.8-flash
embedder="openai:text-embedding-3-small",
)

graph = AutoGraph(
instruction="Extract people and their relationships",
llm_client=llm,
embedder=emb,
node_key_extractor=lambda n: n.name,
edge_key_extractor=lambda e: (e.source, e.target, e.type),
nodes_in_edge_extractor=lambda e: (e.source, e.target),
)

text = "Zhang San founded ByteDance. Li Si serves as CEO."
graph.parse(text)

print(f"Nodes: {len(graph.nodes)}, Edges: {len(graph.edges)}")
for n in graph.nodes:
print(f" - {n.name} ({n.type})")