# Score & Rate

> 使用 LLM 驱动的评估，从多个维度对文本内容打分和评级。

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

- 标识: `ai.score`
- 类别: AI
- 版本: 1.0.0
- 状态: 可用
- 执行方式: async

使用 LLM 驱动的评估，从多个维度对文本内容打分和评级。

通过可配置的分值范围和阈值评估质量、相关性、紧急程度、风险或自定义标准。支持通过从 Knowledge Resource 加载的自定义评分细则进行加权多标准评分。

**操作：**
- **Quality：** 评估清晰度、完整性、准确性和连贯性。
- **Relevance：** 根据与参考内容的语义重合度和主题契合度打分。
- **Urgency：** 评估时间敏感性、影响严重程度和相关方的重要性。
- **Risk：** 识别风险因素、发生可能性和潜在影响。
- **Custom：** 定义带描述和可选评分细则的加权标准。

## 配置

- `llm_provider_id` (string, 可选): `LlmProviderModel` 记录的 `id`（例如 `wf-llm-provider-*`）。编排器将调用委托给后端：sync 模式调用 `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke`，stream 模式调用 `POST /chat/conversation/execute/stream-ephemeral`（SSE）。后端根据该记录解析 endpoint + api-key + deployment，并路由到相应的适配器。
- `invocation_mode` (string, 可选): LLM 调用的传输方式。`sync` 会阻塞直到收到完整响应。`stream` 通过 SSE 逐步接收 token（长文本生成必须使用）。默认为 `sync`。 默认值: `sync`. 可选值: `sync`, `stream`.
- `timeout_ms` (integer, 可选): 等待调用完成的最长时间（stream 模式下为分块之间的空闲超时）。sync 默认 30000，stream 默认 600000。
- `scoring_mode` (string, 可选): 预定义的评估策略或自定义标准。 默认值: `quality`. 可选值: `quality`, `relevance`, `urgency`, `risk`, `custom`.
- `scale_min` (number, 可选): 评分范围的最小值。 默认值: `0`.
- `scale_max` (number, 可选): 评分范围的最大值。 默认值: `10`.
- `criteria` (array<object>, 可选): 自定义评分模式下的加权标准。 显示条件: scoring_mode = `custom`.
- `reference_text` (string, 可选, 支持表达式): 用于评估相关性的参考内容。 显示条件: scoring_mode = `relevance`.
- `knowledge_resource_id` (string, 可选): 用于加载评分标准的评分细则或政策。
- `thresholds` (object, 可选): 路由到 high/medium/low 端口的分数界限。
  - `high` (number, 可选): 进入 high 端口的最低分。 默认值: `7`.
  - `medium` (number, 可选): 进入 medium 端口的最低分。 默认值: `4`.
  - `low` (number, 可选): 进入 low 端口的最低分。 默认值: `0`.
- `language` (string, 可选): 评估输出所用的语言。 默认值: `en`.

配置中会显示通用执行设置，但该节点目前不执行重试（`retryOnFail`、`maxTries`）。所有节点均未实现 `continueOnFail`。

## 输出端口

- `high` (默认): 得分达到或超过 high 阈值。
- `medium`: 得分介于 medium 和 high 阈值之间。
- `low`: 得分低于 medium 阈值。
- `error`: 评分失败。

## 输入契约

- `text` (string, 必填): 要打分的内容。
- `context` (string, 可选): 用于评估的可选上下文。
- `reference` (string, 可选): 用于相关性评分的可选参考内容。

## 输出契约

- `score` (number, 可选): 按所配置分值范围给出的总分。
- `normalized_score` (number, 可选): 归一化到 0-1 区间的得分。
- `level` (string, 可选): 阈值等级：high、medium 或 low。
- `dimensions` (object, 可选): 各项标准的得分及说明。
- `explanation` (string, 可选): 整体评估摘要。
- `factors` (array, 可选): 影响得分的关键因素。
- `recommendations` (array, 可选): 改进建议。

## 在表达式中

后续节点可通过 `$("Score & Rate").item.json.<路径>` 读取此节点输出中的内容（请把 `Score & Rate` 换成你的节点标签）。**Editor** 标记工作流编辑器在 Previous Nodes 中提示的路径（输出契约）；**Worker** 标记 worker 实际通过 `high` 返回的路径，依据“端口”一节所示的输出。

- `$("Score & Rate").item.json.score` (number) = `8`: 按所配置分值范围给出的总分。
- `$("Score & Rate").item.json.normalized_score` (number) = `0.8`: 归一化到 0-1 区间的得分。
- `$("Score & Rate").item.json.level` (string) = `"high"`: 阈值等级：high、medium 或 low。
- `$("Score & Rate").item.json.dimensions` (object) = `{…}`: 各项标准的得分及说明。
- `$("Score & Rate").item.json.explanation` (string) = `"Clear and accurate reply with one missing de…"`: 整体评估摘要。
- `$("Score & Rate").item.json.factors` (array) = `[…] (2)`: 影响得分的关键因素。
- `$("Score & Rate").item.json.recommendations` (array) = `[…] (1)`: 改进建议。
- `$("Score & Rate").item.json.dimensions.clarity` (object) = `{…}` (编辑器不提示)
- `$("Score & Rate").item.json.dimensions.completeness` (object) = `{…}` (编辑器不提示)


