# Score & Rate

> Puntúa y califica contenido de texto con una evaluación por LLM en varias dimensiones.

Source: https://docs.sommatic.ai/es/nodes/ai.score/

- Slug: `ai.score`
- Familia: IA
- Versión: 1.0.0
- Estado: Disponible
- Ejecución: async

Puntúa y califica contenido de texto con una evaluación por LLM en varias dimensiones.

Evalúa la calidad, la relevancia, la urgencia, el riesgo o criterios personalizados con escalas y umbrales configurables. Admite puntuación ponderada con varios criterios mediante rúbricas personalizadas cargadas desde Knowledge Resources.

**Operaciones:**
- **Quality:** Evalúa la claridad, la completitud, la exactitud y la coherencia.
- **Relevance:** Puntúa la coincidencia semántica y la afinidad temática frente a una referencia.
- **Urgency:** Valora la sensibilidad al tiempo, la gravedad del impacto y la importancia para las partes interesadas.
- **Risk:** Identifica los factores de riesgo, su probabilidad y el impacto potencial.
- **Custom:** Define criterios ponderados con descripciones y rúbricas opcionales.

## Configuración

- `llm_provider_id` (string, opcional): 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 `POST /chat/conversation/execute/stream-ephemeral` (SSE) en modo stream. El backend resuelve endpoint + api-key + deployment a partir del registro y enruta al adaptador correspondiente.
- `invocation_mode` (string, opcional): Transporte de la llamada al LLM. `sync` se bloquea hasta recibir la respuesta completa. `stream` consume los tokens mediante SSE (necesario para generaciones largas). Predeterminado: `sync`. Por defecto: `sync`. Valores permitidos: `sync`, `stream`.
- `timeout_ms` (integer, opcional): Tiempo máximo de espera para que termine la invocación (o tiempo máximo de inactividad entre fragmentos en modo stream). Predeterminado: 30000 en sync, 600000 en stream.
- `scoring_mode` (string, opcional): Estrategia de evaluación predefinida o criterios personalizados. Por defecto: `quality`. Valores permitidos: `quality`, `relevance`, `urgency`, `risk`, `custom`.
- `scale_min` (number, opcional): Valor mínimo de la escala de puntuación. Por defecto: `0`.
- `scale_max` (number, opcional): Valor máximo de la escala de puntuación. Por defecto: `10`.
- `criteria` (array<object>, opcional): Criterios ponderados para el modo de puntuación personalizado. Se muestra cuando: scoring_mode = `custom`.
- `reference_text` (string, opcional, acepta expresiones): Contenido de referencia frente al que se puntúa la relevancia. Se muestra cuando: scoring_mode = `relevance`.
- `knowledge_resource_id` (string, opcional): Rúbrica o política de puntuación desde la que se cargan los criterios.
- `thresholds` (object, opcional): Límites de puntuación para enrutar a los puertos high/medium/low.
  - `high` (number, opcional): Puntuación mínima para el puerto high. Por defecto: `7`.
  - `medium` (number, opcional): Puntuación mínima para el puerto medium. Por defecto: `4`.
  - `low` (number, opcional): Puntuación mínima para el puerto low. Por defecto: `0`.
