您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

什么是 AI 代理?What are AI agents?

AI 代理是用于实现预定目标的代码或机制。AI agents are code or mechanisms which act to achieve predetermined goals. AI 代理的示例可在以下代码中找到:聊天 bot、智能家庭和财务中使用的编程贸易软件。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 机器人服务和机器人框架是平台的示例,可用于构建这些 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. 许多组织都有战略地在其客户花费时间的相同消息传递平台中提供机器人。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

生成机器人Build a bot

Azure 机器人服务和机器人框架提供了一组集成的工具和服务,帮助创建所需的 AI 代理。Azure Bot Service and Bot Framework offer an integrated set of tools and services to help create the AI agent you need. 选择你最喜爱的开发环境或命令行工具来创建机器人。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. 我们提供适合各个机器人开发阶段的工具,方便你设计和生成机器人。We provide tools for various stages of bot development to help you design and build bots.

显示用于各个 bot 开发阶段的工具的关系图。

计划Plan

充分了解目标、流程和用户需求,这对于创建成功机器人的过程很重要。Having a thorough understanding of the goals, processes, and user needs is important to the process of creating a successful 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 agent 时,请考虑以下方面:While you design your AI agent during the planning phase, consider these aspects:

  • 定义 bot 角色:Define bot personas:
    • 你的机器人应该是什么样子?What should your bot look like?
      • 应该如何命名它?What should it be named?
      • 机器人的个性有哪些?What's your bot's personality? 它是否有性别?Does it have a gender?
      • 机器人如何处理困难的情况和问题?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?

若要了解有关如何设计机器人的详细信息,请参阅 机器人设计原则To learn more about how to design your bot, see Principles of bot design.

构建Build

机器人是一项 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. 机器人框架服务是 Azure Bot 服务和 Bot 框架的组件之一。The Bot Framework Service is one of the components of Azure Bot Service and Bot Framework. 可在任意数目的环境和语言中创建机器人。You can create bots in any number of environments and languages. 可在 Azure 门户 中启动机器人开发,或使用 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 机器人服务和机器人框架的一部分,我们提供了可用于扩展机器人功能的其他组件。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 机器人服务和机器人框架,你可以自信地构建机器人。With the Azure Bot Service and Bot Framework, you can build a bot with confidence and speed.

FeatureFeature 说明Description 链接Link
添加自然语言处理Add natural language processing 使机器人能够理解自然语言,了解拼写错误,使用语音,并识别用户的意图。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),请智能地确定在机器人会话期间使用哪一种模型。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 工具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 机器人服务文档For more information, see the Azure Bot Service documentation.

测试Test

机器人是包含许多不同部件的复杂应用程序。Bots are complex applications with many different parts that work together. 与任何其他复杂的应用程序一样,这种复杂性可能会导致一些有趣的 bug,或者使机器人的行为与预期的行为不同。Like any other complex application, this complexity can lead to some interesting bugs or cause your bot to behave differently than expected. 在发布机器人之前,请对其进行测试。Before you publish your bot, test it. 我们提供了多种方法来测试 bot,然后再将其发布到使用:We provide several ways to test bots before they're released for use:

  • 使用模拟器在本地测试机器人。Test your bot locally with the emulator. 机器人框架模拟器是独立的应用程序,不仅提供聊天界面,还提供调试和进行工具,帮助您了解机器人的操作方式和原因。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. 此模拟器可以在本地与正在开发的机器人应用程序一起运行。The emulator can be run locally alongside your in-development bot application.
  • Web 上测试机器人。Test your bot on the web. 通过 Azure 门户配置机器人后,还可以通过 web 聊天界面访问该机器人。After your bot is configured through the Azure portal, it can also be reached through a web chat interface. Web 聊天界面是向不能直接访问正在运行的代码的测试人员和其他人授予机器人访问权限的好方法。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.
  • 单元测试机器人 Framework SDK 的7月更新。Unit test your bot with the July update of the Bot Framework SDK.

发布Publish

当你准备好将你的机器人提供给 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. 在公共 internet 上具有地址是使机器人在你的站点上或在聊天频道内生活的第一步。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

将机器人连接到 Facebook、Messenger、Kik、Skype、时差、Microsoft 团队、Telegram、文本/短信、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 does most of the work necessary to send and receive messages from all of these different platforms. 机器人应用程序会收到统一的规范化消息流,无论其连接到的通道的数量和类型如何。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 门户中收集的数据来确定提高机器人功能和性能的机会。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:

  • 知识库: 知识机器人可用于提供几乎任何使用者的相关信息。Knowledge base: A knowledge bot can be designed to provide information about virtually any subject. 例如,一个知识机器人可能会回答有关 "此会议上有哪些 bot 事件?" 之类的事件的问题。For example, one knowledge bot might answer questions about events such as "what bot events are there at this conference?" 或 "when 是下一 reggae show?"Or "when is the next reggae show?" 其他机器人可能会回答与 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.

  • 移交给人: 无论机器人拥有多少 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.

    有关要交付的模式的信息,请参阅将 会话从机器人转换为人力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. 你还可以在技术支持应用程序中嵌入机器人,作为传入用户请求的第一个响应者。You could also embed a bot within a help desk application to act as the first responder to incoming user requests. 机器人可以独立解决简单问题,将更复杂的问题移交给人工处理。The bot could independently resolve simple issues and hand off more complex issues to a human agent.

    有关在应用程序中集成机器人的方式的信息,请参阅 在应用程序中嵌入机器人For 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.

    有关在网站中集成机器人的方式的信息,请参阅 在网站中嵌入机器人For information on the ways to integrate your bot within a website, see Embed a bot in a website.

后续步骤Next steps