

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 步驟 3：新增自訂和內建意圖
<a name="agent-step-3"></a>

*意圖*代表呼叫中心客服人員希望機器人執行的動作。在這種情況下，客服人員希望機器人根據客服人員與客戶的對話來建議回應和資源。

Amazon Lex V2 有兩種類型的意圖：自訂意圖和內建意圖。 `AMAZON.KendraSearchIntent` 是內建意圖。機器人使用 `AMAZON.KendraSearchIntent` 意圖來查詢索引，並顯示 Amazon Kendra 建議的回應。

此範例中的機器人不需要自訂意圖。不過，若要建置機器人，您必須建立至少一個具有至少一個範例表達用語的自訂意圖。只有建置您的客服人員助理機器人才需要此意圖。它不會執行任何其他 函數。意圖的表達用語不得回答客戶可能提出的任何問題。這可確保`AMAZON.KendraSearchIntent`呼叫 來回答客戶查詢。如需詳細資訊，請參閱[AMAZON.KendraSearchIntent](built-in-intent-kendra-search.md)。

**建立所需的自訂意圖**

1. 在 **Getting started with your bot (開始使用您的機器人)** 頁面上，選擇 **Create intent (建立意圖)**。

1. 針對 **Add intent (新增意圖)**，選擇 **Create intent (建立意圖)**。

1. 在**建立意圖**對話方塊中，輸入意圖的描述性名稱，例如 **RequiredIntent**。

1. 針對**範例表達用語**，輸入描述性表達用語，例如 **Required utterance**。

1. 選擇**儲存意圖**。

**新增`AMAZON.KendraSearchIntent`意圖和回應訊息**

1. 在導覽窗格中，選擇**意圖**旁的加號 (＋)。

1. 選擇**搜尋現有的意圖**。

1. 在**搜尋意圖**方塊中，輸入 **AMAZON.KendraSearchIntent**，然後從清單中選擇它。

1. 為意圖提供描述性名稱，例如 **AgentAssistSearchIntent**，然後選擇**新增**。

1. 在意圖編輯器中，選擇 **Amazon Kendra query (Amazon Kendra 查詢)** 以開啟查詢選項。

1. 選擇您希望意圖搜尋的索引，

1. 在**回應**區段中，將下列三個訊息新增至訊息群組。

   ```
   I found an answer for the customer query: ((x-amz-lex:kendra-search-response-question_answer-question-1)) and the answer is ((x-amz-lex:kendra-search-response-question_answer-answer-1)).
   I found an excerpt from a helpful document: ((x-amz-lex:kendra-search-response-document-1)).
   I think this answer will help the customer: ((x-amz-lex:kendra-search-response-answer-1)).
   ```

1. 選擇**儲存意圖**。

1. 選擇**建置**以建置機器人。

## 下一步驟
<a name="agent-step-3-next"></a>

[步驟 4：設定 Amazon Cognito](agent-step-4.md)