- `language` (string, opcional): Idioma de la salida de la evaluación. Por defecto: `en`.

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`.

## Puertos de salida

- `high` (por defecto): La puntuación alcanza o supera el umbral alto.
- `medium`: La puntuación está entre los umbrales medio y alto.
- `low`: La puntuación está por debajo del umbral medio.
- `error`: La puntuación falló.

## Contrato de entrada

- `text` (string, obligatorio): Contenido que se puntúa.
- `context` (string, opcional): Contexto opcional para la evaluación.
- `reference` (string, opcional): Contenido de referencia opcional para puntuar la relevancia.

## Contrato de salida

- `score` (number, opcional): Puntuación general en la escala configurada.
- `normalized_score` (number, opcional): Puntuación normalizada al rango 0-1.
- `level` (string, opcional): Nivel según los umbrales: high, medium o low.
- `dimensions` (object, opcional): Puntuaciones y explicaciones por criterio.
- `explanation` (string, opcional): Resumen de la valoración general.
- `factors` (array, opcional): Factores clave que influyen en la puntuación.
- `recommendations` (array, opcional): Sugerencias de mejora.

## En expresiones

Lo que un nodo posterior puede leer de la salida de este nodo con `$("Score & Rate").item.json.<ruta>` (escribe la etiqueta de tu nodo en lugar de `Score & Rate`). **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 `high`, según la salida que muestra Puertos.

- `$("Score & Rate").item.json.score` (number) = `8`: Puntuación general en la escala configurada.
- `$("Score & Rate").item.json.normalized_score` (number) = `0.8`: Puntuación normalizada al rango 0-1.
- `$("Score & Rate").item.json.level` (string) = `"high"`: Nivel según los umbrales: high, medium o low.
- `$("Score & Rate").item.json.dimensions` (object) = `{…}`: Puntuaciones y explicaciones por criterio.
- `$("Score & Rate").item.json.explanation` (string) = `"Clear and accurate reply with one missing de…"`: Resumen de la valoración general.
- `$("Score & Rate").item.json.factors` (array) = `[…] (2)`: Factores clave que influyen en la puntuación.
- `$("Score & Rate").item.json.recommendations` (array) = `[…] (1)`: Sugerencias de mejora.
- `$("Score & Rate").item.json.dimensions.clarity` (object) = `{…}` (El editor no la sugiere)
- `$("Score & Rate").item.json.dimensions.completeness` (object) = `{…}` (El editor no la sugiere)


## Cómo funciona

Puntúa `text` con el LLM en una escala configurable (calidad, relevancia, urgencia, riesgo o tus propios criterios ponderados) y enruta a `high`, `medium` o `low` comparando la puntuación con los umbrales.

1. Resuelve la configuración del nodo: las expresiones de las claves de configuración se evalúan contra la ejecución; el ítem entrante se usa tal cual.
2. Combina el ítem entrante con la configuración resuelta (las claves de configuración tienen prioridad) y lee las entradas del resultado.
3. Exige `text`. Elige la instrucción de `scoring_mode` (predeterminado `quality`). En modo `custom` enumera `criteria` más los criterios del recurso de conocimiento; sin criterios recurre a `quality`.
4. Construye el mensaje de usuario: `text`, precedido de `context` si existe. En modo `relevance` con referencia, el mensaje es la referencia seguida del texto (el `context` se descarta).
5. Llama al LLM a través del backend con el registro `llm_provider_id`. `invocation_mode: "sync"` (predeterminado) espera la respuesta completa; `"stream"` la lee por SSE y une los fragmentos.
6. Interpreta la respuesta JSON (temperatura 0); `score` debe ser un número. `normalized_score` = (score − scale_min) / (scale_max − scale_min).
7. Enruta por la puntuación sin normalizar: ≥ `thresholds.high` (7) → `high`, ≥ `thresholds.medium` (4) → `medium`; si no, `low`.

## En un workflow

### Nodo

```json
{
  "node_id": "node-score-reply",
  "label": "Score reply quality",
  "operator_slug": "ai.score",
  "operator_version": "1.0.0",
  "config": {
    "llm_provider_id": "<llm_provider_id>",
    "scoring_mode": "quality",
    "scale_min": 0,
    "scale_max": 10,
    "thresholds": {
      "high": 7,
      "medium": 4,
      "low": 0
    },
    "language": "en"
  }
}
```

### Envelope

```json
{
  "ok": true,
  "port": "high",
  "data": {
    "score": 8,
    "normalized_score": 0.8,
    "level": "high",
    "dimensions": {
      "clarity": {
        "score": 9,
        "explanation": "Short, direct sentences."
      },
      "completeness": {
        "score": 7,
        "explanation": "Missing the delivery date."
      }
    },
    "explanation": "Clear and accurate reply with one missing detail.",
    "factors": [
      "clear structure",
      "missing date"
    ],
    "recommendations": [
      "Add the expected delivery date."
    ]
  }
}
```

## Puertos de salida (comportamiento en el código)

### `high`

`score` ≥ `thresholds.high`.

```json
{
  "score": 8,
  "normalized_score": 0.8,
  "level": "high",
  "dimensions": {
    "clarity": {
      "score": 9,
      "explanation": "Short, direct sentences."
    },
    "completeness": {
      "score": 7,
      "explanation": "Missing the delivery date."
    }
  },
  "explanation": "Clear and accurate reply with one missing detail.",
  "factors": [
    "clear structure",
    "missing date"
  ],
  "recommendations": [
    "Add the expected delivery date."
  ]
}
```

### `medium`

`thresholds.medium` ≤ `score` < `thresholds.high`. Misma forma con `level: "medium"`.

```json
{
  "score": 5,
  "normalized_score": 0.5,
  "level": "medium",
  "dimensions": {
    "clarity": {
      "score": 9,
      "explanation": "Short, direct sentences."
    },
    "completeness": {
      "score": 7,
      "explanation": "Missing the delivery date."
    }
  },
  "explanation": "Clear and accurate reply with one missing detail.",
  "factors": [
    "clear structure",
    "missing date"
  ],
  "recommendations": [
    "Add the expected delivery date."
  ]
}
```

### `low`

`score` < `thresholds.medium`. Misma forma con `level: "low"`.

```json
{
  "score": 2,
  "normalized_score": 0.2,
  "level": "low",
  "dimensions": {
    "clarity": {
      "score": 9,
      "explanation": "Short, direct sentences."
    },
    "completeness": {
      "score": 7,
      "explanation": "Missing the delivery date."
    }
  },
  "explanation": "Clear and accurate reply with one missing detail.",
  "factors": [
    "clear structure",
    "missing date"
  ],
  "recommendations": [
    "Add the expected delivery date."
  ]
}
```

### `error`

Falló la validación, la llamada al LLM o la interpretación. `data` es `{ error }` (más `response` cuando el backend devolvió un cuerpo).

```json
{
  "error": "Model did not return valid scoring output."
}
```

## Comportamiento en el código

- `llm_provider_id`: Es obligatorio en ejecución aunque el esquema no lo marque como requerido. Es el id de un registro de proveedor LLM; el backend resuelve a partir de él el endpoint, el despliegue y las credenciales.
- `thresholds`: Se compara con la puntuación sin normalizar, no con la normalizada: si cambias `scale_min`/`scale_max`, cambia también los umbrales. `thresholds.low` no se usa.
- `reference_text`: Solo se usa en modo `relevance`. Un campo `reference` en el ítem entrante tiene prioridad sobre él.
- `knowledge_resource_id`: Solo se lee en modo `custom`, desde `structured_data.criteria` (`name`, `weight`, `description`). Si no se puede cargar, el fallo solo se registra.
- `criteria`: Solo se usa en modo `custom`. La ponderación se pide al modelo en el prompt; el código no calcula una puntuación ponderada.
- `timeout_ms`: `timeout_ms` solo tiene efecto en modo `stream`, como el tiempo de inactividad permitido entre fragmentos (predeterminado 600000). En modo `sync` se registra en el log, pero la petición al backend no tiene tiempo límite.

## Errores

| Mensaje | Puerto | Causa y solución |
| --- | --- | --- |
| `Missing input text for scoring.` | `error` | El ítem entrante no tiene `text`. |
| `Model did not return valid scoring output.` | `error` | La respuesta no tenía un objeto JSON con un `score` numérico. |
| `[AiScore] Missing 'llm_provider_id' in node config (LlmProviderModel.id, e.g. 'wf-llm-provider-*'). …` | `error` | El nodo no tiene `llm_provider_id`. Elige un proveedor LLM en la configuración del nodo; la clave antigua `model_id` no se acepta. |
| `LLM Invocation Error: <backend message>` | `error` | El backend rechazó la llamada (registro de proveedor desconocido o inactivo, error del proveedor, credenciales). Revisa el registro del proveedor. |
| `LLM Invocation Error: empty response from backend (<reason>).` | `error` | No se pudo contactar con el backend o no devolvió nada en modo `sync`. |
| `RemoteApiService.stream: idle timeout after <timeout_ms>ms` | `error` | En modo `stream` no llegó ningún fragmento dentro de `timeout_ms`. |

## Notas y límites

- La puntuación no se limita a la escala: un valor fuera de ella da un `normalized_score` menor que 0 o mayor que 1.
- El `level` que devuelve el modelo se ignora; el código lo recalcula con los umbrales.
- La respuesta del modelo se interpreta como JSON tras quitar los bloques de código Markdown; si falla, se interpreta el texto entre la primera `{` y la última `}`.
- Los campos de entrada se leen del ítem entrante (`$json`). Una clave con el mismo nombre en la configuración del nodo, que puede ser una expresión, tiene prioridad sobre la entrada.
- El worker también devuelve la respuesta del proveedor como `raw` fuera de `data`; el motor no la conserva.
- En caso de éxito el worker devuelve `port` y `data` sin el campo `ok`; el motor enruta solo por `port`.
- `timeout_ms` solo tiene efecto en modo `stream`, como el tiempo de inactividad permitido entre fragmentos (predeterminado 600000). En modo `sync` se registra en el log, pero la petición al backend no tiene tiempo límite.
- En modo `stream` la temperatura que fija este nodo no se envía al proveedor, y `raw` es `null`.
- El motor no aplica `execution.retryOnFail`, `maxTries`, `waitBetweenTries` ni `continueOnFail` a este nodo. Gestiona los fallos conectando el puerto `error`.


## Contratos (JSON Schema)

### All (`*.definition.js`)

```json
{
  "slug": "ai.score",
  "name": "Score & Rate",
  "category": "ai",
  "version": "1.0.0",
  "description": "Score and rate text content using LLM-powered evaluation across multiple dimensions.\n\n  Evaluate quality, relevance, urgency, risk, or custom criteria with configurable scales and thresholds. Supports weighted multi-criteria scoring via custom rubrics loaded from Knowledge Resources.\n\n  **Operations:**\n  - **Quality:** Evaluate clarity, completeness, accuracy, and coherence.\n  - **Relevance:** Score semantic overlap and topic alignment against a reference.\n  - **Urgency:** Assess time sensitivity, impact severity, and stakeholder importance.\n  - **Risk:** Identify risk factors, likelihood, and potential impact.\n  - **Custom:** Define weighted criteria with descriptions and optional rubrics.",
  "capabilities": [
    "ai",
    "scoring",
    "evaluation",
    "rating"
  ],
  "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 `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.",
        "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 (required for long generations). Default `sync`.",
        "enum": [
          "sync",
          "stream"
        ],
        "default": "sync"
      },
      "timeout_ms": {
        "type": "integer",
        "title": "Timeout (ms)",
        "description": "Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.",
        "minimum": 1000
      },
      "scoring_mode": {
        "type": "string",
        "title": "Scoring Mode",
        "enum": [
          "quality",
          "relevance",
          "urgency",
          "risk",
          "custom"
        ],
        "default": "quality",
        "description": "Predefined evaluation strategy or custom criteria."
      },
      "scale_min": {
        "type": "number",
        "title": "Scale Min",
        "default": 0,
        "description": "Minimum value of the scoring scale."
      },
      "scale_max": {
        "type": "number",
        "title": "Scale Max",
        "default": 10,
        "description": "Maximum value of the scoring scale."
      },
      "criteria": {
        "type": "array",
        "title": "Scoring Criteria",
        "description": "Weighted criteria for custom scoring mode.",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "Criterion name"
            },
            "weight": {
              "type": "number",
              "description": "Relative weight (0-1)"
            },
            "description": {
              "type": "string",
              "description": "What this criterion evaluates"
            }
          }
        },
        "displayOptions": {
          "show": {
            "scoring_mode": [
              "custom"
            ]
          }
        }
      },
      "reference_text": {
        "type": "string",
        "title": "Reference Text",
        "format": "expression",
        "description": "Reference content to score relevance against.",
        "displayOptions": {
          "show": {
            "scoring_mode": [
              "relevance"
            ]
          }
        }
      },
      "knowledge_resource_id": {
        "type": "string",
        "title": "Knowledge Resource",
        "description": "Scoring rubric or policy to load criteria from.",
        "ui_widget": "knowledge_resource_picker"
      },
      "thresholds": {
        "type": "object",
        "title": "Port Routing Thresholds",
        "description": "Score boundaries for routing to high/medium/low ports.",
        "properties": {
          "high": {
            "type": "number",
            "default": 7,
            "description": "Minimum score for high port."
          },
          "medium": {
            "type": "number",
            "default": 4,
            "description": "Minimum score for medium port."
          },
          "low": {
            "type": "number",
            "default": 0,
            "description": "Minimum score for low port."
          }
        }
      },
      "language": {
        "type": "string",
        "title": "Language",
        "default": "en",
        "description": "Language for evaluation output."
      },
      "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
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "description": "Content to score."
      },
      "context": {
        "type": "string",
        "description": "Optional context for evaluation."
      },
      "reference": {
        "type": "string",
        "description": "Optional reference content for relevance scoring."
      }
    },
    "required": [
      "text"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "score": {
        "type": "number",
        "description": "Overall score on the configured scale."
      },
      "normalized_score": {
        "type": "number",
        "description": "Score normalized to 0-1 range."
      },
      "level": {
        "type": "string",
        "description": "Threshold level: high, medium, or low."
      },
      "dimensions": {
        "type": "object",
        "description": "Per-criterion scores and explanations."
      },
      "explanation": {
        "type": "string",
        "description": "Overall assessment summary."
      },
      "factors": {
        "type": "array",
        "description": "Key factors influencing the score."
      },
      "recommendations": {
        "type": "array",
        "description": "Suggestions for improvement."
      }
    }
  },
  "ports": [
    {
      "port_id": "high",
      "label": "High Score",
      "description": "Score meets or exceeds the high threshold.",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "medium",
      "label": "Medium Score",
      "description": "Score is between medium and high thresholds.",
      "is_default": false,
      "supports_condition": true
    },
    {
      "port_id": "low",
      "label": "Low Score",
      "description": "Score is below the medium threshold.",
      "is_default": false,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Scoring failed.",
      "is_default": false,
      "supports_condition": false
    }
  ],
  "execution_mode": "async",
  "tags": [
    "ai",
    "scoring",
    "evaluation",
    "quality",
    "risk"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}
