对话型 Action 可让您为 Google 助理用户创建自定义体验或对话,从而扩展了 Google 助理的功能。在对话中,对话型 Action 会处理来自 Google 助理的请求,并返回包含音频和视觉组件的响应。对话型 Action 还可以使用网络钩子与外部 Web 服务通信,以增加对话或业务逻辑,然后再返回响应。
若要查询天气预报,您可能需要一些信息,例如用户需要天气预报的时间及其位置。不过,如前所述,不同的用户请求预测的方式可能会有所不同。Google 助理可以理解这些差异并将其转换为标准用户意图,以获取预测。然后,它可以解析用户的请求,以获取满足请求所需的相关数据。在本例中,这就是用户希望获取天气预报的时间和地点。最后,您可以使用此数据通过公共 REST API 查找天气信息,并以提示的形式将天气信息返回给用户。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eConversational Actions on Google Assistant let you create custom voice experiences for users by handling requests and returning audio/visual responses.\u003c/p\u003e\n"],["\u003cp\u003eAssistant's natural language understanding (NLU) handles language nuances, making it easier to build conversational interfaces compared to traditional structured input methods.\u003c/p\u003e\n"],["\u003cp\u003eConversational Actions are best for simple, quick tasks, or immersive, voice-forward experiences.\u003c/p\u003e\n"],["\u003cp\u003eYou can build Actions with the Actions SDK, Actions Builder, or both, offering flexibility in your development workflow.\u003c/p\u003e\n"]]],["Conversational Actions create custom Google Assistant experiences, handling user requests and returning responses with audio and visual components. Assistant manages natural language understanding, translating varied user inputs into structured intents. Actions excel in tasks requiring simple, familiar input, providing quick user benefits, or leveraging voice-first interactions. Developers can build using the Actions SDK, Actions Builder, or a mix of both, offering flexibility in development workflows. The process includes defining user intents, parsing data, and utilizing webhooks to generate customized responses.\n"],null,["# Conversational Actions extend the functionality of Google Assistant by allowing you to\ncreate custom experiences, or conversations, for users of Google\nAssistant. In a conversation, your Conversational Action handles requests from\nAssistant and returns responses with audio and visual components. Conversational Actions\ncan also communicate with external web services with webhooks for added\nconversational or business logic before returning a response.\n**Figure 1.** An example of a Conversational Action\n\nWhy build\n---------\n\nTypical computer interfaces require structured and predictable input to\nfunction properly, which makes the use of these interfaces unnatural and\nsometimes difficult. If users can't easily figure out this structured input,\nthey'll have a hard time figuring out what to do.\n\nFor example, consider an easy user request like, *\"What's the forecast like\ntoday?\"* Other users might also ask, *\"What's the weather like right now?\"*\nor *\"What's the temperature like in San Francisco tomorrow?\"* Even with this\nsimple question, you can see that conversational experiences are hard to\nimplement, because interpreting and processing natural language requires a\nvery robust language parser that's capable of understanding the nuances of\nlanguage. Your code would have to handle all these different types of requests\n(and potentially many more) to carry out the same logic: looking up some\nforecast information for a time and location. For this reason, a traditional\ncomputer interface requires well-known, standard input requests to the detriment\nof the user experience, because it's easier to handle highly structured input.\n\nHowever, when you build Conversational Actions, Assistant handles the\nnatural language understanding (NLU) for you, so you can build open-ended,\nconversational interfaces easily. These interface tools let you understand the\nvast and varied nuances of human language and translate that to standard and\nstructured meaning that your apps and services can understand. Let's take a look\nat how an Action might handle the previous examples for weather forecast\nrequests.\n**Figure 1**. NLU intent matching\n\nTo look up a weather forecast, you might need a few pieces of information,\nlike the time users want the forecast for and their location. However, as we\npreviously mentioned, different users might request a forecast in different\nway. The Assistant can understand these differences and translate them to a\nstandard user intent to get the forecast. It can then parse the user's request\nfor the pertinent data you need to fulfill the request. In this case, that's\nthe user's desired time and location for the weather forecast. Finally, you\ncan use this data to look up the weather with a public REST API and return the\nweather to the user in the form of a prompt.\n\nWhen to build\n-------------\n\nConversational Actions work best for simple use cases that let users get things done\nquickly as well as for immersive use cases that are voice-forward.\nGood Conversational Actions often fall into these general categories:\n\n- **Things people can easily answer.** Actions that can be accomplished with familiar input like times or dates, like booking a flight.\n- **Quick, but useful Actions.** These usually give users immediate benefit for very little time spent, like finding out when their favorite sports team plays next.\n- **Actions that are inherently better suited for voice.** These are typically things you want to do hands-free, like receiving coaching during yoga or light exercise or a game that's been designed for voice-first interactions.\n\nHow to build\n------------\n\nActions on Google lets you build Conversational Actions with either the Actions\nSDK, Actions Builder, or both interchangeably. This feature lets you choose the\nbest development workflow for your needs, while giving you the flexibility of\nswitching back and forth when needed.\n\nThe Actions SDK provides a standardized, file-based schema to build your Actions,\nlibraries to interact with Assistant, and a CLI to deploy and manage your\nActions project. Actions Builder is built on top of the same technology\nas the Actions SDK and lets you build with an easy-to-use and powerful IDE.\n\nSee the [Build overview](/assistant/conversational/build) for more information.\n\nNext steps\n----------\n\nCheck out the following resources to start building now:\n\n- [**Quick start guide**](/assistant/conversational/quickstart) - Get a quick introduction on how to set up your environment and start developing with Actions SDK and Builder.\n- [**Codelabs**](/assistant/conversational/codelabs) - Codelabs offer detailed and in-depth walkthroughs on how to build Actions for the Google Assistant.\n- [**Samples**](/assistant/conversational/samples) - Get all of our samples on Github to start experimenting now."]]