Azure - AI Speech
使用 Microsoft Azure AI Speech 对音频流执行生产级自动语音识别(ASR)。
使用你自己的 Azure AI Speech 资源转写音频文件,可选说话人分离,返回文本及带时间戳的分段。未识别到语音时经 empty 输出。
通过 connection_id(带 region 元数据的 api-key 凭据)使用你自己的 Azure 资源进行认证;执行费用由 Azure 计入你的订阅。
操作:
- 连续识别: 通过长时识别端点处理任意时长的音频流,如会议、通话、长篇媒体。
- 说话人分离: 当
diarization.enabled为 true 时,使用 ConversationTranscriber 为每个片段标注说话人标识,并返回结构化的speakers数组。 - 自定义词表偏置: 向识别器注入短语列表,以提升人名、缩写、产品术语和行业用语的识别准确率。
- 语言区域选择: 支持 100 多个 BCP-47 区域(
es-CO、en-US、pt-BR、fr-FR等);未指定区域时,底层 API 可自动检测。 - 片段时间戳: 在
segments中返回每个片段的起止时间戳,可用于字幕、章节划分和证据定位。
工作原理
- 解析节点配置。先从配置、再从输入项读取
content_base64或file_path;必须提供connection_id和二者之一。 - 在服务端解析凭据:密钥中必须包含
apiKey(或api_key),region从凭据配置或密钥中读取。 - 启动 Python 进程。base64 内容会写入临时文件
audio.wav;已存在的file_path会被直接使用。 - 设置了
language时按该语言进行连续识别。启用diarization.enabled时使用会话转写器,并为每个分段标注speaker。 - 生成
{ text, chars, empty, method, metadata, segments, speakers };文本为空时选择empty,否则选择extracted。
在工作流中
节点在工作流文件(draft_nodes[])中的写法,以及一次成功运行的 envelope。
{
"node_id": "node-transcribe-call",
"label": "Transcribe call",
"operator_slug": "integrations.microsoft.azure.speech",
"operator_version": "1.0.0",
"config": {
"connection_id": "pi-credential-xxxx",
"language": "en-US",
"diarization": {
"enabled": true
}
}
}{
"ok": true,
"data": {
"text": "Good morning, I am calling about order 123.",
"chars": 43,
"empty": false,
"method": "azure-speech-diarized",
"metadata": {
"language": "en-US",
"region": "eastus",
"diarization_enabled": true,
"segments_count": 1,
"speakers_count": 1
},
"segments": [
{
"start_ms": 420,
"duration_ms": 2860,
"speaker": "Guest-1",
"text": "Good morning, I am calling about order 123."
}
],
"speakers": [
{
"id": "Guest-1",
"segment_indexes": [
0
]
}
]
},
"port": "extracted"
}配置
-
connection_idstring 必填 -
包含 Azure AI Speech 资源 region + api-key 的连接凭据。
-
languagestring 可选 支持表达式 -
BCP-47 语言区域(例如 es-CO、en-US、pt-BR、fr-FR)。留空则自动检测。
-
diarizationobject 可选 -
-
enabledboolean 可选 -
启用说话人分离(ConversationTranscriber)。
-
-
custom_vocabularyarray<string> 可选 -
用于让识别器偏向人名、缩写或领域术语的短语列表。
配置中会显示通用执行设置,但该节点目前不执行重试(retryOnFail、maxTries)。所有节点均未实现 continueOnFail。
代码中的行为
除 schema 描述之外,实现代码对这些键的实际处理。
-
language - 为空时不设置识别语言,采用 Speech SDK 的默认语言;worker 不会配置自动语言检测。
-
custom_vocabulary - 当前版本不生效:短语列表被附加到一个在转写开始前就被丢弃的识别器上。
-
execution - 只读取
timeout_ms(默认 900000),重试设置不会生效。
输出端口
extracted 默认 识别到语音。
{
"text": "Good morning, I am calling about order 123.",
"chars": 43,
"empty": false,
"method": "azure-speech-diarized",
"metadata": {
"language": "en-US",
"region": "eastus",
"diarization_enabled": true,
"segments_count": 1,
"speakers_count": 1
},
"segments": [
{
"start_ms": 420,
"duration_ms": 2860,
"speaker": "Guest-1",
"text": "Good morning, I am calling about order 123."
}
],
"speakers": [
{
"id": "Guest-1",
"segment_indexes": [
0
]
}
]
}empty 识别结束但没有文本。会话被取消(例如密钥无效或音频格式不受支持)时也会到达这里,因为取消只会停止识别而不会报错。
{
"text": "",
"chars": 0,
"empty": true,
"method": "azure-speech",
"metadata": {
"language": "en-US",
"region": "eastus",
"diarization_enabled": false,
"segments_count": 0,
"speakers_count": 0
},
"segments": [],
"speakers": []
}error 校验、凭据解析或 Python 进程失败。
{
"error": "connection must provide region + apiKey"
}在表达式中
后续节点可通过 $("Azure - AI Speech").item.json.<路径> 读取此节点输出中的内容(请把 Azure - AI Speech 换成你的节点标签)。Editor 标记工作流编辑器在 Previous Nodes 中提示的路径(输出契约);Worker 标记 worker 实际通过 extracted 返回的路径,依据“端口”一节所示的输出。
| 表达式 | Editor | Worker |
|---|---|---|
$("Azure - AI Speech").item.json.text | ||
$("Azure - AI Speech").item.json.chars | ||
$("Azure - AI Speech").item.json.empty | ||
$("Azure - AI Speech").item.json.method | ||
$("Azure - AI Speech").item.json.metadata | ||
$("Azure - AI Speech").item.json.segments | ||
$("Azure - AI Speech").item.json.speakers | ||
$("Azure - AI Speech").item.json.metadata.language | — | |
$("Azure - AI Speech").item.json.metadata.region | — | |
$("Azure - AI Speech").item.json.metadata.diarization_enabled | — | |
$("Azure - AI Speech").item.json.metadata.segments_count | — | |
$("Azure - AI Speech").item.json.metadata.speakers_count | — |
— Worker: worker 会返回它,但编辑器不会提示:请手动输入。对象内部的键可能取决于你的数据或配置(例如每个标签一个键)。
错误
| 消息 | 端口 | 原因与处理 |
|---|---|---|
connection_id is required. | error | 未配置凭据。 |
Either content_base64 or file_path is required. | error | 输入项中两个字段都没有。 |
connection must provide region + apiKey | error | 凭据密钥不是包含 apiKey 的对象,或未保存 region。 |
Python timed out after <ms>ms | error | 转写耗时超过 execution.timeout_ms(默认 900000)。 |
输入契约
-
content_base64string 可选 -
file_pathstring 可选
输出契约
-
textstring 可选 -
charsnumber 可选 -
emptyboolean 可选 -
methodstring 可选 -
metadataobject 可选 -
segmentsarray 可选 -
speakersarray 可选
契约(JSON Schema)
与编排器声明完全一致的定义。All 是完整的 *.definition.js;可与上方各节对照,找出文档与 schema 之间的差异。发布前可用它校验节点。
{
"slug": "integrations.microsoft.azure.speech",
"name": "Azure - AI Speech",
"category": "integrations",
"group": [
{
"key": "microsoft",
"name": "Microsoft",
"icon_url": "/icons/integrations/microsoft/microsoft.svg"
},
{
"key": "foundry",
"name": "Microsoft Foundry",
"icon_url": "/icons/integrations/microsoft/foundry.webp"
}
],
"icon_url": "/icons/integrations/microsoft/microsoft.svg",
"version": "1.0.0",
"description": "Execute production-grade Automatic Speech Recognition (ASR) on audio streams using Microsoft Azure AI Speech.\n\n Authenticates with your own Azure resource via `connection_id` (api-key credential with `region` metadata); execution costs are billed by Azure to your subscription.\n\n **Operations:**\n - **Continuous recognition:** Streams audio of any length through the long-running recognition endpoint — meetings, calls, long-form media.\n - **Speaker diarization:** When `diarization.enabled` is true, uses the ConversationTranscriber to tag each segment with a speaker identifier and return a structured `speakers` array.\n - **Custom vocabulary bias:** Phrase list injected into the recognizer to improve accuracy on names, acronyms, product terms, and jargon.\n - **Locale selection:** 100+ BCP-47 locales (`es-CO`, `en-US`, `pt-BR`, `fr-FR`, ...); auto-detection is available in the underlying API when no locale is supplied.\n - **Segment timestamps:** Per-segment start/end timestamps returned in `segments` for subtitles, chaptering, and evidence anchoring.",
"capabilities": [
"speech",
"asr",
"transcription",
"diarization",
"azure",
"cloud"
],
"config_schema": {
"type": "object",
"properties": {
"connection_id": {
"type": "string",
"title": "Azure AI Speech Credential",
"description": "Connection credential with region + api-key for your Azure AI Speech resource.",
"ui_widget": "connection_picker",
"ui_options": {
"credential_types": [
"api-key",
"object"
],
"providers": [
"azure"
]
}
},
"language": {
"type": "string",
"title": "Recognition Language",
"description": "BCP-47 locale (e.g., es-CO, en-US, pt-BR, fr-FR). Leave empty for auto-detection.",
"format": "expression"
},
"diarization": {
"type": "object",
"title": "Diarization",
"properties": {
"enabled": {
"type": "boolean",
"default": false,
"description": "Enable speaker diarization (ConversationTranscriber)."
}
}
},
"custom_vocabulary": {
"type": "array",
"title": "Custom Vocabulary",
"items": {
"type": "string"
},
"description": "Phrase list to bias the recognizer toward names, acronyms, or domain terminology."
},
"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": [
"connection_id"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"content_base64": {
"type": "string"
},
"file_path": {
"type": "string"
}
}
},
"output_contract_schema": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"chars": {
"type": "number"
},
"empty": {
"type": "boolean"
},
"method": {
"type": "string"
},
"metadata": {
"type": "object"
},
"segments": {
"type": "array"
},
"speakers": {
"type": "array"
}
}
},
"ports": [
{
"port_id": "extracted",
"label": "Transcribed",
"is_default": true,
"supports_condition": true
},
{
"port_id": "empty",
"label": "No Speech",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "async",
"required_resources": [],
"compatible_worker_pools": [
"standard-io",
"cloud-io"
],
"tags": [
"azure",
"speech",
"asr",
"diarization"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://sommatic.ai",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"connection_id": {
"type": "string",
"title": "Azure AI Speech Credential",
"description": "Connection credential with region + api-key for your Azure AI Speech resource.",
"ui_widget": "connection_picker",
"ui_options": {
"credential_types": [
"api-key",
"object"
],
"providers": [
"azure"
]
}
},
"language": {
"type": "string",
"title": "Recognition Language",
"description": "BCP-47 locale (e.g., es-CO, en-US, pt-BR, fr-FR). Leave empty for auto-detection.",
"format": "expression"
},
"diarization": {
"type": "object",
"title": "Diarization",
"properties": {
"enabled": {
"type": "boolean",
"default": false,
"description": "Enable speaker diarization (ConversationTranscriber)."
}
}
},
"custom_vocabulary": {
"type": "array",
"title": "Custom Vocabulary",
"items": {
"type": "string"
},
"description": "Phrase list to bias the recognizer toward names, acronyms, or domain terminology."
},
"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": [
"connection_id"
]
}{
"type": "object",
"properties": {
"content_base64": {
"type": "string"
},
"file_path": {
"type": "string"
}
}
}{
"type": "object",
"properties": {
"text": {
"type": "string"
},
"chars": {
"type": "number"
},
"empty": {
"type": "boolean"
},
"method": {
"type": "string"
},
"metadata": {
"type": "object"
},
"segments": {
"type": "array"
},
"speakers": {
"type": "array"
}
}
}[
{
"port_id": "extracted",
"label": "Transcribed",
"is_default": true,
"supports_condition": true
},
{
"port_id": "empty",
"label": "No Speech",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"is_default": false,
"supports_condition": false
}
]执行
- 执行方式
async- 有状态
- 否
- 重试(
retryOnFail) - 否
- 凭据
- 在服务器端根据
connection_id解析,密钥不会进入工作流。 - 能力
speechasrtranscriptiondiarizationazurecloud- 标签
azurespeechasrdiarization
说明与限制
- 音频按 WAV 文件读取。请在本节点之前将其他格式(MP3、OGG)转换为 WAV。
start_ms和duration_ms的单位为毫秒。speakers列出每个说话人 ID 及其分段索引。- 在某台主机上首次运行时会安装 Python 依赖,可能需要数分钟。Azure 用量计入你自己的资源。
已对照编排器代码核实 · 31e874b · 2026-11-26