```

### config_schema

```json
{
  "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 `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.",
      "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 (required for long generations). Default `sync`.",
      "enum": [
        "sync",
        "stream"
      ],
      "default": "sync"
    },
    "timeout_ms": {
      "type": "integer",
      "title": "Timeout (ms)",
      "description": "Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.",
      "minimum": 1000
    },
    "scoring_mode": {
      "type": "string",
      "title": "Scoring Mode",
      "enum": [
        "quality",
        "relevance",
        "urgency",
        "risk",
        "custom"
      ],
      "default": "quality",
      "description": "Predefined evaluation strategy or custom criteria."
    },
    "scale_min": {
      "type": "number",
      "title": "Scale Min",
      "default": 0,
      "description": "Minimum value of the scoring scale."
    },
    "scale_max": {
      "type": "number",
      "title": "Scale Max",
      "default": 10,
      "description": "Maximum value of the scoring scale."
    },
    "criteria": {
      "type": "array",
      "title": "Scoring Criteria",
      "description": "Weighted criteria for custom scoring mode.",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Criterion name"
          },
          "weight": {
            "type": "number",
            "description": "Relative weight (0-1)"
          },
          "description": {
            "type": "string",
            "description": "What this criterion evaluates"
          }
        }
      },
      "displayOptions": {
        "show": {
          "scoring_mode": [
            "custom"
          ]
        }
      }
    },
    "reference_text": {
      "type": "string",
      "title": "Reference Text",
      "format": "expression",
      "description": "Reference content to score relevance against.",
      "displayOptions": {
        "show": {
          "scoring_mode": [
            "relevance"
          ]
        }
      }
    },
    "knowledge_resource_id": {
      "type": "string",
      "title": "Knowledge Resource",
      "description": "Scoring rubric or policy to load criteria from.",
      "ui_widget": "knowledge_resource_picker"
    },
    "thresholds": {
      "type": "object",
      "title": "Port Routing Thresholds",
      "description": "Score boundaries for routing to high/medium/low ports.",
      "properties": {
        "high": {
          "type": "number",
          "default": 7,
          "description": "Minimum score for high port."
        },
        "medium": {
          "type": "number",
          "default": 4,
          "description": "Minimum score for medium port."
        },
        "low": {
          "type": "number",
          "default": 0,
          "description": "Minimum score for low port."
        }
      }
    },
    "language": {
      "type": "string",
      "title": "Language",
      "default": "en",
      "description": "Language for evaluation output."
    },
    "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
        }
      }
    }
  }
}
```

### input_contract_schema

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "Content to score."
    },
    "context": {
      "type": "string",
      "description": "Optional context for evaluation."
    },
    "reference": {
      "type": "string",
      "description": "Optional reference content for relevance scoring."
    }
  },
  "required": [
    "text"
  ]
}
```

