本页内容
Sommatic 文档
打开控制台

Azure - AI Speech

使用 Microsoft Azure AI Speech 对音频流执行生产级自动语音识别(ASR)。

以 Markdown 查看
在以下应用中打开
集成 可用 integrations.microsoft.azure.speech 版本 1.0.0 执行方式: async

使用你自己的 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 中返回每个片段的起止时间戳,可用于字幕、章节划分和证据定位。

工作原理

  1. 解析节点配置。先从配置、再从输入项读取 content_base64 或 file_path;必须提供 connection_id 和二者之一。
  2. 在服务端解析凭据:密钥中必须包含 apiKey(或 api_key),region 从凭据配置或密钥中读取。
  3. 启动 Python 进程。base64 内容会写入临时文件 audio.wav;已存在的 file_path 会被直接使用。
  4. 设置了 language 时按该语言进行连续识别。启用 diarization.enabled 时使用会话转写器,并为每个分段标注 speaker。
  5. 生成 { 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
    }
  }
}

配置

connection_id string 必填

包含 Azure AI Speech 资源 region + api-key 的连接凭据。

language string 可选 支持表达式

BCP-47 语言区域(例如 es-CO、en-US、pt-BR、fr-FR)。留空则自动检测。

diarization object 可选
enabled boolean 可选

启用说话人分离(ConversationTranscriber)。

默认值: false

custom_vocabulary array<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 返回的路径,依据“端口”一节所示的输出。

表达式EditorWorker
$("Azure - AI Speech").item.json.textstring= "Good morning, I am calling about order 123."
$("Azure - AI Speech").item.json.charsnumber= 43
$("Azure - AI Speech").item.json.emptyboolean= false
$("Azure - AI Speech").item.json.methodstring= "azure-speech-diarized"
$("Azure - AI Speech").item.json.metadataobject= {…}
$("Azure - AI Speech").item.json.segmentsarray= […] (1)
$("Azure - AI Speech").item.json.speakersarray= […] (1)
$("Azure - AI Speech").item.json.metadata.languagestring编辑器不提示= "en-US"—
$("Azure - AI Speech").item.json.metadata.regionstring编辑器不提示= "eastus"—
$("Azure - AI Speech").item.json.metadata.diarization_enabledboolean编辑器不提示= true—
$("Azure - AI Speech").item.json.metadata.segments_countnumber编辑器不提示= 1—
$("Azure - AI Speech").item.json.metadata.speakers_countnumber编辑器不提示= 1—

— 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_base64 string 可选
file_path string 可选

输出契约

text string 可选
chars number 可选
empty boolean 可选
method string 可选
metadata object 可选
segments array 可选
speakers array 可选

契约(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
    }
  }
}

执行

执行方式
async
有状态
否
重试(retryOnFail)
否
凭据
在服务器端根据 connection_id 解析,密钥不会进入工作流。
能力
speechasrtranscriptiondiarizationazurecloud
标签
azurespeechasrdiarization

说明与限制

  • 音频按 WAV 文件读取。请在本节点之前将其他格式(MP3、OGG)转换为 WAV。
  • start_ms 和 duration_ms 的单位为毫秒。speakers 列出每个说话人 ID 及其分段索引。
  • 在某台主机上首次运行时会安装 Python 依赖,可能需要数分钟。Azure 用量计入你自己的资源。

已对照编排器代码核实 · 31e874b · 2026-11-26

安装智能体工具

为你的编程智能体接入 Sommatic AI 官方文档:技能包、文档 MCP 服务器与 Markdown 页面,无需再抓取网页。

安装 Sommatic AI CLI,并为检测到的智能体配置合适的插件。

npx @sommatic/cli agent setup
智能体如何读取本文档