如要查詢天氣預報,您可能需要一些資訊,例如使用者想取得天氣預報的時間和位置。不過,如我們前所述,不同使用者可能會透過不同的方式提出預測要求。Google 助理可以瞭解這些差異,並將其轉譯成標準的使用者意圖,以便取得預測資訊。接著,比對服務會剖析使用者要求,提供執行要求所需的適當資料。在這個案例中,也就是使用者希望天氣預報的時間和地點。最後,您可以透過公開 REST API 使用這項資料來查詢天氣,並以提示的形式將天氣回傳給使用者。
[null,null,["上次更新時間: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."]]