最有用的知识是以英语书写并数字化的。而大多数需要这些知识的人,是用自己的区域语言(如印地语、泰米尔语、泰卢固语、古吉拉特语、马拉地语等)进行思考和交流的。许多人更愿意说话而不是打字。
我们构建了一个小型语音助手来弥合这一差距,使用 CUGA 作为智能体框架。本文介绍了该用例以及我们的经验教训。你可以在 CUGA Apps 中亲自尝试。
用例:农场助手
一位农民用他自己的语言大声提问:如何区分好种子和坏种子?智能体执行以下操作:
聆听并将语音转换为文本。
搜索一本 154 页的农业手册,该手册是用英语编写的。
用提问时的语言回答两到四句话,且仅依据手册内容作答。
将答案朗读出来并显示源页面,以便核实答案。
如果有人询问板球或编程,它会礼貌地将话题引导回农业,而不是编造内容。
CUGA 的定位
CUGA(ConfigUrable Generalist Agent,可配置通用智能体)是 IBM Research 发布的开源智能体框架。它处理模型连接、工具管理、状态和护栏,让你只需编写工具和提示词,而无需构建智能体循环。在此,我们将其作为嵌入式 SDK 集成在一个小型 Web 应用中,用于实现三个功能:
一个智能体,适配任何模型。通过一项设置即可在 watsonx 和 OpenAI 之间切换。
知识引擎。解析 PDF、分块、嵌入并在本地使用 agent.knowledge.search() 进行搜索。
对话线程。每个问题都获得一个全新的线程,确保一个人的语言或上下文绝不会泄露给其他人。
核心设计理念很简单:CUGA 是一个“文本输入、文本输出”的大脑。语音只是包裹在其外的两个薄层。
音频 ──▶ 语音转文本 ──▶ knowledge.search ──▶ CUGA(基于事实的答案) ──▶ 文本转语音 ──▶ 音频
由于智能体始终只看到文本,你可以先用纯文本构建和测试它,然后再添加“耳朵”和“嘴巴”。你也可以在不触碰智能体的情况下更换语音提供商。我们支持两种方案:Sarvam AI 的云端语音 API(直接从用户浏览器调用),以及在自有服务器上运行的开源模型(SraVaani 用于语音转文本,Svara 用于文本转语音)。
难点不在语音
添加语音是容易的部分。难点在于跨语言检索:一个印地语问题必须找到对应的英语段落。
搜索的工作原理是将文本转换为向量并查找最近的向量。CUGA 默认的嵌入模型仅支持英语,因此它将印地语转换为几乎不携带任何意义的向量。使用它时,一个印地语或泰米尔语问题仍能检索出五个段落,但都是错误的。由于模型被正确指示仅根据提供的内容作答,它会安静地回答“手册未涵盖此内容”。每一层都表现正常,因此没有错误也没有警告。
解决方案是使用多语言嵌入模型(我们使用的是 intfloat/multilingual-e5-large),这样无论使用何种语言,相同的含义都会落在相同的位置。概念上很简单,但将其集成到 CUGA 中需要一个小技巧(教程中已展示)。之后,一份英文文档即可服务于所有语言,你无需任何翻译副本。
我们的建议:在微调任何提示词之前,先用非英语向你的智能体提问一个问题,并检查它是否找到了正确的页面。
让声音自然并保持安全
一些看似微小的决定比我们要预想的更为重要:
为耳朵写作。Markdown 格式、项目符号、引用标签以及括号内的翻译(如“millet (बाजरा)”)在朗读时听起来都很别扭。提示词要求模型不要生成这些内容,并且有一个轻量级格式化程序会在语音合成前清除任何漏网之鱼。
保持护栏低成本。简单的输入检查可以拦截明显的离题问题。如果有个别问题通过检查,模型会在回复开头加上 OFF_TOPIC ,应用随即切换为礼貌的引导语。无需进行第二次 LLM 调用,因此语音路径保持快速。
确保每个回答都有据可依。模型仅能看到检索到的段落,并被指示不使用外部知识,同时向用户展示页面来源。
将密钥保留在服务器之外。使用 Sarvam 选项时,浏览器直接与 Sarvam 通信。服务器仅接收文本,永远不会看到用户的密钥。
试一试
您无需进行任何设置即可看到其运作效果。打开 Hugging Face Spaces 上 CUGA Apps 中的语音代理,用您的语言提出一个农业问题,然后聆听回答:
Hugging Face 上的 CUGA Apps →
想自己构建一个?我们的分步教程《使用 CUGA 构建印度语系语音代理》从一个空文件夹开始,逐步添加每一层。
超越农业:为 Bharat 扩展规模
这里没有任何内容专门针对农业。将手册替换为方案文档、健康建议或法律指南,您就得到了一个不同的助手。更换语音提供商即可改变部署模式,例如为了速度使用云端,或为了数据主权使用本地部署,而无需重写代理程序。
以语音为首的多语言助手是数字服务能够触达那些从未被纯英文文本屏幕良好服务的用户的方式。在开放、可审计的框架上构建它们,并将回答与用户可以核查的来源绑定,是赢得信任的方式。
这种方法正好位于我们正在构建的 IBM Bharat Core 的核心交汇点。Bharat Core 是一个优化的 AI 堆栈,建立在 IBM Sovereign Core 之上,专为印度生态系统设计,旨在本地基础设施上安全运行印度语系 AI 工作负载。当将语音代理从原型扩展到安全的企业应用程序(如本土化 KYC 系统或多语言政府机器人)时,您需要对数据主权有更强的控制力。通过将 CUGA 灵活的代理框架与 Bharat Core 即插即用的印度语系连接器和微调模型相结合,开发人员可以构建完全合规、拥有数据主权的 AI 解决方案,以量身定制的方式满足印度独特的语言多样性需求。
如果您正在大规模地为印度构建应用,请查看 IBM Bharat Core 正在进行的工作。
了解更多关于 CUGA 的信息
初次接触 CUGA?以下是一些入门途径:
您可以在浏览器中尝试的空间:
CUGA Agent:运行在演示 CRM 场景上的通用代理。
CUGA Apps:从一个仪表板启动可用的 CUGA 应用。
CUGA Policy Playground:并排展示两个实时代理,一个带有策略,一个没有。
Hugging Face 博客上更多关于 CUGA 的文章:
Most useful knowledge is written and digitized in English. Most of the people who need it speak, and think, in their own regional languages like Hindi, Tamil, Telugu, Gujarati, Marathi and many others. Many would rather talk than type.
We built a small voice agent to close that gap, using CUGA as the agent harness. This post explains the use case and what we learned. You can try it yourself in CUGA Apps .
The use case: a Farm Assistant
A farmer asks a question aloud, in their own language: how do I tell good seed from bad? The agent:
Listens and turns the speech into text.
Searches a 154-page agricultural handbook, which is written in English.
Answers in two to four spoken sentences, in the language the question was asked in, using only what the handbook says.
Speaks the answer back and shows the source pages, so the answer can be checked.
If someone asks about cricket or coding, it politely steers them back to farming instead of making something up.
Where CUGA fits
CUGA (ConfigUrable Generalist Agent) is IBM Research's open-source agent harness. It handles the model wiring, tool management, state and guardrails, so you write tools and a prompt instead of the agent loop. Here we use it as an embedded SDK inside a small web app, for three things:
One agent, any model. Switch between watsonx and OpenAI with one setting.
The knowledge engine. Parse a PDF, chunk it, embed it, and search it locally with agent.knowledge.search() .
Conversation threads. Each question gets a fresh thread, so one person's language or context never leaks into another's.
The key design idea is simple: CUGA is a text-in, text-out brain. Voice is two thin layers around it.
audio ──▶ speech-to-text ──▶ knowledge.search ──▶ CUGA (grounded answer) ──▶ text-to-speech ──▶ audio
Because the agent only ever sees text, you can build and test it with plain text first, then add the ears and the mouth. You can also swap speech providers without touching the agent. We support two: Sarvam AI's cloud speech APIs, called directly from the user's browser, and open-source models (SraVaani for speech-to-text, Svara for text-to-speech) running on your own server.
The hard part is not the voice
Adding speech is the easy part. The hard part is cross-lingual retrieval : a Hindi question has to find an English paragraph.
Search works by turning text into vectors and finding the nearest ones. CUGA's default embedding model is English-only, so it turns Hindi into vectors that carry almost no meaning. With it, a Hindi or Tamil question still retrieves five passages, but they are the wrong ones. The model, correctly told to answer only from what it was given, quietly says "the handbook doesn't cover that". Every layer behaves correctly, so there is no error and no warning.
The fix is to use a multilingual embedding model (we use intfloat/multilingual-e5-large ), so the same meaning lands in the same place whatever the language. Conceptually simple, though wiring it into CUGA took a small workaround (shown in the tutorial). After that, one English document serves every language, and you do not need translated copies of anything.
Our advice: before you tune a single prompt, ask your agent one question in a non-English language and check that it finds the right pages.
Making it sound right and keeping it safe
A few small decisions mattered more than we expected:
Write for the ear. Markdown, bullet points, citation tags and bracketed translations such as "millet (बाजरा)" all sound wrong when read aloud. The prompt asks the model not to produce them, and a light formatter strips any that slip through before speech.
Keep guardrails cheap. Simple input checks catch obvious off-topic questions. If one gets through, the model starts its reply with OFF_TOPIC , and the app swaps in a polite redirect. No second LLM call, so the voice path stays fast.
Ground every answer. The model sees only the retrieved passages, is told not to use outside knowledge, and the page sources are shown to the user.
Keep keys out of the server. With the Sarvam option, the browser talks to Sarvam directly. The server receives only text and never sees the user's key.
Try it
You do not need to set anything up to see it work. Open the voice agent in CUGA Apps on Hugging Face Spaces, ask a farming question in your language, and listen to the answer:
CUGA Apps on Hugging Face →
Want to build one yourself? Our step-by-step tutorial, Build an Indic Voice Agent with CUGA , starts from an empty folder and adds each layer in turn.
Beyond farming: Scaling for Bharat
Nothing here is specific to agriculture. Swap the handbook for scheme documents, health advisories, or legal guides, and you have a different assistant. Swap the speech provider and you change the deployment model, such as cloud for speed or on-premises for data sovereignty, without rewriting the agent.
Voice-first, multilingual assistants are how digital services can reach people who were never served well by English-only text screens. Building them on an open, auditable harness, with answers tied to sources people can check, is how they earn trust.
This approach sits precisely at the intersection of what we are building with IBM Bharat Core. Bharat Core is an optimized AI stack built on top of IBM Sovereign Core, designed specifically for the Indian ecosystem to run Indic AI workloads securely on local infrastructure. When scaling a voice agent from a prototype to a secure enterprise application (like a vernacular KYC system or multilingual government bot), you need greater control over data sovereignty. By pairing CUGA’s flexible agent harness with Bharat Core’s ready-to-deploy Indic connectors and fine-tuned models, developers can build fully compliant, sovereign AI solutions tailored to India's unique linguistic diversity.
If you are building for India at scale, see the work happening at IBM Bharat Core .
Learn more about CUGA
New to CUGA? Here are some places to start:
Spaces you can try in your browser:
CUGA Agent : the general-purpose agent, running on a demo CRM scenario.
CUGA Apps : launch working CUGA apps from one dashboard.
CUGA Policy Playground : two live agents side by side, one with policies and one without.
More CUGA posts on the Hugging Face blog:
首次收录 · 2026-11-26 · 10.38 分