Intent
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
intent 会将开放式用户输入映射到结构化对象。借助 Google 的自然语言理解 (NLU) 技术,语音短语与意图匹配。意图匹配可以触发对话设计中的事件,以推进用户的对话。intent 名称在文件的名称中指定。
字段 |
parameters[] |
object (IntentParameter )
训练短语中的参数列表。必须在此处定义所有参数,才能在训练短语中使用。
|
trainingPhrases[] |
string
通过训练短语,Google 的 NLU 会自动将意图与用户输入进行匹配。提供的唯一短语越多,此意图匹配的可能性就越大。以下是带注释的训练短语部分的格式。请注意,auto 字段为可选字段,如果未指定 auto ,则默认行为等同于 auto=false 。($<paramName> '<sample text>' auto=<true or false>) auto = true 表示相应部分由 NLU 自动注释。auto = false 表示用户已对该部分添加注解。如果未指定 auto,则这是默认值。例如:“预订从 ($source 'San Francisco' auto=false) 飞往($dest '温哥华')的航班”
|
IntentParameter
YAML 表示法 |
name: string
# Union field parameter_type can be only one of the following:
type:
object (ClassReference )
entitySetReferences:
object (EntitySetReferences )
# End of list of possible types for union field parameter_type . |
字段 |
name |
string
必需。intent 参数的唯一名称。可在条件和响应中使用,以引用由 NLU 通过 $intent.params.[name].resolved 提取的 intent 参数
|
联合字段 parameter_type 。intent 参数的类型。parameter_type 只能是下列其中一项: |
type |
object (ClassReference )
可选。声明此参数的数据类型。不应为内置 intent 设置此字段。
|
entitySetReferences |
object (EntitySetReferences )
可选。对此 intent 参数允许的实体集的引用。仅对内置 intent 的参数有效。这些引用指向“custom/entitySets”中的实体集目录。
|
EntitySetReference
YAML 表示法 |
entitySet: string |
字段 |
entitySet |
string
必需。确定要用于给定参数的特定实体集合。相应的实体集定义应该存在于 custom/entitySets/ 目录中。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eIntents utilize Google's Natural Language Understanding (NLU) to match spoken phrases with user input, triggering events within a conversation design.\u003c/p\u003e\n"],["\u003cp\u003eIntent parameters are defined within training phrases, specifying data types and referencing allowed entities for built-in intents.\u003c/p\u003e\n"],["\u003cp\u003eEntity set references identify specific collections of entities for a given parameter, linking to definitions in the custom/entitySets/ directory.\u003c/p\u003e\n"],["\u003cp\u003eTraining phrases, incorporating parameters and entity references, enable Google's NLU to accurately match intents with user input, improving the conversational experience.\u003c/p\u003e\n"]]],[],null,["# Intent\n\n- [YAML representation](#SCHEMA_REPRESENTATION)\n- [IntentParameter](#IntentParameter)\n - [YAML representation](#IntentParameter.SCHEMA_REPRESENTATION)\n- [EntitySetReferences](#EntitySetReferences)\n - [YAML representation](#EntitySetReferences.SCHEMA_REPRESENTATION)\n- [EntitySetReference](#EntitySetReference)\n - [YAML representation](#EntitySetReference.SCHEMA_REPRESENTATION)\n\nIntents map open-ended user input to structured objects. Spoken phrases are matched to intents with Google's Natural Language Understanding (NLU). Intent matches can trigger events in your conversation design to progress the user's conversation. The intent name is specified in the name of the file.\n\n| YAML representation ||\n|-----------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` parameters: - object (/assistant/actionssdk/reference/rest/Shared.Types/Intent#IntentParameter) trainingPhrases: - string ``` |\n\n| Fields ||\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parameters[]` | `object (`[IntentParameter](/assistant/actionssdk/reference/rest/Shared.Types/Intent#IntentParameter)`)` The list of parameters within the training phrases. All parameters must be defined here to be used in the training phrase. |\n| `trainingPhrases[]` | `string` Training phrases allow Google's NLU to automatically match intents with user input. The more unique phrases that are provided, the better chance this intent will be matched. The following is the format of training phrase part which are annotated. Note that `auto` field is optional and the default behavior when `auto` is not specified is equivalent to `auto=false`. `($\u003cparamName\u003e '\u003csample text\u003e' auto=\u003ctrue or false\u003e)` `auto = true` means the part was auto annotated by NLU. `auto = false` means the part was annotated by the user. This is the default when auto is not specified. Example: \"Book a flight from ($source 'San Francisco' auto=false) to ($dest 'Vancouver')\" |\n\nIntentParameter\n---------------\n\nDefinition of a parameter which can be used inside training phrases.\n\n| YAML representation ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` name: string # Union field `parameter_type` can be only one of the following: type: object (/assistant/actionssdk/reference/rest/Shared.Types/ClassReference) entitySetReferences: object (/assistant/actionssdk/reference/rest/Shared.Types/Intent#EntitySetReferences) # End of list of possible types for union field `parameter_type`. ``` |\n\n| Fields ||\n|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| `name` | `string` Required. Unique name of the intent parameter. Can be used in conditions and responses to reference intent parameters extracted by NLU with $intent.params.\\[name\\].resolved |\n| Union field `parameter_type`. The type of the intent parameter. `parameter_type` can be only one of the following: |||\n| `type` | `object (`[ClassReference](/assistant/actionssdk/reference/rest/Shared.Types/ClassReference)`)` Optional. Declares the data type of this parameter. This should not be set for built-in intents. |\n| `entitySetReferences` | `object (`[EntitySetReferences](/assistant/actionssdk/reference/rest/Shared.Types/Intent#EntitySetReferences)`)` Optional. References to the sets of allowed entities for this intent parameter. Only valid for parameters of a built-in intent. These references point to entity sets in the 'custom/entitySets' directory. |\n\nEntitySetReferences\n-------------------\n\nEntity set references for an intent parameter.\n\n| YAML representation ||\n|---------------------------------------------------------------------------------------------------------------------|---|\n| ``` entitySetReferences: - object (/assistant/actionssdk/reference/rest/Shared.Types/Intent#EntitySetReference) ``` |\n\n| Fields ||\n|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `entitySetReferences[]` | `object (`[EntitySetReference](/assistant/actionssdk/reference/rest/Shared.Types/Intent#EntitySetReference)`)` Required. Entity set references for an intent parameter. |\n\nEntitySetReference\n------------------\n\nA reference to the set of allowed entities for this intent parameter.\n\n| YAML representation ||\n|---------------------------|---|\n| ``` entitySet: string ``` |\n\n| Fields ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `entitySet` | `string` Required. Identifies the specific collection of entities to be considered for a given parameter. The corresponding entity set definition should be present in the custom/entitySets/ directory. |"]]