On this page
Sommatic Docs
Open portal

Score & Rate

Score and rate text content using LLM-powered evaluation across multiple dimensions.

View as Markdown
Open in
AI Available ai.score Version 1.0.0 Execution: async

Scores text with the LLM on a configurable scale (quality, relevance, urgency, risk or your own weighted criteria) and routes to high, medium or low by comparing the score with the thresholds.

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.

Operations:

  • Quality: Evaluate clarity, completeness, accuracy, and coherence.
  • Relevance: Score semantic overlap and topic alignment against a reference.
  • Urgency: Assess time sensitivity, impact severity, and stakeholder importance.
  • Risk: Identify risk factors, likelihood, and potential impact.
  • Custom: Define weighted criteria with descriptions and optional rubrics.

How it works

  1. Resolves the node config: expressions in config keys are evaluated against the run; the incoming item is used as-is.
  2. Merges the incoming item with the resolved config (config keys win) and reads the inputs from the result.
  3. Requires text. Picks the instruction for scoring_mode (default quality). In custom mode it lists criteria plus the criteria found in the knowledge resource; with no criteria it falls back to quality.
  4. Builds the user message: text, preceded by context when present. In relevance mode with a reference, the message is the reference followed by the text (the context is dropped).
  5. Calls the LLM through the backend with the llm_provider_id record. invocation_mode: "sync" (default) waits for the full answer; "stream" reads it over SSE and joins the chunks.
  6. Parses the JSON answer (temperature 0); score must be a number. normalized_score = (score − scale_min) / (scale_max − scale_min).
  7. Routes by the raw score: ≥ thresholds.high (7) → high, ≥ thresholds.medium (4) → medium, otherwise low.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "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"
  }
}

Configuration

llm_provider_id string Optional

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.

invocation_mode string Optional

Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.

Default: sync

Allowed values: syncstream

timeout_ms integer Optional

Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.

scoring_mode string Optional

Predefined evaluation strategy or custom criteria.

Default: quality

Allowed values: qualityrelevanceurgencyriskcustom

scale_min number Optional

Minimum value of the scoring scale.

Default: 0

scale_max number Optional

Maximum value of the scoring scale.

Default: 10

criteria array<object> Optional

Weighted criteria for custom scoring mode.

Shown when: scoring_mode = custom

reference_text string Optional Accepts expressions

Reference content to score relevance against.

Shown when: scoring_mode = relevance

knowledge_resource_id string Optional

Scoring rubric or policy to load criteria from.

thresholds object Optional

Score boundaries for routing to high/medium/low ports.

high number Optional

Minimum score for high port.

Default: 7

medium number Optional

Minimum score for medium port.

Default: 4

low number Optional

Minimum score for low port.

Default: 0

language string Optional

Language for evaluation output.

Default: en

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

llm_provider_id
Required at runtime although the schema does not mark it as required. It is the id of an LLM provider record; the backend resolves endpoint, deployment and credentials from it.
thresholds
Compared with the raw score, not the normalized one: if you change scale_min/scale_max, change the thresholds too. thresholds.low is not used.
reference_text
Used only in relevance mode. A reference field in the incoming item takes precedence over it.
knowledge_resource_id
Read only in custom mode, from structured_data.criteria (name, weight, description). If it cannot be loaded, the failure is only logged.
criteria
Used only in custom mode. The weighting is requested from the model in the prompt; the code does not compute a weighted score.
timeout_ms
timeout_ms only takes effect in stream mode, as the idle time allowed between chunks (default 600000). In sync mode it is logged but the backend request has no timeout.

Output ports

high default

score ≥ thresholds.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."
  ]
}
medium

thresholds.medium ≤ score < thresholds.high. Same shape with level: "medium".

Data
{
  "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. Same shape with level: "low".

Data
{
  "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

Validation, the LLM call or parsing failed. data is { error } (plus response when the backend returned a body).

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

In expressions

What a later node can read from this node's output with $("Score & Rate").item.json.<path> (write your node's label instead of Score & Rate). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through high, from the output shown in Ports.

ExpressionEditorWorker
$("Score & Rate").item.json.scorenumber= 8Overall score on the configured scale.
$("Score & Rate").item.json.normalized_scorenumber= 0.8Score normalized to 0-1 range.
$("Score & Rate").item.json.levelstring= "high"Threshold level: high, medium, or low.
$("Score & Rate").item.json.dimensionsobject= {…}Per-criterion scores and explanations.
$("Score & Rate").item.json.explanationstring= "Clear and accurate reply with one missing de…"Overall assessment summary.
$("Score & Rate").item.json.factorsarray= […] (2)Key factors influencing the score.
$("Score & Rate").item.json.recommendationsarray= […] (1)Suggestions for improvement.
$("Score & Rate").item.json.dimensions.clarityobjectNot suggested by the editor= {…}—
$("Score & Rate").item.json.dimensions.completenessobjectNot suggested by the editor= {…}—

— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).

Errors

Message Port Cause and fix
Missing input text for scoring. error The incoming item has no text.
Model did not return valid scoring output. error The answer had no JSON object with a numeric score.
[AiScore] Missing 'llm_provider_id' in node config (LlmProviderModel.id, e.g. 'wf-llm-provider-*'). … error The node has no llm_provider_id. Pick an LLM provider in the node config; the legacy model_id key is not accepted.
LLM Invocation Error: <backend message> error The backend rejected the call (unknown or inactive provider record, provider error, credentials). Check the provider record.
LLM Invocation Error: empty response from backend (<reason>). error The backend could not be reached or returned nothing in sync mode.
RemoteApiService.stream: idle timeout after <timeout_ms>ms error In stream mode no chunk arrived within timeout_ms.

Input contract

text string Required

Content to score.

context string Optional

Optional context for evaluation.

reference string Optional

Optional reference content for relevance scoring.

Output contract

score number Optional

Overall score on the configured scale.

normalized_score number Optional

Score normalized to 0-1 range.

level string Optional

Threshold level: high, medium, or low.

dimensions object Optional

Per-criterion scores and explanations.

explanation string Optional

Overall assessment summary.

factors array Optional

Key factors influencing the score.

recommendations array Optional

Suggestions for improvement.

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "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
    }
  }
}

Execution

Execution
async
Stateful
No
Retries (retryOnFail)
No
Capabilities
aiscoringevaluationrating
Tags
aiscoringevaluationqualityrisk

Notes and limits

  • The score is not clamped to the scale: a value outside it gives a normalized_score below 0 or above 1.
  • The model’s own level is ignored; the code recomputes it from the thresholds.
  • The model answer is parsed as JSON after removing Markdown code fences; if that fails, the text between the first { and the last } is parsed.
  • Input fields are read from the incoming item ($json). A key with the same name in the node config, which may be an expression, takes precedence over the input.
  • The worker also returns the provider response as raw outside data; the engine does not keep it.
  • On success the worker returns port and data without an ok field; the engine routes on port only.
  • timeout_ms only takes effect in stream mode, as the idle time allowed between chunks (default 600000). In sync mode it is logged but the backend request has no timeout.
  • In stream mode the temperature this node sets is not forwarded to the provider, and raw is null.
  • The engine does not apply execution.retryOnFail, maxTries, waitBetweenTries or continueOnFail to this node. Handle failures by wiring the error port.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs