Intent

意圖會將開放式使用者輸入內容對應至結構化物件。語音詞組會透過 Google 的自然語言理解 (NLU) 功能比對意圖。意圖比對功能會在對話設計中觸發事件,推動使用者的對話。您可以在檔案名稱中指定意圖名稱。

YAML 表示法
parameters: 
  - object (IntentParameter)
trainingPhrases: 
  - string
欄位
parameters[]

object (IntentParameter)

訓練詞組中的參數清單。所有參數都必須在這裡定義,才能在訓練詞組中使用。

trainingPhrases[]

string

訓練詞組可讓 Google 的 NLU 自動比對意圖與使用者輸入內容。提供的不重複詞組越多,比對意圖的機率越高。以下是已加上註解的訓練詞組部分格式。請注意,auto 是選用欄位,在未指定 auto 時,預設行為是 auto=false($<paramName> '<sample text>' auto=<true or false>) auto = true 表示 NLU 已自動為部分片段加上註解。auto = false 表示該部分已由使用者加註。在未指定「自動」的情況下,這是預設值。範例:「預訂從 ($source 'San Francisco' auto=false) 到 ($dest 'Vancouver') 的航班」

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.params.[name].resolved 參照 NLU 擷取的意圖參數

聯集欄位 parameter_type。意圖參數的類型。parameter_type 只能是下列其中一項:
type

object (ClassReference)

選用設定。宣告此參數的資料類型。請勿在內建意圖中設定這個屬性。

entitySetReferences

object (EntitySetReferences)

選用設定。參照這個意圖參數允許的實體組合。只適用於內建意圖的參數。這些參照指向「custom/entitySet」中的實體集目錄。

EntitySetReferences

意圖參數的實體集參照。

YAML 表示法
entitySetReferences: 
  - object (EntitySetReference)
欄位
entitySetReferences[]

object (EntitySetReference)

必要欄位。意圖參數的實體集參照。

EntitySetReference

參照此意圖參數允許的實體組合。

YAML 表示法
entitySet: string
欄位
entitySet

string

必要欄位。識別要用於指定參數的特定實體集合。對應的實體集定義應出現在自訂/entitySets/ 目錄中。