## 工作原理

使用 LLM 按可配置的量表（质量、相关性、紧急度、风险或自定义加权标准）为 `text` 打分，并将分数与阈值比较后路由到 `high`、`medium` 或 `low`。

1. 解析节点配置：配置键中的表达式会基于本次运行求值；传入条目按原样使用。
2. 将传入条目与解析后的配置合并（配置键优先），并从合并结果中读取输入。
3. 必须提供 `text`。根据 `scoring_mode`（默认 `quality`）选择指令。`custom` 模式会列出 `criteria` 以及知识资源中的标准；没有任何标准时回退为 `quality`。
4. 构建用户消息：`text`，若有 `context` 则置于其前。在带参考文本的 `relevance` 模式下，消息为参考文本加待评文本（`context` 会被丢弃）。
5. 通过后端使用 `llm_provider_id` 记录调用 LLM。`invocation_mode: "sync"`（默认）等待完整响应；`"stream"` 通过 SSE 读取并拼接分块。
6. 解析 JSON 响应（温度 0），`score` 必须为数字。`normalized_score` = (score − scale_min) / (scale_max − scale_min)。
7. 按原始分数路由：≥ `thresholds.high`（7）→ `high`，≥ `thresholds.medium`（4）→ `medium`，否则 `low`。

## 在工作流中

### 节点

```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."
    ]
  }
}
```

## 输出端口 (代码中的行为)

### `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`。结构相同，`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`。结构相同，`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`

校验、LLM 调用或解析失败。`data` 为 `{ error }`（若后端返回了响应体，还包含 `response`）。

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

## 代码中的行为

- `llm_provider_id`: 虽然 schema 未将其标为必填，但运行时必须提供。它是 LLM 提供方记录的 id；后端据此解析端点、部署和凭据。
- `thresholds`: 与原始分数比较，而不是归一化分数：修改 `scale_min`/`scale_max` 时也要相应修改阈值。`thresholds.low` 未被使用。
- `reference_text`: 仅在 `relevance` 模式下使用。传入条目中的 `reference` 字段优先于它。
- `knowledge_resource_id`: 仅在 `custom` 模式下读取，来源为 `structured_data.criteria`（`name`、`weight`、`description`）。无法加载时只记录失败。
- `criteria`: 仅在 `custom` 模式下使用。加权计算通过提示词交给模型完成；代码本身不计算加权分数。
- `timeout_ms`: `timeout_ms` 仅在 `stream` 模式下生效，表示分块之间允许的空闲时间（默认 600000）。在 `sync` 模式下只会记录到日志，后端请求本身没有超时。

## 错误

| 消息 | 端口 | 原因与处理 |
| --- | --- | --- |
| `Missing input text for scoring.` | `error` | 传入条目中没有 `text`。 |
| `Model did not return valid scoring output.` | `error` | 响应中没有含数字 `score` 的 JSON 对象。 |
| `[AiScore] Missing 'llm_provider_id' in node config (LlmProviderModel.id, e.g. 'wf-llm-provider-*'). …` | `error` | 节点缺少 `llm_provider_id`。请在节点配置中选择一个 LLM 提供方；旧的 `model_id` 键不再被接受。 |
| `LLM Invocation Error: <backend message>` | `error` | 后端拒绝了调用（提供方记录不存在或未启用、提供方错误、凭据问题）。请检查提供方记录。 |
| `LLM Invocation Error: empty response from backend (<reason>).` | `error` | 在 `sync` 模式下无法连接后端，或后端未返回任何内容。 |
| `RemoteApiService.stream: idle timeout after <timeout_ms>ms` | `error` | 在 `stream` 模式下，`timeout_ms` 内没有收到任何分块。 |

## 说明与限制

- 分数不会被限制在量表范围内：超出范围的值会使 `normalized_score` 小于 0 或大于 1。
- 模型返回的 `level` 会被忽略；代码会根据阈值重新计算。
- 模型响应在去除 Markdown 代码块标记后按 JSON 解析；若失败，则解析第一个 `{` 与最后一个 `}` 之间的文本。
- 输入字段从传入条目（`$json`）读取。节点配置中同名的键（可以是表达式）优先于输入。
- Worker 还会在 `data` 之外以 `raw` 返回提供方的原始响应；引擎不会保留它。
- 成功时 worker 返回 `port` 和 `data`，不含 `ok` 字段；引擎只依据 `port` 路由。
- `timeout_ms` 仅在 `stream` 模式下生效，表示分块之间允许的空闲时间（默认 600000）。在 `sync` 模式下只会记录到日志，后端请求本身没有超时。
- 在 `stream` 模式下，此节点设置的温度不会转发给提供方，且 `raw` 为 `null`。
- 引擎不会对此节点应用 `execution.retryOnFail`、`maxTries`、`waitBetweenTries` 或 `continueOnFail`。请通过连接 `error` 端口处理失败。


## 契约（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
  }
]
```
