

支援終止通知：2025 年 9 月 15 日， AWS 將停止對 Amazon Lex V1 的支援。2025 年 9 月 15 日之後，您將無法再存取 Amazon Lex V1 主控台或 Amazon Lex V1 資源。如果您使用的是 Amazon Lex V2，請改參閱 [Amazon Lex V2 指南](https://docs.aws.amazon.com/lexv2/latest/dg/what-is.html)。

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

# 步驟 2：建立自訂槽類型 (AWS CLI)
<a name="gs-create-flower-types"></a>

以可訂購的花朵列舉值來建立自訂槽類型。您會在後續步驟中建立 `OrderFlowers` 意圖時使用此類型。*槽類型*會定義意圖的槽或參數可能的值。

若要執行本練習中的命令，您必須知道要執行命令的區域。如需區域的列表，請參閱[模型建置配額](gl-limits.md#gl-limits-model-building)。

**建立自訂槽類型 (AWS CLI)**

1. 建立名為 **FlowerTypes.json** 的文字檔案。從 [FlowerTypes.json](gs-cli-create-flower-types-json.md) 複製 JSON 程式碼到文字檔案。

1. 使用 呼叫 [PutSlotType](API_PutSlotType.md)操作 AWS CLI 來建立槽類型。此範例格式適用於 Unix、Linux 和 macOS。用於 Windows 時，請以插入號 (^) 取代每一行結尾處的 Unix 接續字元斜線 (\$1)。

   ```
   aws lex-models put-slot-type \
       --region region \
       --name FlowerTypes \
       --cli-input-json file://FlowerTypes.json
   ```

   伺服器的回應為：

   ```
   {
       "enumerationValues": [
           {
               "value": "tulips"
           }, 
           {
               "value": "lilies"
           }, 
           {
               "value": "roses"
           }
       ], 
       "name": "FlowerTypes", 
       "checksum": "checksum", 
       "version": "$LATEST", 
       "lastUpdatedDate": timestamp, 
       "createdDate": timestamp, 
       "description": "Types of flowers to pick up"
   }
   ```

## 後續步驟
<a name="gs-create-next-3"></a>

[步驟 3：建立意圖 (AWS CLI)](gs-cli-create-order-flowers.md)

# FlowerTypes.json
<a name="gs-cli-create-flower-types-json"></a>

以下程式碼是建立 `FlowerTypes` 自訂槽類型所需的 JSON 資料：

```
{
    "enumerationValues": [
        {
            "value": "tulips"
        },
        {
            "value": "lilies"
        },
        {
            "value": "roses"
        }
    ],
    "name": "FlowerTypes",
    "description": "Types of flowers to pick up"
}
```