document-extraction
它能做什么
这项技能使用 LandingAI 的智能文档提取服务,读取文档并提取你需要的信息。适合希望无需手动输入即可从表单、发票或表格中获取数据的人。
适用场景
- ✓当你需要把 PDF 或扫描件转换为结构化的 Markdown 文本的时候。
- ✓当你想从文档中提取发票号码或总额等特定字段的时候。
- ✓当你需要把一批混合类型的文档按类型分类的时候。
技能链接
https://github.com/andrewyng/context-hub/blob/main/content/landingai/skills/ade/document-extraction/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想读取这份发票 PDF,并把发票号码、日期和总额整理成表格。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会用你的 API 密钥设置 ADE 工具,把文档发送给服务,并返回你要求的文本或字段。它需要一个 ADE API 密钥才能工作。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Document Extraction (ADE)
Overview
LandingAI's Agentic Document Extraction (ADE) is a document processing SaaS that parses, extracts, and classifies documents without requiring templates or training. It provides three main capabilities:
- Parse: Convert documents into structured Markdown with hierarchical JSON representation
- Extract: Pull specific structured data using JSON schemas or Pydantic models
- Split: Classify and separate multi-document batches by type
Key Benefits:
- No ML training or templates required
- Layout-agnostic parsing (works with any document structure)
- Supports 20+ file formats (PDF, images, spreadsheets, presentations)
- Precise visual grounding (bounding boxes, page numbers)
- Multiple models optimized for different document types
Quick Start
1. Installation
Never install packages globally without user approval. Always check for a local Python environment first.
1. .venv/bin/python — uv-managed (this project)
2. venv/bin/python — standard Python venv
3. uv run python — if pyproject.toml exists
4. poetry run python — if poetry.lock exists
5. python3 — system fallback; warn the user
Use the local environment to install: landingai-ade, python-dotenv
2. API Key Setup
The user may have already setup a .env file in the same directory as the document-extraction skill with the API key. You MUST check this path first (ls -la .*/skills/document-extraction/.env). Also try checking on the same directory as this SKILL.md file.
If not, provide instructions to create one. The script below will search for .env in common locations and load it.
.venv/bin/python - << 'EOF'
import os
from pathlib import Path
from dotenv import load_dotenv
# Load API key: prefer existing env var, then .env file lookup
if os.environ.get("VISION_AGENT_API_KEY"):
print("API key found in existing environment variable")
else:
def _find_env():
for d in [Path.cwd().resolve(), *Path.cwd().resolve().parents]:
for candidate in [
# ADD the directory where the document-extraction skill is located
d / '.env',
d / 'document-extraction/.env',
d / 'skills/document-extraction/.env',
]:
if candidate.is_file():
return candidate
return None
env = _find_env()
if env:
load_dotenv(env)
print(f"API key loaded from: {env}")
else:
print("Warning: VISION_AGENT_API_KEY not set and no .env found")
EOF
If not key is found instruct the user to get an API key from https://va.landing.ai/settings/api-key
Copy .env-sample to .env and add your API key:
cp .env-sample .env
Edit .env and add your key:
VISION_AGENT_API_KEY=your_actual_api_key_here
Note: The .env file is gitignored for security. Advanced users can also set the environment variable directly: export VISION_AGENT_API_KEY=<your-key>
EU Endpoint: If using the EU endpoint, set environment="eu" when initializing the client.
3. Basic Parse Example
from dotenv import load_dotenv
load_dotenv() # Load API key from .env
from landingai_ade import LandingAIADE
from pathlib import Path
client = LandingAIADE()
# Parse a document
response = client.parse(
document=Path("document.pdf"),
model="dpt-2-latest"
)
# Access results
print(f"Pages: {response.metadata.page_count}")
print(f"Chunks: {len(response.chunks)}")
print("\nMarkdown output:")
print(response.markdown[:500]) # First 500 chars
# Save Markdown for extraction
with open("output.md", "w", encoding="utf-8") as f:
f.write(response.markdown)
4. Basic Extract Example
from dotenv import load_dotenv
load_dotenv()
from landingai_ade import LandingAIADE
from landingai_ade.lib import pydantic_to_json_schema
from pydantic import BaseModel, Field
from pathlib import Path
# Define extraction schema using Pydantic
class Invoice(BaseModel):
invoice_number: str = Field(description="Invoice number")
invoice_date: str = Field(description="Invoice date")
total_amount: float = Field(description="Total amount in USD")
vendor_name: str = Field(description="Vendor name")
# Convert to JSON schema
schema = pydantic_to_json_schema(Invoice)
client = LandingAIADE()
# Extract from parsed markdown
response = client.extract(
s
常见问题
支持哪些文件类型?
该技能说明它支持 PDF、图片、电子表格和演示文稿,以及 20 多种格式中的其他格式。
每种文档都需要模板吗?
不需要。该技能说明无需为每种版式设置模板或进行训练。
我的 API 密钥保存在哪里?
该技能会从项目文件夹中的本地 .env 文件读取。
详情
作者的原始描述
Use this skill for intelligent document processing and content extraction using LandingAI's Agentic Document Extraction (ADE). Trigger when users need to (1) Parse documents (PDFs, images, spreadsheets, presentations) into structured Markdown with layout understanding, (2) Extract specific structured data from documents using schemas (invoice fields, form data, table data, etc.), (3) Classify and separate multi-document batches by type (invoices vs receipts, statements vs forms, etc.), (4) Process large documents asynchronously (up to 1GB/1000 pages), (5) Get visual grounding (bounding boxes,
repo: andrewyng/context-hub
热度
- GitHub 星标
- 14k
- 排名
- #11271
- 许可证
- MIT
- 更新时间
- 2026/5/31
评论
- …
同一仓库的更多技能
get-api-docs
14k帮你的智能体在编写代码之前获取第三方 API 和库的最新文档,而不是依赖旧的记忆。
bloc-cubit
14k教你的智能体如何用 Bloc 或 Cubit 管理 Flutter 应用的状态,包括何时选择哪一个,以及便于测试的安全默认设置。
riverpod
14k教你的智能体如何用 Riverpod 管理 Flutter 应用的状态,涵盖 provider、异步数据和测试,并为每种情况提供合理的默认设置。
document-workflows
14k帮你的智能体构建可重复使用的流程,一次处理大量文档,为搜索工具做好准备,并将结果导入数据库。