### output_contract_schema

```json
{
  "type": "object",
  "properties": {
    "score": {
      "type": "number",
      "description": "Overall score on the configured scale."
    },
    "normalized_score": {
      "type": "number",
      "description": "Score normalized to 0-1 range."
    },
    "level": {
      "type": "string",
      "description": "Threshold level: high, medium, or low."
    },
    "dimensions": {
      "type": "object",
      "description": "Per-criterion scores and explanations."
    },
    "explanation": {
      "type": "string",
      "description": "Overall assessment summary."
    },
    "factors": {
      "type": "array",
      "description": "Key factors influencing the score."
    },
    "recommendations": {
      "type": "array",
      "description": "Suggestions for improvement."
    }
  }
}
```

### ports

```json
[
  {
    "port_id": "high",
    "label": "High Score",
    "description": "Score meets or exceeds the high threshold.",
    "is_default": true,
    "supports_condition": true
  },
  {
    "port_id": "medium",
    "label": "Medium Score",
    "description": "Score is between medium and high thresholds.",
    "is_default": false,
    "supports_condition": true
  },
  {
    "port_id": "low",
    "label": "Low Score",
    "description": "Score is below the medium threshold.",
    "is_default": false,
    "supports_condition": true
  },
  {
    "port_id": "error",
    "label": "Error",
    "description": "Scoring failed.",
    "is_default": false,
    "supports_condition": false
  }
]
```
