Detect Language
Detects the language or languages present in a text with confidence scores.
Asks the model which language(s) text is written in and returns the primary language with its ISO 639-1 code, confidence and the share of each language.
How it works
- Merges the upstream payload with the node config (config wins) and reads
text(falling back toinput). - Sends a fixed system prompt asking for strict JSON with ISO 639-1 codes;
textis the user message;temperature: 0. - Parses the answer as JSON; it must contain
primary_language. Returns the fields as given by the model (all_languagesdefaults to[],is_multilingualtofalse) and routes tosuccess.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-detect-language",
"label": "Detect language",
"operator_slug": "ai.language",
"operator_version": "1.0.0",
"config": {
"text": "{{ $json.body }}",
"llm_provider_id": "wf-llm-provider-xxxx",
"invocation_mode": "sync"
}
}{
"ok": true,
"data": {
"primary_language": "Spanish",
"primary_language_code": "es",
"confidence": 0.97,
"all_languages": [
{
"language": "Spanish",
"code": "es",
"confidence": 0.97,
"percentage": 90
},
{
"language": "English",
"code": "en",
"confidence": 0.85,
"percentage": 10
}
],
"is_multilingual": true
},
"port": "success"
}Configuration
-
llm_provider_idstring 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_modestring Optional -
Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.
-
timeout_msinteger 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.
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.
-
text - Not in the config schema (it is in the input contract), but read from the config first and then from the upstream payload.
-
timeout_ms - Stream mode only: idle timeout between chunks, default 600000. In sync mode it is not applied to the request.
-
execution - Declared but ignored: neither the worker nor the engine reads
retryOnFail,maxTries,waitBetweenTries,continueOnFail,alwaysOutputDataortimeout_msfrom this block.
Output ports
success default The model returned a primary_language.
{
"primary_language": "Spanish",
"primary_language_code": "es",
"confidence": 0.97,
"all_languages": [
{
"language": "Spanish",
"code": "es",
"confidence": 0.97,
"percentage": 90
},
{
"language": "English",
"code": "en",
"confidence": 0.85,
"percentage": 10
}
],
"is_multilingual": true
}error The model call failed or the answer had no primary_language.
{
"error": "Model did not return valid language detection output."
}In expressions
What a later node can read from this node's output with $("Detect Language").item.json.<path> (write your node's label instead of Detect Language). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through success, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Detect Language").item.json.primary_languageFull name of the detected language. | ||
$("Detect Language").item.json.primary_language_codeISO 639-1 code of the primary language. | ||
$("Detect Language").item.json.confidenceConfidence score (0-1) for the primary language. | ||
$("Detect Language").item.json.all_languagesAll detected languages with codes, confidence, and percentage. | ||
$("Detect Language").item.json.is_multilingualTrue if multiple languages were detected. |
Errors
| Message | Port | Cause and fix |
|---|---|---|
Model did not return valid language detection output. | error | The answer was not JSON or had no primary_language. |
[AiLanguage] 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 is empty or not a string. Pick an LLM provider record with chat capability. |
LLM Invocation Error: <backend message> | error | The backend rejected the call: unknown or inactive provider record, provider error, quota or content filter. Check the provider record and the backend logs. |
LLM Invocation Error: empty response from backend (<transport error>) | error | Sync mode: the HTTP call to the backend failed (network error, non-2xx status or timeout). Long prompts often hit the request timeout; switch to invocation_mode: "stream". |
RemoteApiService.stream: idle timeout after <timeout_ms>ms | error | Stream mode: no chunk arrived within timeout_ms. A failed stream request shows RemoteApiService.stream: HTTP <status> — <body> instead. |
Input contract
-
textstring Required -
Text to detect the language of.
Output contract
-
primary_languagestring Optional -
Full name of the detected language.
-
primary_language_codestring Optional -
ISO 639-1 code of the primary language.
-
confidencenumber Optional -
Confidence score (0-1) for the primary language.
-
all_languagesarray Optional -
All detected languages with codes, confidence, and percentage.
-
is_multilingualboolean Optional -
True if multiple languages were detected.
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.language",
"name": "Detect Language",
"category": "ai",
"version": "1.0.0",
"description": "Detects the language or languages present in a text with confidence scores. Supports multi-language content detection and returns ISO 639-1 language codes.",
"capabilities": [
"ai",
"nlp",
"language-detection"
],
"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
},
"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": "Text to detect the language of."
}
},
"required": [
"text"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"primary_language": {
"type": "string",
"description": "Full name of the detected language."
},
"primary_language_code": {
"type": "string",
"description": "ISO 639-1 code of the primary language."
},
"confidence": {
"type": "number",
"description": "Confidence score (0-1) for the primary language."
},
"all_languages": {
"type": "array",
"description": "All detected languages with codes, confidence, and percentage."
},
"is_multilingual": {
"type": "boolean",
"description": "True if multiple languages were detected."
}
}
},
"ports": [
{
"port_id": "success",
"label": "Detected",
"description": "Language detected successfully.",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Detection failed.",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "async",
"tags": [
"ai",
"nlp",
"language",
"detection"
],
"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 `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
},
"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
}
}
}
}
}{
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Text to detect the language of."
}
},
"required": [
"text"
]
}{
"type": "object",
"properties": {
"primary_language": {
"type": "string",
"description": "Full name of the detected language."
},
"primary_language_code": {
"type": "string",
"description": "ISO 639-1 code of the primary language."
},
"confidence": {
"type": "number",
"description": "Confidence score (0-1) for the primary language."
},
"all_languages": {
"type": "array",
"description": "All detected languages with codes, confidence, and percentage."
},
"is_multilingual": {
"type": "boolean",
"description": "True if multiple languages were detected."
}
}
}[
{
"port_id": "success",
"label": "Detected",
"description": "Language detected successfully.",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Detection failed.",
"is_default": false,
"supports_condition": false
}
]Execution
- Execution
async- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
ainlplanguage-detection- Tags
ainlplanguagedetection
Notes and limits
- When
textis empty, the worker falls back toinput, which at runtime is always the whole upstream payload object. The missing-text check therefore never fires and the object is sent to the model as the message. Always maptextexplicitly. - The whole text is sent to the model. For a cheap, model-free detection on extracted documents,
ai.multimodal.extract.text.cascade-pipelinealready reportsmetadata.language. - The worker returns
rawnext todata; the engine keeps onlydataas the node output, sorawis not available downstream. - The model call goes through the Sommatic AI backend, which resolves the provider record named by
llm_provider_id(endpoint, credentials, deployment); the orchestrator never holds provider keys.invocation_mode: "sync"(default) waits for the full answer;"stream"reads it as server-sent events and joins the chunks. timeout_msonly takes effect in stream mode, as the idle time allowed between chunks (default 600000). In sync mode the value is logged but not applied to the HTTP request, so the platform's default request timeout governs.- In stream mode the backend endpoint does not apply sampling settings, so the fixed
temperature: 0only takes effect in sync mode. - No automatic retries: the engine does not honour
execution.retryOnFail,maxTriesorwaitBetweenTriesfor this node; a failed call goes straight toerror.
Reviewed against the orchestrator code · 31e874b · 2026-11-26