技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
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.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.
unstructured.chunking.basic.chunk_elements(elements, ...) when you already have elements and want sequential size-based chunks.unstructured.chunking.title.chunk_by_title(elements, ...) when Title elements should start sections and optional page boundaries should split sections.partition(..., chunking_strategy="basic" | "by_title", ...) when the partitioner supports integrated chunking and you want one call.max_characters is the hard maximum, new_after_n_chars is the soft preferred boundary.max_tokens is the hard maximum, new_after_n_tokens is the soft preferred boundary, and tokenizer is required.isolate_table=True keeps Table and TableChunk separate from surrounding text.repeat_table_headers=True repeats detected headers on continuation table chunks.skip_table_chunking=True only when oversized tables must pass through unchanged.include_orig_elements=True preserves original elements in metadata.orig_elements.include_orig_elements=False for lighter JSON payloads when original metadata is not needed.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.partitioning sub-skill.elements_to_json(), elements_from_json(), and serialized metadata payload design to the elements-and-metadata sub-skill.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,
)
TableChunk, or pass through unchanged.metadata.orig_elements is retained and how that affects serialized size.overlap_all=True, because it can duplicate text across semantic chunk boundaries.