對話動作已於 2023 年 6 月 13 日淘汰。詳情請參閱「
對話動作已淘汰」。
類型
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
輸入內容可讓你設定 Google 助理 NLU (自然語言理解)
從使用者輸入內容中擷取結構化資料。個人中心
您可在以下情況使用類型:
在意圖中,您可以為訓練詞組加上類型註解,以便:
建立運算單元。當使用者說的內容符合版位時,NLU 引擎就會用來引擎
會將其擷取為類型參數,以便您可以在場景中處理。
在場景的「運算單元填充」階段,您可以指定
您想讓使用者先提供的多個版位
加入或退出場景
在場景的「狀況」階段
邏輯來控制參數是否具有類型中定義的特定值。
自訂類型
您可以運用自訂類型自行建立類型規格,通知 NLU
將一組值指派給單一鍵。您可以使用多種方式指定類型
方式:
- 字詞和同義詞可讓您將多個值對應至單一鍵。
這稱為項目類型可以包含一或多個項目。如果發生以下情況:
選擇此選項,您也可以啟用下列 NLU 設定:
- 啟用模糊比對:這項功能允許含有多個項目的項目
來進行比對。
- 接受不明的值:如果無法指定所有可能的值,
語言處理器能根據周遭環境接受未知的字詞或片語
輸入和意圖訓練資料,例如可能新增至雜貨的商品
請參考閱讀清單,進一步瞭解
如何選擇 Kubeflow Pipelines SDK 或 TFX
- 規則運算式可讓類型使用規則運算式來比對值
運算式模式
Google 的 RE2 標準。
- 任意形式文字可讓類型比對
任何使用者說的話新增註解
具備此類型的意圖,可讓您將所有輸入內容當成參數使用
都能傳輸到你的 NLU
系統類型
系統類型可讓你新增註解,並從使用者輸入內容中擷取已知資料
運用系統提供的訓練資料和值以下系統類型如下
支援:
類型 |
說明 |
actions.type.DateTime |
包含日期、時間和時區 (以使用者的裝置設定為依據)。
適用於運算單元填充和訓練詞組註解。
|
actions.type.Date |
僅包含日期。僅適用於運算單元填充。 |
actions.type.Time |
僅包含時間。僅適用於運算單元填充。 |
actions.type.Number |
Number 類型符合序數和基數
數字。 |
DateTime
、Date
和Time
用量
這些類型的行為不同,取決於您使用類型的位置和
符合類型的使用者輸入內容
搭配意圖使用
在意圖中為訓練詞組加上註解僅支援 DateTime
類型。使用者
輸入值不需要與整個 DateTime
值一致。例如,如果使用者
只提供年份,工作階段參數可能如下所示:
"date_time": {
"year": 2019
}
搭配運算單元填充使用
運算單元填充支援 DateTime
、Date
和 Time
。
- 如果版位類型為
DateTime
,Google 助理會提示使用者直到滿載
值。
- 如果時段類型為
Date
,Google 助理會提示使用者到指定日期為止
值。收集時,您收到的參數會是
並將 DateTime
的時間設為 00:00。
- 如果時段類型為
Time
,Google 助理會提示使用者直到時間
值。收集時,收到的參數是完整的
DateTime
物件,日期設為目前日期。
舉例來說,假設位於洛杉磯的使用者說:「Ok Google,建立提醒
2024 年 1 月 15 日晚上 8 點。」將 DateTime
擷取為運算單元的一部分時
填寫過程,完整參數可能如下所示:
"date_time": {
"day": 15,
"hours": 20,
"minutes": 0,
"month": 1,
"nanos": 0,
"seconds": 0,
"time_zone": {
"id": "America/Los_Angeles"
},
"year": 2024
}
搭配條件使用
條件允許使用數字和字串,因此請使用頂層
DateTime
參數會導致條件產生 False 結果。例如:
$session.params.my_dateTime.day > 5
為有效條件,因為
day
值為支援的數字。
- 「
$session.params.my_dateTime > "01-01-2010"
」為無效條件,因為
頂層的「DateTime」並非數字或字串。
執行階段類型覆寫
執行階段類型覆寫功能可讓您在
執行要求這項功能可讓您新增或取代
執行階段。舉例來說,您可以檢查後端資料來源,載入每日菜單
將多項商品歸入出貨類型
詳情請參閱 Webhook 指南
說明如何建構類型覆寫
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eTypes are used to extract structured data from user input, allowing you to create slots in intents, manage slot filling within scenes, and define conditions based on parameter values.\u003c/p\u003e\n"],["\u003cp\u003eYou can create custom types using words and synonyms, regular expressions, or free-form text to define how the NLU interprets user input.\u003c/p\u003e\n"],["\u003cp\u003eSystem types such as \u003ccode\u003eDateTime\u003c/code\u003e, \u003ccode\u003eDate\u003c/code\u003e, \u003ccode\u003eTime\u003c/code\u003e, and \u003ccode\u003eNumber\u003c/code\u003e provide built-in data extraction for common data formats.\u003c/p\u003e\n"],["\u003cp\u003eRuntime type overrides enable dynamic modification of types during fulfillment, allowing you to adjust types based on real-time data.\u003c/p\u003e\n"]]],[],null,["Types let you configure the Assistant NLU (natural language understanding)\nengine to extract structured data from user input. You\ncan use types in the following situations:\n\n- In [intents](/assistant/conversational/intents), you can annotate training phrases with types to\n create slots. When users say something that matches a slot, the NLU engine\n extracts it as a typed parameter, so you can process it in a [scene](/assistant/conversational/scenes).\n\n- Within a scene's [slot filling](/assistant/conversational/scenes#slot_filling) stage, you can specify\n multiple slots that you want the user to provide before they can\n transition or exit out of the scene.\n\n- Within a scene's [conditions](/assistant/conversational/scenes#conditions) stage, you can base\n logic on whether a parameter has a specific value that's defined in a type.\n\nCustom types\n\nCustom types let you create your own type specification to notify the NLU to\nassign a set of values to a single key. You can specify types in a variety of\nways:\n\n- **Words and synonyms** allow you to map multiple values to a single key, which are called an entry. Your type can contain one or many entries. If you choose this option, you can also enable the following NLU settings:\n - **Enable fuzzy matching** - This feature allows entries with more than one word to be matched, even when the words are spoken in a different order.\n - **Accept unknown values** - When you can't specify all possible values, the language processor can accept unknown words or phrases based on surrounding input and intent training data, such as items that might be added to a grocery list.\n- **Regular expressions** allows the type to match values using regular expression patterns based on [Google's RE2 standard](https://github.com/google/re2/wiki/Syntax).\n- **Free form text** allows the type to match anything a user says. Annotating an intent with this type lets you consume all input as a parameter that you can pipe to your own NLU.\n\nSystem types\n\nSystem types let you annotate and extract well-known data from user input\nusing system-provided training data and values. The following system types are\nsupported:\n\n| Type | Description |\n|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n| **`actions.type.DateTime`** | Contains date, time, and timezone based on the user's device settings. Available for slot filling and training phrase annotation. |\n| **`actions.type.Date`** | Contains date only. Available for slot filling only. |\n| **`actions.type.Time`** | Contains time only. Available for slot filling only. |\n| **`actions.type.Number`** | The `Number` type matches ordinal and cardinal numbers. |\n\n`DateTime`, `Date`, and `Time` usage\n\nThese types behave differently depending on where you use the type and the\nuser input that matches the type.\n\nUsing with intents\n\nAnnotating training phrases in intents supports only the `DateTime` type. User\ninput doesn't need to match an entire `DateTime` value. For example, if a user\nprovides only the year, the session parameter might look like this: \n\n \"date_time\": {\n \"year\": 2019\n }\n\nUsing with slot filling\n\nSlot filling supports `DateTime`, `Date`, and `Time`.\n\n- If the slot type is `DateTime`, the Assistant prompts the user until a full value is provided.\n- If the slot type is `Date`, the Assistant prompts the user until a date value is provided. When collected, the parameter you receive is a full `DateTime` with the time set to 00:00.\n- If the slot type is `Time`, the Assistant prompts the user until a time value is provided. When collected, the parameter your receive is a full `DateTime` object with the date set to the current date.\n\nFor example, suppose a user in Los Angeles said, \"Hey Google, create a reminder\nfor January 15, 2024 at 8 pm.\" When `DateTime` is extracted as part of a slot\nfilling process, the full parameter might look like this: \n\n \"date_time\": {\n \"day\": 15,\n \"hours\": 20,\n \"minutes\": 0,\n \"month\": 1,\n \"nanos\": 0,\n \"seconds\": 0,\n \"time_zone\": {\n \"id\": \"America/Los_Angeles\"\n },\n \"year\": 2024\n }\n\nUsing with conditions\n\nConditions only allow the use of numbers and strings, so using the top level\n`DateTime` parameter results in a **False** result for the condition. For\nexample:\n\n- `$session.params.my_dateTime.day \u003e 5` is a valid condition, because the `day` value is a number and is supported.\n- `$session.params.my_dateTime \u003e \"01-01-2010\"` is an invalid condition, because the top level 'DateTime' object is not a number or string.\n\nRuntime type overrides\n\nRuntime type overrides let you dynamically create or modify types in\nfulfillment. This feature lets you add to or replace a type's specification at\nruntime. For example, you can check a backend data source to load daily menu\nitems into a type in your fulfillment.\n\nSee the [webhooks](/assistant/conversational/webhooks#runtime_type_overrides) guide for more information\non how to build type overrides."]]