Skip to main content

Overview

Segment processing controls the post-processing, formatting, and generation of content for each segment type detected in your documents. You can configure output formats (HTML or Markdown), generation strategies (Auto or LLM), image cropping, and custom LLM prompts.

Segment Types

Chunkr detects and processes these segment types:
  • Title - Document titles
  • SectionHeader - Section and subsection headers
  • Text - Regular paragraph text
  • ListItem - List items (bulleted or numbered)
  • Table - Tables and tabular data
  • Picture - Images, charts, diagrams
  • Caption - Image and table captions
  • Formula - Mathematical formulas and equations
  • Footnote - Footnotes and references
  • PageHeader - Page headers
  • PageFooter - Page footers
  • Page - Full page content (when using Page segmentation strategy)

Configuration Parameters

Each segment type can be configured with these parameters:
enum
default:"Markdown"
Output format for the segment:
  • Html - HTML formatted content
  • Markdown - Markdown formatted content
For tables, default is Html.
enum
default:"Auto"
Content generation strategy:
  • Auto - Use heuristics and rules (fast, no LLM cost)
  • LLM - Use Chunkr fine-tuned models (higher quality, requires LLM)
For Table, Formula, and Page segments, default is LLM.
enum
default:"Auto"
Image cropping behavior:
  • Auto - Crop only when needed for post-processing
  • All - Always crop to segment bounding box
  • None - Never crop
Cropped images are stored in the segment’s image field.
string
Custom prompt for LLM-based generation. Use this to provide specific instructions for how the segment should be processed.
array
default:["Content"]
Which content sources to include in the chunk’s embed field:
  • Content - The primary content (uses format setting)
  • LLM - LLM-generated content
  • HTML - (deprecated) HTML content
  • Markdown - (deprecated) Markdown content
The order determines the sequence in the embed field.
boolean
default:false
Whether to provide the full page image as context for LLM generation. Useful for segments that need broader context.

Basic Examples

Default Configuration

HTML Output

LLM-Based Generation

Segment-Specific Configuration

Tables default to HTML format with LLM generation for best quality:
Options:
  • Html format preserves table structure better
  • Markdown format for simpler tables
  • Auto strategy for basic tables (faster, no LLM cost)
  • LLM strategy for complex tables with merged cells, etc.

Advanced Features

Custom LLM Prompts

Provide specific instructions for how segments should be processed:

Embedding Configuration

Control what content is included in chunk embeddings:
Use the primary content based on the format setting.

Extended Context

Provide full page context for better LLM understanding:
Use cases:
  • Tables that reference surrounding content
  • Formulas with context-dependent notation
  • Images that need page layout understanding
Trade-off: Increases LLM token usage and processing time.

Complete Configuration Example

Output Fields

Each processed segment includes these fields:
The content field contains the formatted output based on your format setting. The deprecated html and markdown fields are still available for backwards compatibility.

Best Practices

  1. Use Auto strategy for simple segments
    • Faster processing
    • No LLM costs
    • Good for text, headers, lists
  2. Use LLM strategy for complex segments
    • Tables with complex structure
    • Mathematical formulas
    • Images requiring description
  3. Match format to your use case
    • Html for tables and structured content
    • Markdown for general text and readability
  4. Configure embed_sources carefully
    • Include only necessary sources
    • Reduces token usage for embeddings
    • Improves retrieval relevance
  5. Use extended_context sparingly
    • Higher LLM costs
    • Longer processing time
    • Only when context is critical
  6. Test custom prompts
    • Start with default prompts
    • Iterate based on output quality
    • Be specific in instructions

Deprecated Fields

The html and markdown fields in configuration are deprecated. Use format and strategy instead:Old (Deprecated):
New (Recommended):