documents.split finds logical documents inside one file. PDFs and other
page-based sources become ordered page-range segments. Workbooks become one
segment per worksheet, classified against the classes you provide.
Basic usage
Method signature
Parameters
Returns
APromise<Job>. After success, result.result_type === "split" and
result.segments is the ordered cut list.
Define classes
Each class needs a stableid and display label. A description is optional
but strongly recommended: it is the main signal that distinguishes a class from
nearby classes:
id is what appears
in result joins; keep it stable if you revise display text.
Subclasses
Add subclasses for finer segment labels:segment.split_class
(class in the JSON): its id is "invoice/utility", with
parent_id: "invoice" and subcategory_id: "utility". PDFs and other documents
ignore subclasses and return the parent class only.
Control unmatched content
unknown_policy determines what happens to content the classifier does not
assign to any class:
For PDFs and other documents, every page the model reads gets the closest class,
so a single unrelated class still matches. Workbook tabs and JSON sections can
come back
unclassified when nothing fits.
A confirmed blank range in a page document comes back unclassified with a
blank_page warning under "include" and "error", and never fails "error".
An unconfirmed blank the fast DREX lane serves under "include" stays a plain
unclassified range.
See Blank pages.
"include" when completeness matters. Use "force" only when every page
must belong to one of a closed set of classes.
Page selection and parse mode
"medium" or
"high" only when the default parse is not sufficient; higher modes add
latency.
Split rules
Usesplit_rules for a boundary convention the class descriptions do not
express:
overlap_policy: "shared_boundary_page" when the page at a detected
boundary belongs to both neighboring documents. The default "exclusive"
policy keeps every source page in only one segment.
Include content or files
.xlsx artifact.
Response structure
start_page and end_page. Spreadsheet segments use
sheet_name; their page values correspond to the worksheet’s one-based
position. JSON sources may use json_pointer.
classification_confidence and boundary_confidence contain a readable band
and an optional score. "unavailable" means no score was produced, not zero
confidence.
Reuse a parse
Complete example
Error handling
unknown_policy: "error" when content is
unclassified.
Best practices
Define distinct classes
Give each class a stable ID and a description that separates it from adjacent classes.
Keep unknowns visible
Start with
unknown_policy: "include" so workbook tabs and JSON sections that fit no class are not silently forced.Add rules for boundaries
Use
split_rules for continuation pages or identifier changes, not to replace class descriptions.Materialize only when needed
Request files when downstream systems need individual documents; use inline content for inspection.