Skip to main content
The split.run() method divides documents into sections based on descriptions you provide. You define what sections to look for, and Split identifies which pages belong to each section.

Basic Usage


Method Signature

Parameters


Split Description

The split_description parameter is required. Each entry defines a section to find:

With Partition Key

Use partition_key when a section type repeats multiple times and you want to group by a specific identifier:
The partition_key is a string describing what identifier to look for (e.g., “account number”, “patient ID”, “invoice number”). Split will find all instances of that section and group them by the identifier value it finds in the document.

Split Rules

The split_rules parameter is a natural language prompt that controls how pages are classified. The default rule allows pages to belong to multiple sections only at boundaries:

Parsing Configuration

Configure how the document is parsed before splitting:

Response Structure

Split Object

Each split contains:
  • name (str): The section name you defined
  • pages (list[int]): Page numbers belonging to this section (1-indexed)
  • conf (str): Confidence level ("high" or "low")
  • partitions (list | None): When using partition_key, contains sub-sections with their own name, pages, and conf

Error Handling


Complete Example


Chaining with Extract

A common pattern is to split a document then extract different schemas from each section:

Best Practices

Write Clear Descriptions

Detailed section descriptions improve classification accuracy.

Use Partition Keys

Use partition_key with a string identifier when sections repeat multiple times.

Next Steps