> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eigenpal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Inspect Pages (Vision)

> Inspect rendered page images with a vision model and return structured JSON matching a schema. The visual counterpart to Extract Data: use it for conclusions that live in the pixels rather than the text (is the document signed? are the photos usable?). Renders PDF, image, or Office/Word inputs; route to specific pages with an ai.split page range to keep it cheap.

`ai.vision`: Inspect rendered page images with a vision model and return structured JSON matching a schema. The visual counterpart to Extract Data: use it for conclusions that live in the pixels rather than the text (is the document signed? are the photos usable?). Renders PDF, image, or Office/Word inputs; route to specific pages with an ai.split page range to keep it cheap.

## Configuration

Configuration goes inside the step's `with:` block.

<ParamField path="document" type="string" required>
  Template expression resolving to the input file (PDF, image, or Office document).
</ParamField>

<ParamField path="pageFrom" type="integer | string">
  First page to inspect (0-based, inclusive). Optional. Accepts a template expression. When omitted, starts from the first page.
</ParamField>

<ParamField path="pageTo" type="integer | string">
  Last page to inspect (0-based, inclusive). Optional. Accepts a template expression. When omitted, runs to the last page. When BOTH pageFrom and pageTo are omitted, the whole document is inspected in chunks of maxPages (divide-and-conquer, results merged).
</ParamField>

<ParamField path="pageIndices" type="array<integer> | string">
  Explicit list of 0-based page indices to inspect, supports NON-contiguous selections, e.g. \[4, 11, 19], or a template resolving to a number\[] such as "\{\{ steps.label\_pages.output.byLabel.photo }}". Highest priority: when set, pageFrom/pageTo and pages are ignored.
</ParamField>

<ParamField path="schema" type="object" required>
  JSON Schema defining the structure the vision model should return.

  <Expandable title="schema properties">
    <ParamField path="type" type="string" required />

    <ParamField path="properties" type="record<string, unknown>" required />

    <ParamField path="required" type="array<string>" />
  </Expandable>
</ParamField>

<ParamField path="prompt" type="string">
  Optional instruction refining the extraction. The schema drives it when omitted.
</ParamField>

<ParamField path="provider" type="string">
  Provider ID (must support vision).
</ParamField>

<ParamField path="model" type="string">
  Model override (must support vision).
</ParamField>

<ParamField path="renderScale" type="number">
  PDF render scale (1.0 = 72 DPI). Raise for small text or weak VLM OCR. Capped at 6 to avoid oversized page rasters.
</ParamField>

<ParamField path="imageQuality" type="integer">
  JPEG quality for rendered pages (default 85).
</ParamField>

<ParamField path="maxPages" type="integer">
  Chunk size: the maximum pages sent to the vision model in a single call. When the inspected range (or the whole document) is larger, it is split into chunks of this size and the per-chunk results are merged by a reduce pass. The reduce follows each field's DESCRIPTION: a boolean described as "present on any page" is OR-ed, one described as "true for every page" is AND-ed, and list fields are concatenated. The merge is most reliable for boolean/scalar claims; for schemas that AGGREGATE long lists across chunks it can still drop or reorder items, so prefer a bounded page range for large list extraction. Default 20, capped at 100.
</ParamField>

## Output

Returns `record<string, unknown>`. Structured data matching the provided schema. The output also carries a reserved `_vision` key recording the inspected source document ref and the page indices that were rendered, so the UI can re-rasterize exactly those pages client-side. `_vision` is excluded from user-schema validation.
