什麼是 AI 代理程式?What are AI agents?

AI 代理程式是程式碼或機制,可達成預定的目標。AI agents are code or mechanisms which act to achieve predetermined goals. AI 代理程式的範例可在程式碼中找到,例如聊天機器人、智慧型家庭和用於財務的程式設計交易軟體。Examples of AI agents can be found in the code for things like chat bots, smart homes, and the programmatic trading software used in finance. Azure Bot Service 和 Bot Framework 是平臺範例,可用來建立這些 AI 代理程式,並將其整合到較大型的軟體應用程式。The Azure Bot Service and Bot Framework are examples of platforms that can be used to build these AI agents and integrate them into larger software applications.

使用者會透過交談式介面更多的互動,進而提供更自然的體驗,讓人們透過自然語言表達他們的需求,並快速完成工作。Users are engaging more and more with conversational interfaces, which can present a more natural experience where humans express their needs through natural language and quickly complete tasks. 對於許多公司來說,對話式 AI 應用程式逐漸成為競爭優勢。For many companies, conversational AI applications are becoming a competitive differentiator. 許多組織都有策略性地讓 bot 可在其客戶花時間的相同訊息平臺內使用。Many organizations are strategically making bots available within the same messaging platforms in which their customers spend time.

全球各地的組織都會使用交談 AI 來轉換其企業,進而提升其客戶和員工的效率與自然互動。Organizations around the world are transforming their businesses with conversational AI, which can promote more efficient and natural interactions with both their customers and their employees. 以下是一些常見的使用案例:Here are a few common use cases:

  • 客戶支援Customer support
  • 企業助理Enterprise assistant
  • 撥置中心優化Call center optimization
  • 汽車內的語音助理In-car voice assistant

建置 BotBuild a bot

Azure Bot Service 和 Bot Framework 提供一組整合的工具和服務,協助您建立所需的 AI 代理程式。Azure Bot Service and Bot Framework offer an integrated set of tools and services to help create the AI agent you need. 選擇您最愛的開發環境或命令列工具來建立您的 bot。Choose your favorite development environment or command-line tools to create your bot. C #、JavaScript、TypeScript 和 Python 都有 Sdk。SDKs exist for C#, JavaScript, TypeScript, and Python. 適用于 JAVA 的 SDK 正在開發中。The SDK for Java is under development. 我們在 Bot 各種開發階段皆提供各項工具,協助您設計及建置 Bot。We provide tools for various stages of bot development to help you design and build bots.

此圖顯示 bot 開發各階段的工具。

計畫Plan

徹底瞭解目標、處理常式和使用者需求,對於建立成功 bot 的程式非常重要。Having a thorough understanding of the goals, processes, and user needs is important to the process of creating a successful bot. 撰寫程式碼之前,請先參閱 bot 設計指導方針 ,以瞭解最佳作法,並找出 bot 的需求。Before you write code, review the bot design guidelines for best practices, and identify the needs for your bot. 您可以建立簡單的 AI 代理程式,或包含更複雜的功能,例如語音、自然語言理解和問題答案。You can create a simple AI agent or include more sophisticated capabilities such as speech, natural language understanding, and question answering.

當您在規劃階段設計 AI 代理程式時,請考慮下列層面:While you design your AI agent during the planning phase, consider these aspects:

  • 定義 bot 角色:Define bot personas:
    • 您的 bot 應該看起來像什麼?What should your bot look like?
      • 它的命名方式為何?What should it be named?
      • 聊天機器人的特質為何?What's your bot's personality? 是否有性別?Does it have a gender?
      • 您的 bot 應該如何處理困難的情況和問題?How should your bot handle difficult situations and questions?
  • 設計對話流程:Design conversation flow:
    • 您可以預期使用案例的交談類型為何?What type of conversations can you expect for your use cases?
  • 定義評估計畫:Define an evaluation plan:
    • 您要如何衡量成功?How would you measure success?
    • 您要使用哪些度量來改善您的服務?What measurements do you want to use to improve your service?

若要深入瞭解如何設計您的 bot,請參閱 bot 設計的原則To learn more about how to design your bot, see Principles of bot design.

BuildBuild

