AGENT SKILL

chunking

Configure and validate Unstructured post-partition chunking for RAG, embedding, and downstream processing. Use when an agent needs chunk_elements(), chunk_by_title(), partition-integrated chunking kwargs, character/token limits, overlap, table chunking behavior, or orig_elements metadata decisions.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
chunking
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Configure and validate Unstructured post-partition chunking for RAG, embedding, and downstream processing. Use when an agent needs chunk_elements(), chunk_by_title(), partition-integrated chunking kwargs, character/token limits, overlap, table chunking behavior, or orig_elements metadata decisions.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

Chunking

Use this sub-skill after a document has been partitioned into Unstructured elements, or when a partition call should return chunks directly via chunking_strategy.

Start Here

  1. Choose the entry point:
    • Use unstructured.chunking.basic.chunk_elements(elements, ...) when you already have elements and want sequential size-based chunks.
    • Use unstructured.chunking.title.chunk_by_title(elements, ...) when Title elements should start sections and optional page boundaries should split sections.
    • Use partition(..., chunking_strategy="basic" | "by_title", ...) when the partitioner supports integrated chunking and you want one call.
  2. Pick one sizing mode:
    • Character mode: max_characters is the hard maximum, new_after_n_chars is the soft preferred boundary.
    • Token mode: max_tokens is the hard maximum, new_after_n_tokens is the soft preferred boundary, and tokenizer is required.
  3. Decide table handling before overlap:
    • Default isolate_table=True keeps Table and TableChunk separate from surrounding text.
    • Default repeat_table_headers=True repeats detected headers on continuation table chunks.
    • Use skip_table_chunking=True only when oversized tables must pass through unchanged.
  4. Decide metadata weight:
    • Default include_orig_elements=True preserves original elements in metadata.orig_elements.
    • Set include_orig_elements=False for lighter JSON payloads when original metadata is not needed.

Key References

  • references/api-reference.md: public functions, parameters, defaults, output element types, and validation rules.
  • references/workflows.md: RAG, table-heavy, integrated partitioning, token-based, and validation workflows.
  • references/troubleshooting.md: common ValueErrors, token extra issues, overlap pollution, table edge cases, and metadata size trade-offs.
  • scripts/chunk_elements_preview.py: preview chunking behavior from element JSON and summarize chunk types, lengths, table metadata, and orig_elements counts.

Routing Boundaries

  • Route element creation, file parsing, strategies like OCR/table extraction, and partition signatures to the partitioning sub-skill.
  • Route JSON schema interpretation, elements_to_json(), elements_from_json(), and serialized metadata payload design to the elements-and-metadata sub-skill.
  • Keep this sub-skill focused on chunking already-created elements or partition-integrated chunking arguments.

Quick Patterns

from unstructured.chunking.title import chunk_by_title

chunks = chunk_by_title(
    elements,
    max_characters=1200,
    new_after_n_chars=900,
    overlap=80,
    overlap_all=False,
    include_orig_elements=False,
)
from unstructured.partition.auto import partition

chunks = partition(
    filename="report.pdf",
    chunking_strategy="by_title",
    max_characters=1500,
    new_after_n_chars=1000,
    combine_text_under_n_chars=200,
    multipage_sections=False,
)

Review Checklist

  • Confirm the request uses one sizing mode, not both character and token limits.
  • Explain hard maximum versus soft maximum when recommending values.
  • State whether tables remain isolated, split into TableChunk, or pass through unchanged.
  • State whether metadata.orig_elements is retained and how that affects serialized size.
  • Warn before using overlap_all=True, because it can duplicate text across semantic chunk boundaries.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351