← 返回案例库
CUSTOMER STORY · 企业知识库怎么搭

自己搭电话语音智能体:响应时间从 1.7 秒压到 0.4 秒

Build a phone voice agent that answers in under half a second

Tools · 使用工具未注明
Source · 来源原作者 · ntik.me
Zaowuyun · 可参考能力资产库 + 上下文管理
01

谁在用

Who

一位开发语音智能体的工程师。

02

遇到什么问题

Challenge

电话 AI 反应慢会让通话很别扭,现成平台的延迟难以优化。

03

怎么用 AI 解决

Solution
  1. 用 FastAPI 服务器通过 WebSocket 接收 Twilio 音频,交给 Deepgram 转写并判断说话轮次。
  2. 轮次结束后把文字交给大模型,生成的内容流式送进 ElevenLabs 语音合成,再直接回传 Twilio。
  3. 用户插话时取消生成并清空缓冲;语音合成连接保持预热。
04

结果如何

Results据原作者自述
  • 本地运行延迟约 1.7 秒,部署到欧洲后约 790 毫秒,略优于 Vapi 的约 840 毫秒
  • 换用 Groq 的 llama-3.3-70b 后约 400 毫秒;搭建约一天,花费约 100 美元 API 额度

以上内容均由原作者自行报告,未经独立核实,也不代表造物云产品的效果。

05

提示词

Prompt

参考提示词(由 agentusecases.ai 整理为模板,非原帖原文)

中文

帮我用【语言,例如 Python】为【用途,例如牙科诊所接听电话】做一个电话语音智能体,采用流式语音转文字、大模型和流式文字转语音,目标是 500 毫秒内响应,并能顺畅处理插话。先搭好框架。

ENGLISH

Help me build a phone voice agent in [language, e.g. Python] for [use case, e.g. answering calls for a dental office] using streaming speech-to-text, an LLM, and streaming text-to-speech, with the goal of responding in under 500ms and handling interruptions cleanly. Scaffold the project, wire up [providers, e.g. Deepgram, an LLM API, ElevenLabs, Twilio], and add latency logging. Finish when a test call works and the log shows average latency; ask before making any real phone calls or purchasing numbers.