Bot 是一項 Web 服務,可實作對話式介面並透過 Bot Framework Service 進行通訊,以傳送和接收訊息和事件。Your bot is a web service that implements a conversational interface and communicates with the Bot Framework Service to send and receive messages and events. Bot Framework Service 是 Azure Bot Service 和 Bot Framework 的其中一個元件。The Bot Framework Service is one of the components of Azure Bot Service and Bot Framework. 您可以使用任意多個環境和語言建立 Bot。You can create bots in any number of environments and languages. 您可以在 Azure 入口網站 中開始進行 bot 開發,或使用 c #、JavaScript 或 Python 範本進行本機開發。You can start your bot development in the Azure portal or use C#, JavaScript, or Python templates for local development. 您也可以存取各種範例,這些範例展現許多可透過 SDK 取得的功能。You also have access to a variety of samples that showcase many of the capabilities available through the SDK. 這些範例非常適合想要有更多功能的起點的開發人員使用。These samples are great for developers who want a more feature-rich starting point.

在 Azure Bot Service 和 Bot Framework 中,我們提供您可用來擴充 Bot 功能的其他元件。As part of the Azure Bot Service and Bot Framework, we offer additional components you can use to extend the functionality of your bot. 有了 Azure Bot 服務和 Bot Framework,您就可以放心且快速地建立 Bot。With the Azure Bot Service and Bot Framework, you can build a bot with confidence and speed.

功能Feature 描述Description 連結Link
新增自然語言處理Add natural language processing 讓您的 bot 瞭解自然語言、瞭解拼寫錯誤、使用語音,以及辨識使用者的意圖。Enable your bot to understand natural language, understand spelling errors, use speech, and recognize the user's intent. 如何使用 LUISHow to use LUIS
回答問題Answer questions 加入知識庫,以回答使用者以更自然的對話方式提出的問題。Add a knowledge base to answer questions users ask in a more natural, conversational way. 如何使用 QnA MakerHow to use QnA Maker
管理多個模型Manage multiple models 如果您使用多個模型(例如 LUIS 和 QnA Maker),可在 bot 對話期間,以智慧方式判斷要使用哪一種模型。If you use more than one model, such as for LUIS and QnA Maker, intelligently determine when to use which one during your bot's conversation. 分派工具Dispatch tool
新增卡片和按鈕Add cards and buttons 使用文字以外的媒體(例如圖形、功能表和卡片)來增強使用者體驗。Enhance the user experience with media other than text, such as graphics, menus, and cards. 如何新增卡片How to add cards

注意

這份表格不是完整的清單。This table isn't a comprehensive list. 如需詳細資訊,請參閱 Azure Bot Service 檔For more information, see the Azure Bot Service documentation.

測試Test

Bot 是一種複雜的應用程式,其中有許多不同的元件可一起運作。Bots are complex applications with many different parts that work together. 如同任何其他複雜的應用程式,這種複雜性可能會導致一些有趣的錯誤,或導致您的 bot 行為與預期不同。Like any other complex application, this complexity can lead to some interesting bugs or cause your bot to behave differently than expected. 在您發佈 bot 之前,請先進行測試。Before you publish your bot, test it. 我們提供數種方式來測試 bot,然後再加以釋放以供使用:We provide several ways to test bots before they're released for use:

  • 使用模擬器在本機測試 Bot。Test your bot locally with the emulator. Bot Framework Emulator 是一個獨立的應用程式,不僅提供交談介面,還提供偵錯工具和訊問工具,協助您瞭解 Bot 的運作方式和原因。The Bot Framework Emulator is a stand-alone application that not only provides a chat interface but also debugging and interrogation tools to help you understand how and why your bot does what it does. 模擬器可以隨著開發中的 Bot 應用程式在本機執行。The emulator can be run locally alongside your in-development bot application.
  • Web 上測試您的 Bot。Test your bot on the web. 透過 Azure 入口網站設定您的 bot 之後,也可以透過網路聊天介面來觸達。After your bot is configured through the Azure portal, it can also be reached through a web chat interface. 網路聊天介面是將 bot 存取權授與給測試人員的絕佳方法,以及其他無法直接存取執行中程式碼的人員。The web chat interface is a great way to grant access to your bot to testers and other people who don't have direct access to the running code.
  • 使用 Bot Framework SDK 的七月更新對bot 進行單元測試Unit test your bot with the July update of the Bot Framework SDK.

發佈Publish

當您準備好讓 bot 可在 web 上使用時,請將 其發佈至 Azure 或您自己的 web 服務或資料中心。When you're ready to make your bot available on the web, publish it to Azure or to your own web service or datacenter. 在公用網際網路上使用位址,是在您的網站上或在聊天頻道中讓 bot 上線的第一個步驟。Having an address on the public internet is the first step to bringing your bot to life on your site or inside chat channels.

