Loading...
Loading...
Compare original and translation side by side
$ARGUMENTS[mode] [source-or-template-or-question] [options]$ARGUMENTS| $ARGUMENTS pattern | Mode | What to produce |
|---|---|---|
| Plan | End-to-end workflow plan, template strategy, provider/config choices, validation path |
| Template | Pydantic graph template or review notes with stable IDs and relationship hints |
| `contract [direct | staged | delta] [domain]` |
| Convert | CLI/API run recipe with inputs, provider/model overrides, output paths, and validation |
| API | Python integration using |
| Inspect | HTML/debug inspection workflow for an existing or planned output directory |
| Export | JSON/CSV/Cypher/NetworkX export and post-export checks |
| Debug | Root-cause path using logs, |
| Batch | Scaling plan for many documents, manifests, retries, idempotency, and QA sampling |
| Natural language | Auto-detect | Classify first, then run the matching mode |
| Empty/unclear | Clarify | Ask for the document type, target graph, run surface, and provider constraints |
$ARGUMENTS[模式] [源/模板/问题] [选项]$ARGUMENTS| $ARGUMENTS 格式 | 模式 | 输出内容 |
|---|---|---|
| 规划 | 端到端工作流规划、模板策略、提供者/配置选择、验证路径 |
| 模板 | 带有稳定ID和关系提示的Pydantic图谱模板或评审笔记 |
| `contract [direct | staged | delta] [domain]` |
| 转换 | 包含输入、提供者/模型覆盖配置、输出路径及验证步骤的CLI/API运行方案 |
| API | 使用 |
| 检查 | 针对现有或规划输出目录的HTML/调试检查工作流 |
| 导出 | JSON/CSV/Cypher/NetworkX导出及导出后检查流程 |
| 调试 | 利用日志、 |
| 批量 | 多文档处理的扩容方案,包含清单、重试、幂等性和QA抽样策略 |
| 自然语言描述 | 自动检测 | 先分类任务类型,再执行匹配模式 |
| 空值/模糊描述 | 澄清 | 询问文档类型、目标图谱、运行载体和提供者约束 |
directstageddeltainspecttrace_data.jsonBaseModelFieldedge()docling-graph convertPipelineConfigrun_pipelineprovider_overridemodel_overridedirectstageddeltainspecttrace_data.jsonBaseModelFieldedge()docling-graph convertPipelineConfigrun_pipelineprovider_overridemodel_override| User asks | Response pattern |
|---|---|
| "Create a template for SEC filings" | Produce Pydantic models with graph ID fields, relationship fields, extraction notes, and a validation checklist. |
| "Should this use staged extraction?" | Compare direct, staged, and delta contracts against schema size, nesting, cardinality, provider limits, and debug cost. |
| "Run this PDF with OpenAI" | Provide a |
| "Review this output folder" | Walk |
| "The graph is missing relationships" | Diagnose template relationship modeling, extraction contract, structured-output fallback, gleaning, and graph mapping artifacts. |
| "Export to Neo4j" | Generate export steps plus uniqueness constraints, ID normalization, and relationship-count checks. |
| 用户提问 | 响应模式 |
|---|---|
| "为SEC filings创建模板" | 生成带有图谱ID字段、关系字段、提取说明和验证清单的Pydantic模型。 |
| "是否应该使用staged提取?" | 对比direct、staged和delta契约在schema规模、嵌套程度、基数、提供者限制及调试成本方面的差异。 |
| "用OpenAI处理这个PDF" | 提供 |
| "评审这个输出文件夹" | 引导执行 |
| "图谱缺少关系" | 诊断模板关系建模、提取契约、结构化输出降级、信息收集及图谱映射产物的问题。 |
| "导出到Neo4j" | 生成导出步骤,包含唯一性约束、ID规范化和关系计数检查。 |
docling-graphdocling-graphdebug/trace_data.jsondebug/trace_data.json| Contract | Use when | Main risks | Required checks |
|---|---|---|---|
| Small, stable schemas; limited nesting; provider handles full schema in one pass | Context overflow, weak relationship coverage | Schema fit, sparse-check results, field coverage |
| Large templates with clear sections or nested entity groups | Stage boundaries can drop cross-stage links | Stage outputs, root merge rules, relationship counts |
| Complex/high-cardinality graphs, weak source ordering, or incremental enrichment | Resolver quality and stable IDs dominate correctness | ID strategy, resolver config, duplicate entity checks |
| 契约类型 | 适用场景 | 主要风险 | 必要检查 |
|---|---|---|---|
| 小型稳定schema、有限嵌套、提供者可一次性处理完整schema | 上下文溢出、关系覆盖不足 | Schema适配性、稀疏检查结果、字段覆盖率 |
| 大型模板且有明确分段或嵌套实体组 | 阶段边界可能丢失跨阶段链接 | 阶段输出、根合并规则、关系计数 |
| 复杂/高基数图谱、源数据排序混乱或增量 enrichment | 解析器质量和稳定ID决定正确性 | ID策略、解析器配置、重复实体检查 |
BaseModelField(..., description=...)model_config = ConfigDict(json_schema_extra={"graph_id_fields": [...]})edge()dictAnyBaseModelField(..., description=...)model_config = ConfigDict(json_schema_extra={"graph_id_fields": [...]})edge()dictAnydocling-graph convert SOURCE_PATH \
--template TEMPLATE_MODULE:RootModel \
--output-dir OUTPUT_DIR \
--provider PROVIDER \
--model MODEL \
--extraction-contract direct \
--schema-enforced-llm \
--structured-sparse-check \
--llm-streaming \
--show-llm-configOUTPUT_DIR/graph.jsonOUTPUT_DIR/debug/trace_data.jsondocling-graph inspect OUTPUT_DIRdocling-graph convert SOURCE_PATH \
--template TEMPLATE_MODULE:RootModel \
--output-dir OUTPUT_DIR \
--provider PROVIDER \
--model MODEL \
--extraction-contract direct \
--schema-enforced-llm \
--structured-sparse-check \
--llm-streaming \
--show-llm-configOUTPUT_DIR/graph.jsonOUTPUT_DIR/debug/trace_data.jsondocling-graph inspect OUTPUT_DIRfrom pathlib import Path
from docling_graph import run_pipeline
from docling_graph.pipeline import PipelineConfig
from templates.sec import FilingGraph
config = PipelineConfig(
source=Path("filing.pdf"),
output_dir=Path("out/filing"),
template=FilingGraph,
provider_override="openai",
model_override="gpt-4.1-mini",
extraction_contract="staged",
structured_output=True,
structured_sparse_check=True,
llm_streaming=True,
gleaning_enabled=True,
gleaning_max_passes=2,
dump_to_disk=True,
debug=True,
)
context = run_pipeline(config)from pathlib import Path
from docling_graph import run_pipeline
from docling_graph.pipeline import PipelineConfig
from templates.sec import FilingGraph
config = PipelineConfig(
source=Path("filing.pdf"),
output_dir=Path("out/filing"),
template=FilingGraph,
provider_override="openai",
model_override="gpt-4.1-mini",
extraction_contract="staged",
structured_output=True,
structured_sparse_check=True,
llm_streaming=True,
gleaning_enabled=True,
gleaning_max_passes=2,
dump_to_disk=True,
debug=True,
)
context = run_pipeline(config)docling-graph inspect OUTPUT_DIRdebug/trace_data.jsondocling-graph inspect OUTPUT_DIRdebug/trace_data.jsondocling-graphdebug/trace_data.jsondocling-graphdebug/trace_data.jsonuv run python skills/docling-graph/scripts/check-env.py --provider openai --format json
uv run python skills/docling-graph/scripts/lint-template.py path/to/template.py --root FilingGraph --format jsondocling-graphuv run python skills/docling-graph/scripts/check-env.py --provider openai --format json
uv run python skills/docling-graph/scripts/lint-template.py path/to/template.py --root FilingGraph --format jsondocling-graph| Reference file | Load when |
|---|---|
| Creating or reviewing Pydantic graph templates, stable IDs, relationship fields, staged/delta modeling |
| Choosing contracts, provider/model overrides, structured output, gleaning, streaming, debug dumping |
| Writing CLI/API run patterns, inspect workflows, or batch manifests |
| Planning JSON/CSV/Cypher/NetworkX exports and graph integrity checks |
| Debugging traces, inspect reports, failed graph mapping, or artifact handoffs |
| 参考文件 | 加载场景 |
|---|---|
| 创建或评审Pydantic图谱模板、稳定ID、关系字段、staged/delta建模 |
| 选择契约、提供者/模型覆盖、结构化输出、信息收集、流处理、调试转储 |
| 编写CLI/API运行模式、检查工作流或批量清单 |
| 规划JSON/CSV/Cypher/NetworkX导出及图谱完整性检查 |
| 调试追踪数据、检查报告、图谱映射失败或产物交接 |
| Canonical term | Meaning |
|---|---|
| One-pass extraction from source evidence into the root graph schema |
| Decomposed extraction into stage outputs that are merged into the root graph |
| Observation-first extraction plus entity/relationship resolution into the graph |
| Provider-supported schema enforcement or equivalent constrained generation |
| Validation pass that identifies missing or underfilled schema fields |
| Bounded follow-up passes that improve recall for entities and relationships |
| Human-readable review surface created from an output directory |
| Debug artifacts such as |
| 标准术语 | 含义 |
|---|---|
| 从源证据一次性提取到根图谱schema的契约 |
| 分解为阶段输出后合并到根图谱的提取契约 |
| 先观测提取再解析实体/关系到图谱的契约 |
| 提供者支持的schema校验或等效约束生成 |
| 识别缺失或填充不足schema字段的验证步骤 |
| 提升实体和关系召回率的有限后续处理次数 |
| 从输出目录生成的人类可读评审界面 |
| 连接源数据、提取、映射及图谱输出的调试产物(如 |
| Scope | Strategy |
|---|---|
| Small | Validate one representative document with debug dumping and inspect output |
| Medium | Add a manifest, idempotent outputs, retries, and sampled QA |
| Large | Use batch execution with aggregate metrics, trace retention policy, and staged promotion |
| 100+ files | Parallelize by manifest shard only after the single-document invariant suite passes |
| 规模 | 策略 |
|---|---|
| 小型 | 使用调试转储和检查输出验证一个代表性文档 |
| 中型 | 添加清单、幂等输出、重试及抽样QA |
| 大型 | 使用批量执行并结合聚合指标、追踪保留策略和阶段式推广 |
| 100+文件 | 仅在单文档不变量套件通过后,按清单分片并行处理 |
python scripts/check.py
python -m py_compile scripts/check-env.py scripts/lint-template.py
pytest -q tests/test_docling_graph_skill.py
git diff --checkscripts/check.pygit diff --checkdocs-stewardpython scripts/check.py
python -m py_compile scripts/check-env.py scripts/lint-template.py
pytest -q tests/test_docling_graph_skill.py
git diff --checkscripts/check.pygit diff --checkdocs-steward