{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://docs.xberg.io/schemas/preset.schema.json",
"title": "Xberg structured-extraction preset",
"description": "Meta-schema every preset file under crates/presets/library/ must satisfy. Defines the canonical preset format consumed by structured-extraction catalogs.",
"type": "object",
"additionalProperties": false,
"required": [
"id",
"version",
"schema_name",
"description",
"category",
"schema",
"system_prompt",
"merge_mode",
"preferred_call_mode",
"emit_citations"
],
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$",
"minLength": 2,
"maxLength": 64,
"description": "Stable, URL-safe preset identifier. Lowercase snake_case."
},
"version": {
"type": "string",
"pattern": "^v[0-9]+$",
"description": "Preset version, monotonically increased on breaking changes."
},
"schema_name": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"description": "Human-readable schema name (used as the LLM tool/response name)."
},
"description": {
"type": "string",
"minLength": 1,
"maxLength": 1024
},
"category": {
"type": "string",
"enum": [
"finance",
"identity",
"legal",
"logistics",
"medical",
"hr",
"other"
]
},
"tags": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z][a-z0-9_-]*$",
"maxLength": 64
},
"maxItems": 16,
"uniqueItems": true
},
"schema": {
"type": "object",
"description": "JSON Schema (draft 2020-12) describing the structured output shape.",
"required": [
"type",
"properties"
],
"properties": {
"type": {
"const": "object"
},
"properties": {
"type": "object",
"minProperties": 1
}
}
},
"system_prompt": {
"type": "string",
"minLength": 10,
"maxLength": 8192,
"description": "Instruction primer sent to the vision/text model."
},
"context_template": {
"type": "string",
"maxLength": 4096,
"description": "Mustache-style template merged with caller-supplied context map."
},
"merge_mode": {
"type": "string",
"enum": [
"object_merge",
"array_concat",
"object_first"
],
"description": "Strategy for merging per-batch model outputs across paginated calls."
},
"preferred_call_mode": {
"type": "string",
"enum": [
"text_only",
"vision_only",
"text_plus_vision"
],
"description": "Default call mode suggested for this preset; heuristics may override."
},
"emit_citations": {
"type": "boolean",
"description": "When true, prompt asks the model to wrap each field as {value, page, bbox, confidence}."
},
"sample": {
"type": "object",
"additionalProperties": false,
"required": [
"input_path",
"output_path"
],
"properties": {
"input_path": {
"type": "string",
"minLength": 1
},
"output_path": {
"type": "string",
"minLength": 1
}
}
}
}
}