連線Connect

將您的 bot 連接到 Facebook、Messenger、Kik、Skype、時差、Microsoft 小組、Telegram、text/SMS、Twilio、Cortana 及 Skype 等通道。Connect your bot to channels such as Facebook, Messenger, Kik, Skype, Slack, Microsoft Teams, Telegram, text/SMS, Twilio, Cortana, and Skype. Bot Framework 會執行從所有這些不同平臺傳送和接收訊息所需的大部分工作。Bot Framework does most of the work necessary to send and receive messages from all of these different platforms. 您的 bot 應用程式會收到統一的正規化訊息串流,無論其所連接的通道數目和類型為何。Your bot application receives a unified, normalized stream of messages no matter number and type of channels to which it's connected. 如需如何新增通道的詳細資訊,請參閱 通道For information on how to add channels, see Channels.

評估Evaluate

使用 Azure 入口網站中收集的資料,找出提高 bot 功能和效能的機會。Use the data collected in the Azure portal to identify opportunities to improve the capabilities and performance of your bot. 您可以取得服務層級和流量、延遲與整合等檢測資料。You can get service-level and instrumentation data like traffic, latency, and integrations. 分析也提供使用者、訊息和通道資料的交談層級報告。Analytics also provide conversation-level reporting on user, message, and channel data. 如需詳細資訊,請參閱 如何收集分析For more information, see How to gather analytics.

常見使用案例的模式Patterns for common use cases

有一些常見的模式可用於執行對話式 AI 應用程式:There are common patterns used for implementation of a conversational AI application:

  • 知識庫: 知識 bot 可以設計為提供幾乎任何主旨的相關資訊。Knowledge base: A knowledge bot can be designed to provide information about virtually any subject. 例如,一個知識 bot 可以回答有關事件的問題,例如「此會議有哪些 bot 事件?」。For example, one knowledge bot might answer questions about events such as "what bot events are there at this conference?" 或 "next reggae show when?"Or "when is the next reggae show?" 另一個 bot 可能會回答與 IT 相關的問題,例如「我要如何更新我的作業系統?」Another bot might answer IT-related questions such as "how do I update my operating system?" 但另一個 bot 可能會回答「誰是 john doe?」之類的連絡人問題。Yet another bot might answer questions about contacts such as "who is john doe?" 或「什麼是 jane doe 的電子郵件地址?」Or "what is jane doe's email address?"

    如需知識 bot 設計項目的詳細資訊,請參閱 設計知識 botFor information on the design elements for knowledge bots, see Design knowledge bots.

  • 交給人類: 無論 bot 擁有多少 AI,有時可能仍需要將對話交付給人類的人。Hand off to a human: No matter how much AI a bot possesses, there might still be times when it needs to hand off the conversation to a human being. 在這種情況下,bot 應該會辨識何時需要交付,並為使用者提供順暢的轉換。In such cases, the bot should recognize when it needs to hand off and provide the user with a smooth transition.

    如需有關要交付之模式的詳細資訊,請參閱將 對話從 Bot 轉換成人類For information on the patterns to hand off, see Transition conversations from bot to human.

  • 在應用程式中內嵌 bot: 雖然 bot 最常存在於應用程式之外,但它們也可以與應用程式整合。Embed a bot in an application: Although bots most commonly exist outside of applications, they can also be integrated with applications. 例如,您可以在應用程式中內嵌 知識 bot ,以協助使用者尋找資訊。For example, you could embed a knowledge bot within an application to help users find information. 您也可以將 bot 內嵌在技術支援中心的應用程式內,作為傳入使用者要求的第一個回應者。You could also embed a bot within a help desk application to act as the first responder to incoming user requests. Bot 可以獨立解決簡單的問題,並將較為複雜的問題遞交給人類專員。The bot could independently resolve simple issues and hand off more complex issues to a human agent.

    如需如何在應用程式中整合 bot 的詳細資訊,請參閱 在應用程式中內嵌 botFor information on the ways to integrate your bot within an application, see Embed a bot in an application.

  • 將 Bot 內嵌至網站: 如同在應用程式中內嵌 bot,bot 也可以內嵌在網站內,以啟用跨通道的多種通訊模式。Embed a bot in a website: Like embedding bots in applications, bots can also be embedded within a website to enable multiple modes of communication across channels.

    如需如何在網站內整合 bot 的詳細資訊,請參閱將 Bot 內嵌在網站中For information on the ways to integrate your bot within a website, see Embed a bot in a website.

下一步Next steps