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
- 参考文档references/api-reference.md5.7 KB
- 参考文档references/troubleshooting.md5.0 KB
- 参考文档references/workflows.md5.3 KB
- 脚本scripts/chunk_elements_preview.py6.2 KB
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
- 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, ...)whenTitleelements 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.
- Use
- Pick one sizing mode:
- Character mode:
max_charactersis the hard maximum,new_after_n_charsis the soft preferred boundary. - Token mode:
max_tokensis the hard maximum,new_after_n_tokensis the soft preferred boundary, andtokenizeris required.
- Character mode:
- Decide table handling before overlap:
- Default
isolate_table=TruekeepsTableandTableChunkseparate from surrounding text. - Default
repeat_table_headers=Truerepeats detected headers on continuation table chunks. - Use
skip_table_chunking=Trueonly when oversized tables must pass through unchanged.
- Default
- Decide metadata weight:
- Default
include_orig_elements=Truepreserves original elements inmetadata.orig_elements. - Set
include_orig_elements=Falsefor lighter JSON payloads when original metadata is not needed.
- Default
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: commonValueErrors, 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, andorig_elementscounts.
Routing Boundaries
- Route element creation, file parsing, strategies like OCR/table extraction, and partition signatures to the
partitioningsub-skill. - Route JSON schema interpretation,
elements_to_json(),elements_from_json(), and serialized metadata payload design to theelements-and-metadatasub-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_elementsis retained and how that affects serialized size. - Warn before using
overlap_all=True, because it can duplicate text across semantic chunk boundaries.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).