

지원 종료 공지: 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-cli-update-utterance"></a>

Amazon Lex가 사용자의 요청을 인식하는 데 사용하는 기계 학습 모델을 개선하려면 봇에 다른 샘플 표현을 추가합니다.

새 표현 추가는 4단계 프로세스입니다.

1. [GetIntent](API_GetIntent.md) 작업을 사용하여 Amazon Lex 에서 의도를 가져옵니다.

1. 의도를 업데이트합니다.

1. [PutIntent](API_PutIntent.md) 작업을 사용하여 업데이트된 의도를 다시 Amazon Lex로 보냅니다.

1. [GetBot](API_GetBot.md) 및 [PutBot](API_PutBot.md) 작업을 사용하여 해당 의도를 사용하는 봇을 다시 구축합니다.

이 연습에서 명령을 실행하려면 명령이 실행될 리전을 알아야 합니다. 리전 목록은 [모델 구축 할당량](gl-limits.md#gl-limits-model-building)을 참조하십시오.

`GetIntent` 작업의 응답에는 의도의 특정 개정을 식별하는 `checksum`이라는 필드가 포함되어 있습니다. [PutIntent](API_PutIntent.md) 작업을 사용하여 의도를 업데이트하는 경우 체크섬 값을 제공해야 합니다. 체크섬 값을 제공하지 않으면 다음 오류 메시지가 표시됩니다.

```
            An error occurred (PreconditionFailedException) when calling 
            the PutIntent operation: Intent {{intent name}} already exists. 
            If you are trying to update {{intent name}} you must specify the 
            checksum.
```

**참고**  
다음 AWS CLI 예제는 Unix, Linux 및 macOS용으로 포맷되어 있습니다. Windows의 경우 `"\$LATEST"`를 `$LATEST`로 바꾸고, 각 줄의 끝에 있는 백슬래시(\\) 연속 문자를 캐럿(^)으로 변경합니다.

**`OrderFlowers` 의도를 업데이트하려면(AWS CLI)**

1. 에서 Amazon Lex에서 의도를 AWS CLI가져옵니다. Amazon Lex는 출력을 **OrderFlowers-V2.json.**라는 파일로 보냅니다.

   ```
   aws lex-models get-intent \
       --region {{region}} \
       --name OrderFlowers \
       --intent-version "\$LATEST" > OrderFlowers-V2.json
   ```

1. 텍스트 편집기에서 **OrderFlowers-V2.json**을 엽니다.

   1. `createdDate`, `lastUpdatedDate` 및 `version` 필드를 찾아 삭제합니다.

   1. `sampleUtterances` 필드에 다음을 추가합니다.

      ```
      I want to order flowers
      ```

   1. 파일을 저장합니다.

1. 다음 명령을 사용하여 Amazon Lex에 업데이트된 의도를 보냅니다.

   ```
   aws lex-models put-intent  \
       --region {{region}} \
       --name OrderFlowers \
       --cli-input-json file://OrderFlowers-V2.json
   ```

   Amazon Lex가 다음 응답을 보냅니다.

이제 의도를 업데이트했으므로 해당 의도를 사용하는 봇을 다시 구축합니다.

**`OrderFlowersBot` 봇을 다시 구축하려면(AWS CLI)**

1. 에서 `OrderFlowersBot` 봇의 정의를 AWS CLI가져와 다음 명령을 사용하여 파일에 저장합니다.

   ```
   aws lex-models get-bot \
       --region {{region}} \
       --name OrderFlowersBot \
       --version-or-alias "\$LATEST" > OrderFlowersBot-V2.json
   ```

1. 텍스트 편집기에서 **OrderFlowersBot-V2.json** 파일을 엽니다. `createdDate`, `lastUpdatedDate`, `status` 및 `version` 필드를 제거합니다.

1. 텍스트 편집기에서 봇 정의에 다음 줄을 추가합니다.

   ```
   "processBehavior": "BUILD",
   ```

1. 에서에 대한 다음 명령을 실행하여 봇의 새 개정을 AWS CLI빌드합니다.

   ```
   aws lex-models put-bot \
       --region {{region}} \
       --name OrderFlowersBot \
       --cli-input-json file://OrderFlowersBot-V2.json
   ```

   서버에서 다음과 같이 응답합니다.

## 다음 단계
<a name="gs-cli-next-exercise-3"></a>

[연습 3: Lambda 함수 추가(AWS CLI)](gs-cli-update-lambda.md)