此存储库包含 IBM watsonx、IBM 专为业务构建的 AI 和数据平台的演示。
此存储库中的示例 AI 应用程序利用以下主要组件:
作为示例场景,使用电信公司的客户服务。人工代理与客户交谈以解决他们的问题。人类代理在数字代理的支持下,尽可能地自动化必要的修复。
以下是与遇到 Wi-Fi 路由器问题的客户的对话记录:
John (Teltop Customer Care Agent): Hello, this is John from Teltop customer care. How
can I assist you today?
Mary (Disappointed Subscriber): Hi John, it's Mary again. I've been having a nightmare
with your service. My home Wi-Fi is acting up, and the TV service over fiber is
terrible.
John: I'm sorry to hear about the troubles you're facing at home, Mary. Let's address
these issues. Can you please provide me with your account number or the phone number
associated with your account?
Mary: Sure, it's 123-555-1234.
[...]
John: Mary, it appears there are some issues with your router. We need to update the
router software.
本例中,可以实现路由器软件的远程自动更新。如果成功完成,邮件将发送给客户。
电话转录可以通过语音转文本服务完成。该资产涵盖以下三个按顺序执行的步骤。为了更新路由器和发送邮件,需要调用工具。
让我们更详细地看看步骤 (2)。如果记录摘要包含“路由器更新”作为纠正措施,则代理了解它必须调用一个以客户电话号码作为输入的工具。
Agent UpdateRouterIfNecessary LLM Output:
{
generated_text: 'Question: Update the router for Mary (123-555-1234) based on the
transcript summary.n' +
'Thought: I need to update the router for Mary (123-555-1234) based on the
transcript summary, so I will use the RouterUpdate tool.n' +
'Tool Name: RouterUpdaten' +
'Tool Caption: Updating router software for Mary (123-555-1234)n' +
'Tool Input: {"phoneNumber":"123-555-1234"}n' +
'Tool Output: ',
generated_token_count: 4465,
input_token_count: 1271,
stop_reason: 'not_finished'
}
这些代理已通过 TypeScript 中的 Bee Agent 框架实现。该框架由 IBM Research 构建,并以开源形式提供。以下代码片段显示了调用大语言模型时放入提示中的路由器工具的定义。
export class RouterUpdateTool extends Tool <
RouterUpdateToolOutput , RouterUpdateToolOptions , RouterUpdateToolRunOptions > {
name = "RouterUpdate" ;
description = "Updates the software of routers remotely for a subscriber " +
"with a certain phone number." ;
inputSchema ( ) {
return z . object ( {
phoneNumber : z
. string ( { description : `Phone number of a subscriber, for example '123-456-7890'` } )
. min ( 1 )
. max ( 40 ) ,
} ) ;
}
代理不会幻觉工具输出,而是在“工具输出:”之后停止来自 LLM 的流并执行该工具。
Agent UpdateRouterIfNecessary (tool_input) ? : {"phoneNumber":"123-555-1234"}
Input to Router Update tool - phoneNumber: 123-555-1234
Agent UpdateRouterIfNecessary (tool_output) ? : {"success":"true",
"text":"Router has been updated"}
存在实现相同场景的三种不同流程。
代理应用程序可以作为独立的 TypeScript 应用程序运行,例如在本地用于开发目的。此外,watsonx Orchestrate 可用于调用这三个步骤并在步骤之间传递上下文。
当选择“对用户隐藏此表单”时,将执行完整的流程,例如在 Orchestrate 聊天客户端中或通过 API。
总结一下成绩单,可以使用更大的模型 LLama 3.1 70b 在 watsonx.ai 上运行。为了实现更快的响应时间并节省运行模型的成本,可以对较小的模型进行微调。
InstructLab 是由 Red Hat 和 IBM Research 领导的一项开源计划。除了能够微调生成式人工智能模型之外,它还支持生成综合数据,从而减少需要的真实数据。
例如,InstructLab 可以根据 yaml 文件中定义的少量真实样本生成更多样本转录(上下文)。
version : 3
task_description : >-
Summarization of phone call transcripts between human agents
and clients of a telecommunication service provider about
technical issues.
created_by : nheidloff
seed_examples :
- context : >-
John (Teltop Customer Care Agent): Hello, this is John from Teltop customer
care. How can I assist you today?nnMary (Disappointed Subscriber): Hi
John, it'''s Mary. I'''ve been having a nightmare with your service.
My home Wi-Fi is acting up, and the TV service over fiber is terrible.
nnJohn: I'm sorry to hear about the troubles you're facing at home, Mary.
Let's address these issues. Can you please provide me with your account number
or the phone number associated with your account??nnMary: Sure, it'''s
123-555-1234. [...]
nnJohn: Mary, it appears there are some issues with your router. We need
to update the router software. [...]
question: >-
Summarize the transcript of the call. Identify the agent and the
subscriber. Add any specific issues mentioned by the subscriber. Add any
corrective actions taken as directed by the agent. Please mention if the
issue is resolved. Mention any follow-up actions and timelines. List the
phone number of the subscriber at the end.
answer: >-
**Agent:** Miken**Subscriber:** Saran [...]
**Corrective Actions:** Router software update [...]
**Subscriber's Phone Number:** 123-555-1234
以下代码片段显示了一些示例输出。同样,InstructLab 可以生成和评估摘要(答案)。
[Start of Context]
Raj (Customer Care Agent): Hello, this is Raj from customer care. How can I assist
you today?
Samantha (Customer): Hi Raj, I'm having trouble with my internet connection. It's
been really slow lately [cut ... cut]
[End of Context]
自定义基础模型和来自 HuggingFace 的模型可以导入并部署在 watsonx.ai 上。
为了评估基础模型,watsonx.governance 提供了使用各种现成指标和自定义指标来监控模型的机制。
git clone https://github.com/IBM/watsonx-ai-platform-demos
cd watsonx-demos/applications/application
cp .env.template .env
# define WATSONX_API_KEY and WATSONX_PROJECT_ID
yarn install
yarn start:appOneLLMTwoAgents
有关更多信息,请参阅应用程序文档。
此存储库的演示已由 IBM DACH CSM 团队与 Tech Sales 合作实施。