Structured Multi-Pass Extraction
Extrae de un documento un conjunto declarado de campos y, para CADA campo, devuelve el valor, la confianza autoevaluada y la procedencia textual, con validación de esquema y reintentos.
Extrae con el modelo un conjunto declarado de campos de un documento y devuelve por campo el valor, la confianza autoevaluada y una cita de procedencia; valida tipos, campos obligatorios y valores permitidos, y reintenta con un mensaje de corrección.
Está pensado para pipelines de extracción en varias pasadas, en los que un documento extenso se divide en pasadas focalizadas (p. ej., identificación, marco procesal, cronología, actores, beneficiarios, fechas). Cada nodo ejecuta UNA pasada con su propio field_schema y sus system_instructions de dominio (la doctrina y las reglas de señales fuertes viven en el prompt, no en un nodo RAG).
A diferencia de la extracción de entidades básica, este worker produce telemetría por CAMPO, apta para la revisión humana y para compuertas por confianza:
value: el valor extraído (null cuando el documento no lo menciona).
confidence: la certeza autoevaluada del modelo, en [0, 1].
provenance: { pass, source }: qué pasada lo produjo y un fragmento literal breve o una referencia a la sección donde se encontró.
Tras la extracción, el worker valida el resultado frente al esquema de campos declarado (campos obligatorios presentes, tipos básicos, pertenencia a los enums). Si la validación falla y quedan reintentos, vuelve a invocar al modelo con un mensaje de corrección. También calcula la confianza general y lista los campos por debajo del umbral configurado, y enruta al puerto low_confidence para que una compuerta posterior (p. ej., hitl.approval.gate) pueda solicitar una revisión humana.
Es neutral respecto del dominio: contrólalo por completo con field_schema + system_instructions, o toma esos valores de una PromptTemplate reutilizable mediante prompt_template_id.
Cómo funciona
- Combina el payload anterior con la configuración del nodo (gana la configuración).
text(oinput) debe ser un texto no vacío yfield_schemadebe tener al menos un elemento conname; si no, devuelveerror. - Arma las instrucciones a partir de
system_instructions; conprompt_template_id, elsystem_instructions(otemplate_body) de la plantilla se coloca antes. Una plantilla inexistente solo se registra en el log. - Envía un prompt de sistema que lista cada campo con tipo, obligatoriedad,
strong_signals,do_not_confuse_withy valores permitidos, y pide{ fields: { <name>: { value, confidence, provenance } } }. El mensaje de usuario es# DOCUMENT+text, precedido de hasta 8000 caracteres delcontextJSON de pasadas anteriores;temperature: 0. - Normaliza cada campo declarado: confianza limitada a 0–1, procedencia recortada a 200 caracteres como
{ pass, source }. Un valor suelto recibe confianza 0,5 (0 si es null); un campo ausente pasa anullcon confianza 0. Las claves no declaradas se descartan. - Valida campos obligatorios, tipos (
number,boolean,array,object;stringydatesiempre pasan) yenum. Ante JSON inválido o errores de validación vuelve a llamar al modelo con los errores como mensaje de corrección, hastamax_retriesveces más (por defecto 1). - Promedia la confianza de los campos en
overall_confidence, lista los campos bajoconfidence_thresholdy sale porlow_confidencesi la validación falló o algún campo está bajo el umbral; si no, porextracted.
En un workflow
El nodo tal como aparece en un archivo de workflow (draft_nodes[]) y el envelope de una ejecución exitosa.
{
"node_id": "node-extract-ruling",
"label": "Extract ruling data",
"operator_slug": "ai.legal.extract.structured-multi-pass",
"operator_version": "1.0.0",
"config": {
"text": "{{ $json.text }}",
"pass_label": "identification",
"field_schema": [
{
"name": "case_number",
"type": "string",
"required": true,
"description": "Case reference number.",
"strong_signals": "Case No., file number"
},
{
"name": "ruling_date",
"type": "date",
"required": true,
"description": "Date the ruling was issued."
},
{
"name": "awarded_amount",
"type": "number",
"description": "Total amount ordered to be paid.",
"do_not_confuse_with": "amounts claimed by the parties"
}
],
"system_instructions": "Read amounts as plain numbers without thousands separators.",
"confidence_threshold": 0.7,
"max_retries": 1,
"language": "en",
"llm_provider_id": "wf-llm-provider-xxxx",
"invocation_mode": "stream",
"timeout_ms": 120000
}
}{
"ok": true,
"data": {
"fields": {
"case_number": {
"value": "2025-00418",
"confidence": 0.96,
"provenance": {
"pass": "identification",
"source": "Case No. 2025-00418"
}
},
"ruling_date": {
"value": "2026-03-14",
"confidence": 0.9,
"provenance": {
"pass": "identification",
"source": "Issued on 14 March 2026"
}
},
"awarded_amount": {
"value": 18500,
"confidence": 0.82,
"provenance": {
"pass": "identification",
"source": "orders payment of 18,500"
}
}
},
"pass_label": "identification",
"overall_confidence": 0.8933333333333332,
"low_confidence_fields": [],
"validation": {
"valid": true,
"errors": []
},
"field_count": 3
},
"port": "extracted"
}Configuración
-
llm_provider_idstring Obligatorio -
El `id` de un registro `LlmProviderModel` (p. ej. `wf-llm-provider-*`). El orquestador delega en el backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` en modo sync, o el endpoint de stream SSE en modo stream. Para documentos jurídicos complejos, usa un modelo de razonamiento de alta calidad.
-
invocation_modestring Opcional -
Transporte de la llamada al LLM. `sync` se bloquea hasta recibir la respuesta completa. `stream` consume los tokens mediante SSE (recomendado para documentos largos en los que una pasada puede durar más de 30 s). Predeterminado: `sync`.
-
timeout_msinteger Opcional -
Tiempo máximo de espera de cada llamada al LLM (incluidos los reintentos). Predeterminado: 30000 en sync, 600000 en stream.
-
pass_labelstring Opcional -
Identificador legible de esta pasada de extracción (p. ej. `identification`, `procedural-timeline`). Se registra en la procedencia de cada campo para que los nodos posteriores de combinación o puntuación sepan qué pasada produjo cada valor.
-
field_schemaarray<object> Obligatorio -
Los campos que debe extraer esta pasada. Cada elemento declara un campo. Es el contrato que se le indica al LLM que complete y contra el que se valida el resultado.
-
system_instructionsstring Opcional -
Doctrina y reglas de dominio para esta pasada (taxonomías, reglas de régimen, pautas de detección). Se insertan literalmente en el prompt de sistema. Aquí vive el conocimiento de extracción, en lugar de en un nodo RAG.
-
prompt_template_idstring Opcional -
`CognitiveInfrastructurePromptTemplateModel.id` opcional. Si se indica, sus `system_instructions` se anteponen a las `system_instructions` en línea. No es fatal: si la plantilla no se puede resolver, se usan las instrucciones en línea.
-
confidence_thresholdnumber Opcional -
Los campos con una confianza autoevaluada inferior a este valor se marcan y la salida se dirige a `low_confidence`.
-
max_retriesnumber Opcional -
Cuántas veces se vuelve a invocar al modelo con un mensaje de corrección cuando falla la validación del esquema o el JSON no se puede interpretar.
-
languagestring Opcional -
Idioma del documento y de la respuesta.
Su configuración muestra los ajustes de ejecución compartidos, pero este nodo aún no aplica reintentos (retryOnFail, maxTries). Ningún nodo aplica continueOnFail.
Comportamiento en el código
Lo que hace la implementación con estas claves más allá de lo que dice el esquema.
-
field_schema - Cada elemento:
name(obligatorio),type(por defectostring),description,required(solo cuentatrue),strong_signals,do_not_confuse_with,enum.enumse compara con igualdad estricta. -
max_retries - Intentos adicionales tras el primero (por defecto 1, es decir hasta 2 llamadas al modelo). Cada reintento reenvía el documento solo con la última corrección, no con la respuesta anterior.
-
prompt_template_id - Se obtiene del backend con timeout de 10 s; si no existe o la carga falla, solo se usa
system_instructions. -
text, context - No están en el esquema de configuración, pero se leen primero de la configuración y luego del payload anterior.
contextdebe ser un objeto; se envía como JSON recortado a 8000 caracteres. -
timeout_ms - Se aplica a cada llamada al modelo por separado, y solo en modo stream (timeout de inactividad entre fragmentos).
-
execution - Declarado pero ignorado: ni el worker ni el motor leen
retryOnFail,maxTries,waitBetweenTries,continueOnFail,alwaysOutputDatanitimeout_msde este bloque.
Puertos de salida
extracted por defecto La validación pasó y todos los campos están en o por encima de confidence_threshold.
{
"fields": {
"case_number": {
"value": "2025-00418",
"confidence": 0.96,
"provenance": {
"pass": "identification",
"source": "Case No. 2025-00418"
}
},
"ruling_date": {
"value": "2026-03-14",
"confidence": 0.9,
"provenance": {
"pass": "identification",
"source": "Issued on 14 March 2026"
}
},
"awarded_amount": {
"value": 18500,
"confidence": 0.82,
"provenance": {
"pass": "identification",
"source": "orders payment of 18,500"
}
}
},
"pass_label": "identification",
"overall_confidence": 0.8933333333333332,
"low_confidence_fields": [],
"validation": {
"valid": true,
"errors": []
},
"field_count": 3
}low_confidence Algún campo está bajo el umbral, o la validación siguió fallando tras los reintentos. Se devuelven los últimos campos interpretados para que una persona los complete.
{
"fields": {
"case_number": {
"value": "2025-00418",
"confidence": 0.96,
"provenance": {
"pass": "identification",
"source": "Case No. 2025-00418"
}
},
"ruling_date": {
"value": null,
"confidence": 0,
"provenance": {
"pass": "identification",
"source": null
}
}
},
"pass_label": "identification",
"overall_confidence": 0.48,
"low_confidence_fields": [
"ruling_date"
],
"validation": {
"valid": false,
"errors": [
"Missing required field: ruling_date"
]
},
"field_count": 2
}error No hay texto ni esquema de campos, todos los intentos devolvieron JSON no interpretable, o falló una llamada al modelo.
{
"error": "Extraction produced no usable fields.",
"validation": {
"valid": false,
"errors": [
"LLM did not return parseable JSON"
]
}
}En expresiones
Lo que un nodo posterior puede leer de la salida de este nodo con $("Structured Multi-Pass Extraction").item.json.<ruta> (escribe la etiqueta de tu nodo en lugar de Structured Multi-Pass Extraction). Editor marca las rutas que sugiere el editor de workflows en Previous Nodes (el contrato de salida); Worker marca las rutas que el worker devuelve de verdad por extracted, según la salida que muestra Puertos.
| Expresión | Editor | Worker |
|---|---|---|
$("Structured Multi-Pass Extraction").item.json.fieldsResultado por campo: { value, confidence, provenance: { pass, source } }, con el nombre del campo como clave. | ||
$("Structured Multi-Pass Extraction").item.json.pass_labelLa pasada que produjo estos campos. | ||
$("Structured Multi-Pass Extraction").item.json.overall_confidenceConfianza autoevaluada promedio de los campos declarados. | ||
$("Structured Multi-Pass Extraction").item.json.low_confidence_fieldsNombres de los campos con una confianza inferior al umbral. | ||
$("Structured Multi-Pass Extraction").item.json.validationResultado de la validación del esquema { valid, errors[] }. | ||
$("Structured Multi-Pass Extraction").item.json.field_countNúmero de campos declarados en esta pasada. | ||
$("Structured Multi-Pass Extraction").item.json.fields.case_number | — | |
$("Structured Multi-Pass Extraction").item.json.fields.ruling_date | — | |
$("Structured Multi-Pass Extraction").item.json.fields.awarded_amount | — | |
$("Structured Multi-Pass Extraction").item.json.validation.valid | — | |
$("Structured Multi-Pass Extraction").item.json.validation.errors | — |
— Worker: El worker la devuelve pero el editor no la sugiere: escríbela a mano. Las claves dentro de objetos pueden depender de tus datos o de la configuración (por ejemplo, una clave por etiqueta).
Errores
| Mensaje | Puerto | Causa y solución |
|---|---|---|
Missing 'text' to extract from. | error | text está vacío o no es un texto (aquí no se acepta el objeto del payload anterior como texto). |
No field schema provided. Set 'field_schema' (array of field definitions). | error | field_schema no es un arreglo o no tiene elementos con name. |
Extraction produced no usable fields. | error | Todos los intentos devolvieron texto que no se pudo interpretar como JSON; data.validation trae el último error. |
[LegalExtractStructuredMultipass] Missing 'llm_provider_id' in node config (LlmProviderModel.id, e.g. 'wf-llm-provider-*'). The legacy 'model_id' alias is no longer supported — update the node config to use 'llm_provider_id'. | error | llm_provider_id está vacío o no es un texto. Elige un registro de proveedor LLM con capacidad de chat. |
LLM Invocation Error: <backend message> | error | El backend rechazó la llamada: registro de proveedor inexistente o inactivo, error del proveedor, cuota o filtro de contenido. Revisa el registro de proveedor y los logs del backend. |
LLM Invocation Error: empty response from backend (<transport error>) | error | Modo sync: falló la llamada HTTP al backend (error de red, estado distinto de 2xx o timeout). Los prompts largos suelen agotar el timeout de la petición; cambia a invocation_mode: "stream". |
RemoteApiService.stream: idle timeout after <timeout_ms>ms | error | Modo stream: no llegó ningún fragmento dentro de timeout_ms. Si la petición de stream falla, el mensaje es RemoteApiService.stream: HTTP <status> — <body>. |
Contrato de entrada
-
textstring Obligatorio -
Texto completo del documento (p. ej., de ai.multimodal.extract.text.cascade-pipeline).
-
contextobject Opcional -
Resultados opcionales de pasadas anteriores, que se arrastran como contexto para mejorar la coherencia.
Contrato de salida
-
fieldsobject Opcional -
Resultado por campo: `{ value, confidence, provenance: { pass, source } }`, con el nombre del campo como clave.
-
pass_labelstring Opcional -
La pasada que produjo estos campos.
-
overall_confidencenumber Opcional -
Confianza autoevaluada promedio de los campos declarados.
-
low_confidence_fieldsarray<string> Opcional -
Nombres de los campos con una confianza inferior al umbral.
-
validationobject Opcional -
Resultado de la validación del esquema `{ valid, errors[] }`.
-
field_countnumber Opcional -
Número de campos declarados en esta pasada.
Contratos (JSON Schema)
La definición exactamente como la declara el orquestador. All es el *.definition.js completo; compáralo con las secciones de arriba para ver diferencias entre la documentación y el esquema. Úsala para validar un nodo antes de publicar.
{
"slug": "ai.legal.extract.structured-multi-pass",
"name": "Structured Multi-Pass Extraction",
"category": "ai",
"version": "1.0.0",
"description": "Extract a declared set of fields from a document and, for EVERY field, return value + self-assessed confidence + textual provenance, with schema validation and retry.\n\n Designed for multi-pass extraction pipelines where a long document is split into focused passes (e.g. identification, procedural framework, timeline, actors, beneficiaries, dates). Each node runs ONE pass with its own `field_schema` and domain `system_instructions` (the doctrine/strong-signal rules live in the prompt, not in a RAG node).\n\n Unlike basic entity extraction, this worker produces per-FIELD telemetry suitable for human review and confidence gating:\n\n **value** — the extracted value (null when not stated in the document).\n **confidence** — the model's self-assessed certainty in [0, 1].\n **provenance** — `{ pass, source }`: which pass produced it and a short verbatim snippet/section reference where it was found.\n\n After extraction the worker validates the result against the declared field schema (required fields present, basic types, enum membership). If validation fails and retries remain, it re-invokes the model with a correction message. It also scores overall confidence and lists fields below the configured threshold, routing to the `low_confidence` port so a downstream gate (e.g. `hitl.approval.gate`) can request human review.\n\n Domain-neutral: drive it entirely from `field_schema` + `system_instructions`, or seed those from a reusable PromptTemplate via `prompt_template_id`.",
"capabilities": [
"nlp",
"extraction",
"legal",
"structured",
"confidence",
"provenance",
"multi-pass"
],
"config_schema": {
"type": "object",
"properties": {
"llm_provider_id": {
"type": "string",
"title": "LLM Provider",
"description": "The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or the SSE stream endpoint for stream mode. Use a high-quality reasoning model for complex legal documents.",
"x-ui-widget": "llm-provider-picker",
"x-llm-provider-capabilities": [
"chat"
]
},
"invocation_mode": {
"type": "string",
"title": "Invocation Mode",
"description": "Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (recommended for long documents where a pass may run >30s). Default `sync`.",
"enum": [
"sync",
"stream"
],
"default": "sync"
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Maximum time to wait for each LLM call (including retries). Default 30000 for sync, 600000 for stream.",
"minimum": 1000
},
"pass_label": {
"type": "string",
"title": "Pass Label",
"default": "pass-1",
"description": "Human-readable identifier for this extraction pass (e.g. `identification`, `procedural-timeline`). Stamped into each field's provenance so downstream merge/scoring nodes can tell which pass produced each value."
},
"field_schema": {
"type": "array",
"title": "Field Schema",
"description": "The fields this pass must extract. Each item declares one field. This is the contract the LLM is instructed to fill and the result is validated against.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Field Name",
"description": "Output key for the field."
},
"type": {
"type": "string",
"title": "Type",
"enum": [
"string",
"number",
"boolean",
"array",
"object",
"date"
],
"default": "string",
"description": "Expected value type, used for validation."
},
"description": {
"type": "string",
"title": "Description",
"description": "What this field represents."
},
"required": {
"type": "boolean",
"title": "Required",
"default": false,
"description": "Fail validation if missing."
},
"strong_signals": {
"type": "string",
"title": "Strong Signals",
"description": "Textual cues that indicate where to find this field (embedded in the prompt)."
},
"do_not_confuse_with": {
"type": "string",
"title": "Do Not Confuse With",
"description": "Disambiguation guidance to avoid common extraction mistakes."
},
"enum": {
"type": "array",
"title": "Allowed Values",
"description": "Optional closed set of allowed values, enforced during validation.",
"items": {
"type": "string"
}
}
},
"required": [
"name"
]
}
},
"system_instructions": {
"type": "string",
"title": "System Instructions",
"description": "Domain doctrine and rules for this pass (taxonomies, regime rules, detection guidance). Embedded verbatim into the system prompt. This is where extraction knowledge lives instead of a RAG node.",
"x-ui-widget": "textarea"
},
"prompt_template_id": {
"type": "string",
"title": "Prompt Template",
"description": "Optional `CognitiveInfrastructurePromptTemplateModel.id`. When set, its `system_instructions` are prepended to the inline `system_instructions`. Non-fatal: if the template cannot be resolved, the inline instructions are used.",
"ui_widget": "prompt_template_picker"
},
"confidence_threshold": {
"type": "number",
"title": "Confidence Threshold",
"default": 0.7,
"minimum": 0,
"maximum": 1,
"description": "Fields with self-assessed confidence below this value are flagged and route output to `low_confidence`."
},
"max_retries": {
"type": "number",
"title": "Max Retries",
"default": 1,
"minimum": 0,
"description": "How many times to re-invoke the model with a correction message when schema validation fails or JSON is unparseable."
},
"language": {
"type": "string",
"title": "Language",
"default": "es",
"description": "Language of the document and the response."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
},
"required": [
"llm_provider_id",
"field_schema"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Full text of the document (e.g. from ai.multimodal.extract.text.cascade-pipeline)."
},
"context": {
"type": "object",
"description": "Optional results from prior passes, carried forward as context to improve coherence."
}
},
"required": [
"text"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"fields": {
"type": "object",
"description": "Per-field result: `{ value, confidence, provenance: { pass, source } }` keyed by field name."
},
"pass_label": {
"type": "string",
"description": "The pass that produced these fields."
},
"overall_confidence": {
"type": "number",
"description": "Mean self-assessed confidence across declared fields."
},
"low_confidence_fields": {
"type": "array",
"description": "Field names with confidence below the threshold.",
"items": {
"type": "string"
}
},
"validation": {
"type": "object",
"description": "Schema validation result `{ valid, errors[] }`."
},
"field_count": {
"type": "number",
"description": "Number of declared fields in this pass."
}
}
},
"ports": [
{
"port_id": "extracted",
"label": "Extracted",
"description": "All fields valid and at/above the confidence threshold.",
"is_default": true,
"supports_condition": true
},
{
"port_id": "low_confidence",
"label": "Low Confidence",
"description": "Extraction succeeded but some fields are below threshold or failed validation — route to a review gate.",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Extraction failed (no text, no schema, or no parseable output).",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "async",
"tags": [
"ai",
"nlp",
"extraction",
"legal",
"structured",
"confidence",
"provenance",
"xai"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"llm_provider_id": {
"type": "string",
"title": "LLM Provider",
"description": "The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or the SSE stream endpoint for stream mode. Use a high-quality reasoning model for complex legal documents.",
"x-ui-widget": "llm-provider-picker",
"x-llm-provider-capabilities": [
"chat"
]
},
"invocation_mode": {
"type": "string",
"title": "Invocation Mode",
"description": "Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (recommended for long documents where a pass may run >30s). Default `sync`.",
"enum": [
"sync",
"stream"
],
"default": "sync"
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Maximum time to wait for each LLM call (including retries). Default 30000 for sync, 600000 for stream.",
"minimum": 1000
},
"pass_label": {
"type": "string",
"title": "Pass Label",
"default": "pass-1",
"description": "Human-readable identifier for this extraction pass (e.g. `identification`, `procedural-timeline`). Stamped into each field's provenance so downstream merge/scoring nodes can tell which pass produced each value."
},
"field_schema": {
"type": "array",
"title": "Field Schema",
"description": "The fields this pass must extract. Each item declares one field. This is the contract the LLM is instructed to fill and the result is validated against.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Field Name",
"description": "Output key for the field."
},
"type": {
"type": "string",
"title": "Type",
"enum": [
"string",
"number",
"boolean",
"array",
"object",
"date"
],
"default": "string",
"description": "Expected value type, used for validation."
},
"description": {
"type": "string",
"title": "Description",
"description": "What this field represents."
},
"required": {
"type": "boolean",
"title": "Required",
"default": false,
"description": "Fail validation if missing."
},
"strong_signals": {
"type": "string",
"title": "Strong Signals",
"description": "Textual cues that indicate where to find this field (embedded in the prompt)."
},
"do_not_confuse_with": {
"type": "string",
"title": "Do Not Confuse With",
"description": "Disambiguation guidance to avoid common extraction mistakes."
},
"enum": {
"type": "array",
"title": "Allowed Values",
"description": "Optional closed set of allowed values, enforced during validation.",
"items": {
"type": "string"
}
}
},
"required": [
"name"
]
}
},
"system_instructions": {
"type": "string",
"title": "System Instructions",
"description": "Domain doctrine and rules for this pass (taxonomies, regime rules, detection guidance). Embedded verbatim into the system prompt. This is where extraction knowledge lives instead of a RAG node.",
"x-ui-widget": "textarea"
},
"prompt_template_id": {
"type": "string",
"title": "Prompt Template",
"description": "Optional `CognitiveInfrastructurePromptTemplateModel.id`. When set, its `system_instructions` are prepended to the inline `system_instructions`. Non-fatal: if the template cannot be resolved, the inline instructions are used.",
"ui_widget": "prompt_template_picker"
},
"confidence_threshold": {
"type": "number",
"title": "Confidence Threshold",
"default": 0.7,
"minimum": 0,
"maximum": 1,
"description": "Fields with self-assessed confidence below this value are flagged and route output to `low_confidence`."
},
"max_retries": {
"type": "number",
"title": "Max Retries",
"default": 1,
"minimum": 0,
"description": "How many times to re-invoke the model with a correction message when schema validation fails or JSON is unparseable."
},
"language": {
"type": "string",
"title": "Language",
"default": "es",
"description": "Language of the document and the response."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
},
"required": [
"llm_provider_id",
"field_schema"
]
}{
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Full text of the document (e.g. from ai.multimodal.extract.text.cascade-pipeline)."
},
"context": {
"type": "object",
"description": "Optional results from prior passes, carried forward as context to improve coherence."
}
},
"required": [
"text"
]
}{
"type": "object",
"properties": {
"fields": {
"type": "object",
"description": "Per-field result: `{ value, confidence, provenance: { pass, source } }` keyed by field name."
},
"pass_label": {
"type": "string",
"description": "The pass that produced these fields."
},
"overall_confidence": {
"type": "number",
"description": "Mean self-assessed confidence across declared fields."
},
"low_confidence_fields": {
"type": "array",
"description": "Field names with confidence below the threshold.",
"items": {
"type": "string"
}
},
"validation": {
"type": "object",
"description": "Schema validation result `{ valid, errors[] }`."
},
"field_count": {
"type": "number",
"description": "Number of declared fields in this pass."
}
}
}[
{
"port_id": "extracted",
"label": "Extracted",
"description": "All fields valid and at/above the confidence threshold.",
"is_default": true,
"supports_condition": true
},
{
"port_id": "low_confidence",
"label": "Low Confidence",
"description": "Extraction succeeded but some fields are below threshold or failed validation — route to a review gate.",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Extraction failed (no text, no schema, or no parseable output).",
"is_default": false,
"supports_condition": false
}
]Ejecución
- Ejecución
async- Con estado
- No
- Reintentos (
retryOnFail) - No
- Capacidades
nlpextractionlegalstructuredconfidenceprovenancemulti-pass- Etiquetas
ainlpextractionlegalstructuredconfidenceprovenancexai
Notas y límites
- Encadena varias pasadas dando a cada una su propio
pass_labelyfield_schema, y pasa los resultados previos comocontext;provenance.passregistra qué pasada produjo cada valor. - La confianza y la procedencia son afirmaciones del propio modelo; el código no comprueba que la cita exista en el documento.
languagevaleespor defecto y solo fija la línea de idioma de respuesta.- La llamada al modelo pasa por el backend de Sommatic AI, que resuelve el registro de proveedor indicado en
llm_provider_id(endpoint, credenciales, despliegue); el orquestador nunca guarda llaves del proveedor.invocation_mode: "sync"(por defecto) espera la respuesta completa;"stream"la lee como eventos SSE y une los fragmentos. - En modo stream el endpoint del backend no aplica los parámetros de muestreo, así que la
temperature: 0fija solo tiene efecto en modo sync. - Los reintentos por validación son los únicos: una llamada al modelo fallida (red, proveedor) no se reintenta y sale por
error.
Revisado contra el código del orquestador · 31e874b · 2026-11-26