此儲存庫包含 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 合作實施。