Schema Structure
The schema consists of three main sections:Documents are automatically processed using VLM (Vision Language Model) parsing with per-page chunking for optimal extraction quality across all document types.
Global Configuration
Theconfig section defines default settings that apply to all groups unless overridden.
Configuration Options
Groups
Groups are the primary organizing principle for extractions. Each group contains its own fields and can override template-level configuration.Group-Level Configuration
Each group can have aconfig object with these options:
Group-Level Properties
Properties available directly at the group level (outsideconfig):
Page-by-Page Groups
Useexecution_mode: "per_page" for a repeated table or list that must be
read consistently across a whole document, for example bank-statement
transactions. Raydocs runs the group’s schema and prompt once per page. The
model receives only that page’s parsed chunks, rather than retrieved chunks
from elsewhere in the document.
source.document_id and source.page_number always identify the original
source page; the internal batch ordinal is not exposed. A source page with no
matching items is retained with the schema’s empty value. An inserted blank
page in a composed document view has no source provenance and is skipped.
Page boundaries are best effort: a row split across pages is not reconstructed
in this mode.
per_page cannot be combined with iterates_on. A page-by-page group may
depend on a normal group, but normal groups and other page-by-page groups
cannot depend on a page-by-page group’s list result.
Definitions
Thedefinitions section contains reusable schema components:
$ref:
Dependencies and Parallel Processing
Dependencies between groups are automatically computed based on:- Field references using mentions (
@{group.field}) - Iteration dependencies (
iterates_on) - Page-by-page group dependencies (
execution_mode: "per_page"may depend on a normal group)
Field References (Mentions)
Fields can reference values from other groups:Iteration
Groups can iterate over arrays usingiterates_on:
Reasoning Mode
When enabled, reasoning mode enhances extraction quality by wrapping fields with metadata that records reasoning and sources.Enabling Reasoning Mode
Field Structure in Reasoning Mode
Eligible fields are wrapped with metadata:Atomic Fields
Theatomic flag controls how fields are wrapped when reasoning mode is enabled.
Default Atomicity Rules
Simple fields (string, number, boolean)
Simple fields (string, number, boolean)
Wrapped by default unless
atomic: falseComplex objects
Complex objects
Not wrapped by default unless
atomic: true, but their simple fields are wrappedArrays
Arrays
Not wrapped by default unless
atomic: true, but their simple items are wrappedReferences ($ref)
References ($ref)
Follow the atomicity rule of their target types, unless overridden with
atomic flagExamples
- Simple Fields
- Objects
- Arrays
When to Use Atomicity Flags
Use atomic: true when
- Treating a complex object or array as a single unit
- Needing reasoning about the entire structure
- The field represents a cohesive concept
Use atomic: false when
- You don’t need reasoning metadata for a specific field
- Optimizing output size
- The field value is straightforward
Writing Effective Search Queries
Thesearch_query property is used by RAG to find relevant document chunks. Writing effective queries is critical for extraction quality.
Best Practices
1
Use Concise Noun Phrases
Avoid imperative verbs like “Find”, “Get”, “Extract” and question phrasing.
2
Remove Stopwords
Words like “the”, “in”, “for”, “of” have negligible embedding value.
3
Add Domain Keywords
Include domain-specific terms for disambiguation.
4
Keep Queries Short (3-10 words)
Anything longer becomes noisy. Anything shorter lacks discriminative power.
Quick Reference
Complex Schema Best Practices
When working with nested objects, arrays, or multiple$ref definitions:
