byted-las-asr-pro
ASR / STT / speech recognition / voice recognition engine powered by Volcengine LAS. Transcribes and converts speech to text from audio and video files — extracts spoken words and generates text transcription from any recording. Supports dictation, subtitle and caption generation. Handles meeting recordings, interview transcription, podcast transcription, lecture transcription. Features speaker diarization and speaker identification, emotion recognition, sentiment detection, gender recognition, and multilingual auto-detection. Accepts wav, mp3, m4a formats with async submit-poll workflow and batch processing.
Saker · 用法翻译
Install · 安装
claude skill add byted-las-asr-pro --from https://github.com/volcengine/agentkit-samples/tree/main/skills/byted-las-asr-pro
Skill 文档 · 原文
LAS 语音识别(las_asr_pro)
支持将音频/视频转写为文字,可选说话人分离、情绪/性别识别、多语种自动识别。
设计模式
本 skill 主要采用:
- Tool Wrapper:封装
lasutilCLI 调用 - Pipeline:包含 Step 0 -> Step N 的顺序工作流
核心 API 与配置
- 算子 ID:
las_asr_pro - API: 异步(
submit->poll) - 环境变量:
LAS_API_KEY(必填)
Gotchas
- 格式易错:
audio.format必须是容器格式(wav/mp3/m4a),非编码格式。不确定时用ffprobe确认。 - 密钥安全:若聊天框屏蔽密钥,让用户在当前目录创建
env.sh并写入export LAS_API_KEY="...",SDK 会自动读取。 - 免责声明:最终回复结果时必须包含:"本方式的计费均为预估计费,与实际费用有差距,实际费用以运行后火山产生的账单为准。计费说明请参考 Volcengine LAS 定价。",且禁止使用"实际费用"字眼描述预估价。
工作流(严格按步骤执行)
执行进度:
- [ ] Step 0: 前置检查
- [ ] Step 1: 初始化与准备
- [ ] Step 2: 预估价格
- [ ] Step 3: 提交任务
- [ ] Step 4: 异步查询
- [ ] Step 5: 结果呈现Step 0: 前置检查(必须在第一轮对话中完成)
- 检查 `LAS_API_KEY` 与 `LAS_REGION`:确认环境变量或
.env中是否已配置。 - 检查输入路径:如果用户要求处理的是本地文件,则需要先通过 File API 上传至 TOS。
- 确认无误后:才能进入下一步。
Step 1: 初始化与准备
source "$(dirname "$0")/scripts/env_init.sh" las_asr_pro
workdir=$LAS_WORKDIR- 处理本地文件时:先本地检查格式和时长,预估价格,用户确认后再上传:
``bash ./scripts/check_format.sh <local_path> ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:noprint_section=1 <local_path> ` 计算预估价格并等待用户确认后,再执行上传: `bash lasutil file-upload <local_path> ``
Step 2: 预估价格(必须获得用户确认)
- 读取 references/prices.md 获取最新计费标准。
- 优先本地获取时长:
``bash duration_sec=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:noprint_section=1 <local_path>) `` 如果 ffprobe 失败,再使用 lasutil 远程获取。
- 根据时长和模型单价计算总价,将计费单价与预估总价一并告知用户并强制暂停执行。
Step 3: 提交任务 (Submit)
构造基础 data.json(仅需必填项,其他按需添加):
{
"audio": {"url": "<presigned_url>", "format": "wav"},
"request": {"model_name": "bigmodel"}
}data=$(cat "$workdir/data.json")
lasutil submit las_asr_pro "$data" > "$workdir/submit.json"Step 4: 异步查询 (Poll)
使用优化的后台轮询脚本(动态间隔 + 自动提取结果):
mkdir -p "./output/{task_id}"
./scripts/poll_background.sh {task_id} "./output/{task_id}" & disown脚本特性:
- 动态间隔:前 5 次 30s,5-10 次 60s,10 次后 120s
- 自动提取:完成后自动生成
transcript.txt/utterances.json/utterances.csv - 日志记录:完整轮询历史保存在
poll.log
手动查询:
lasutil poll las_asr_pro {task_id} > "./output/{task_id}/result.json"Step 5: 结果呈现
自动生成结果展示:
./scripts/generate_result.md.sh {task_id} "./output/{task_id}" <estimated_price>输出文件结构:
./output/{task_id}/
result.json # 完整 API 响应
transcript.txt # 完整识别文本
utterances.json # 分句原始数据
utterances.csv # 分句说话人 CSV向用户展示:
- 使用生成的 markdown 模板
- 展示前 500 字转写文本
- 提供本地文件路径
- 提供签名下载链接(如上传成功)
- 计费声明已自动包含在模板中
审查标准
执行完成后,Agent 应自检:
- 环境变量是否正确配置
- 输入文件是否成功上传
- 输出结果是否正确呈现给用户
- 计费声明是否包含
Related · 同类技能
byted-voice-to-text
语音转文字(ASR)。使用火山引擎 BigModel ASR 识别语音,包含极速版(≤2h/100MB 同步快速返回)和标准版(≤5h 异步识别)两种模式。支持飞书语音消息、本地音频文件及音频 URL。当收到语音消息或音频附件(.ogg/.mp3/.wav)时使用本技能。
whisper
OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification…