Upstage Schema Generation
/install upstage-schema-generation
Upstage Schema Generation
Analyze sample documents and automatically generate a JSON schema for use with Information Extraction.
Prerequisites
- API Key:
UPSTAGE_API_KEYenvironment variable is required. Get your key at console.upstage.ai.
Two Modes
| Mode | When to use | Latency |
|---|---|---|
| API mode | Default. Fast schema generation via Upstage endpoint. | Low |
VLM mode (claude-opus-4-6) |
When the user wants careful, hand-tuned schemas with precise extraction rules and table-aware design. | High |
API Mode (Default)
Endpoint: POST https://api.upstage.ai/v1/information-extraction/schema-generation
import os
import json
import requests
import base64
api_key = os.environ["UPSTAGE_API_KEY"]
with open("document.pdf", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
response = requests.post(
"https://api.upstage.ai/v1/information-extraction/schema-generation",
headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
json={
"model": "information-extract",
"messages": [
{"role": "system", "content": "Generate schema for this invoice document."},
{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": f"data:application/pdf;base64,{b64}"}}
]}
]
}
)
schema = json.loads(response.json()["choices"][0]["message"]["content"])
print(json.dumps(schema, indent=2))
Note: The API model is
information-extract(notschema-generate). Thesystemmessage can guide the schema focus (e.g., "Generate schema about bank_name."). Up to 3 sample images can be provided in the user message.
VLM Mode
For carefully designed schemas with precise extraction rules, follow the 4-step VLM workflow.
- Workflow: Read
references/vlm-workflow.md(parameter gathering, document reading, property list, JSON schema conversion) - Design rules: Read
references/schema-design.md(key naming, descriptions, table handling, blank/duplicate handling)
Output Files
- Default: write generated schema to
\x3Csystem-temp>/\x3Cinput-stem>.schema.json(e.g.,/tmp/invoice.schema.json). For inline input with no source file, use\x3Csystem-temp>/\x3Ctimestamp>-schema.json. - Override: if the user specifies an output path, use it.
- Always print the resolved absolute path in your response so the user can locate the file.
Related Skills
- Generated schema → use directly as
response_formatinupstage-information-extraction - If documents need pre-sorting → classify with
upstage-document-classificationfirst, then generate per-category schemas - For multi-API pipelines → see
upstage-builder
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install upstage-schema-generation - 安装完成后,直接呼叫该 Skill 的名称或使用
/upstage-schema-generation触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Upstage Schema Generation 是什么?
Generate a JSON schema for structured document information extraction. Use this skill whenever the user asks to generate or create a schema for a document —... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 29 次。
如何安装 Upstage Schema Generation?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install upstage-schema-generation」即可一键安装,无需额外配置。
Upstage Schema Generation 是免费的吗?
是的,Upstage Schema Generation 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Upstage Schema Generation 支持哪些平台?
Upstage Schema Generation 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Upstage Schema Generation?
由 Upstage Deployment(@upstage-deployment)开发并维护,当前版本 v1.0.0。