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) 飛往 ($est '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

必要欄位。意圖參數的專屬名稱。可用於條件和回應,參照 NLU 透過 $intent.params.[name].resolved 擷取的意圖參數

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

object (ClassReference)

選用設定。宣告此參數的資料類型。請勿針對內建意圖設定此參數。

entitySetReferences

object (EntitySetReferences)

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

EntitySetReferences

意圖參數的實體集參照。

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

object (EntitySetReference)

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

EntitySetReference

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

YAML 表示法
entitySet: string
欄位
entitySet

string

必要欄位。用於識別要為特定參數考慮的特定實體集合。對應的實體集定義必須存在於 custom/entitySets/ 目錄中。