Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

grounded-rag-ingestion

БесплатноЗапускает вложенные скриптыНе проверен

Chunk a document into provenance-carrying JSONL ready for embedding via the Nutrient Data Extraction API (`/extraction/parse`, spatial output). Every chunk…

PSPDFKit-labsот PSPDFKit-labs★ 18 звёзд на GitHub

Об этом скилле

Grounded RAG Ingestion

Turn a document into a stream of provenance-carrying chunks — one JSONL line per chunk, each tagged with its element type, page index, bounding box, confidence score, and reading-order index, all traceable back to a specific region of the source page.

The differentiator is provenance, a capability frontier-LLM Markdown extraction structurally cannot supply: a downstream system can highlight the exact region of the source document a retrieval result came from. That is the compliance-grade requirement for RAG in finance, healthcare, and legal workflows where "the model said so" is not an acceptable citation. This skill does not relitigate raw Markdown quality (see the pdf-to-markdown skill for that) — it adds the provenance layer on top of Nutrient extraction.

This is a doer skill: a bundled uv-runnable Python script (chunk.py) drives the pipeline end to end and emits JSONL to stdout or a file. It is embedding-agnostic — it stops at the chunk boundary. No vector DB client, no embedding provider import.

When to use

  • Grounded / cited RAG: retrieval results include page_index and bbox so the UI can draw a highlight box on the source document.
  • Confidence-aware ingestion: gate on confidence >= threshold to suppress low-confidence chunks before they reach the index.
  • Reading-order-aware chunking: preserve reading_order so sliding-window chunking respects the document's logical sequence.
  • Auditable pipelines: regulated workflows that must prove which page region a retrieved answer came from — the bbox + page_index tuple is the audit trail.

Not for cheap whole-document Markdown — that stays in document-extraction-api with --output-format markdown. Not for known target fields — if the request names specific fields ("the invoice number and total", "extract these fields", "map to my schema", "return these fields cited"), use document-extraction-api's extract (one call returns your schema's fields, each cited) instead of chunking the whole document for open-ended retrieval. Reach for this skill when retrieval is open-ended (semantic search over the whole document), not when the target fields are already known. Not for vector-store upsert or embedding generation — this skill stops at the chunk JSONL.

Dependency: document-extraction-api

This skill calls document-extraction-api under the hood. Read that skill first for mode selection, key setup, and credit-cost guidance. chunk.py reuses its create_client() helper and client.parse(..., output_format="spatial") call — it does not re-implement the API call.

The extraction skill must be present in the same plugin at ../document-extraction-api/scripts/. If it lives elsewhere, set PARSE_SCRIPT_PATH to its scripts/ directory; chunk.py fails fast with a clear message if it cannot find it.

Setup

DWS Extract is a separate product from DWS Processor and has its own API key.

  • Get a Nutrient DWS Extract API key at https://dashboard.nutrient.io/.
  • Export it as NUTRIENT_EXTRACT_API_KEY:
    export NUTRIENT_EXTRACT_API_KEY="pdf_live_..."
    
  • Run from the directory containing this SKILL.md:
    cd <directory containing this SKILL.md> && uv run scripts/chunk.py --help
    

If your tenant has migrated to global DWS API keys, a single key set as either NUTRIENT_EXTRACT_API_KEY or NUTRIENT_API_KEY works for both products.

Mode selection

Mode selection for this skill follows the same rules as document-extraction-api (mode → cost → when to use). Pass --mode through to the parse call; the default is structure.

Mode Cost (cr/pg) When
text 1 Cheapest; incompatible with spatial — not usable here (this skill requires spatial)
structure 1.5 Default. OCR + spatial typed elements with bounds and tables
understand 9 AI layout: required for keyValueRegion and formula elements
agentic 18 VLM: adds altDescription on pictures

Mode-gating — important. keyValueRegion and formula elements are only populated by understand mode or higher. Under the default structure mode the key-value and formula chunk paths produce nothing. chunk.py warns on stderr when KV/formula content would be expected but the mode is too low. To exercise key-value chunking, pass --mode understand.

Invocation

uv run scripts/chunk.py --input doc.pdf --out chunks.jsonl \
  [--doc-id ID] [--mode structure] \
  [--strategy element|reading-order-window|table-row] [--window-size 512] \
  [--min-confidence 0.0] [--skip-pictures] [--yes]
  • --out - writes JSONL to stdout; otherwise to the named file (created with 0600 permissions — the JSONL carries extracted document text).
  • Credit usage is printed to stderr after the parse call.

Provenance chunk schema

Each JSONL line is one chunk:

| Field | Type | S

Полный SKILL.md на GitHub

Установить grounded-rag-ingestion в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.gitignoreexamples/embed-chunks-illustrative.pyreferences/provenance-chunk-schema.mdscripts/chunk.pyscripts/test_chunk.py

FAQ

Что делает скилл grounded-rag-ingestion?

Chunk a document into provenance-carrying JSONL ready for embedding via the Nutrient Data Extraction API (`/extraction/parse`, spatial output). Every chunk carries element type, page index, bounding box, confidence, and reading order, traceable to a specific page region. Use for grounded or auditable RAG, cited retrieval, confidence-aware ingestion, or any pipeline that must prove which document region a retrieved answer came from. Triggers include grounded RAG, auditable RAG, RAG with provenance, chunk with bounding box, cite page, provenance-carrying chunks, confidence-aware chunking, or embedding pipeline. Not for cheap Markdown — use document-extraction-api with `--output-format markdown` for that. Not for known target fields — if the user wants specific fields ("invoice number and total", "map to my schema", "return these fields cited"), use document-extraction-api's `extract` (one cited call), not whole-document chunking.

Как установить скилл grounded-rag-ingestion?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл grounded-rag-ingestion запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить grounded-rag-ingestion с