쿠키 기본 설정 선택

당사는 사이트와 서비스를 제공하는 데 필요한 필수 쿠키 및 유사한 도구를 사용합니다. 고객이 사이트를 어떻게 사용하는지 파악하고 개선할 수 있도록 성능 쿠키를 사용해 익명의 통계를 수집합니다. 필수 쿠키는 비활성화할 수 없지만 '사용자 지정' 또는 ‘거부’를 클릭하여 성능 쿠키를 거부할 수 있습니다.

사용자가 동의하는 경우 AWS와 승인된 제3자도 쿠키를 사용하여 유용한 사이트 기능을 제공하고, 사용자의 기본 설정을 기억하고, 관련 광고를 비롯한 관련 콘텐츠를 표시합니다. 필수가 아닌 모든 쿠키를 수락하거나 거부하려면 ‘수락’ 또는 ‘거부’를 클릭하세요. 더 자세한 내용을 선택하려면 ‘사용자 정의’를 클릭하세요.

연습 2: 대화 흐름 검토

포커스 모드
연습 2: 대화 흐름 검토 - Amazon Lex

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

이 연습에서는 클라이언트 애플리케이션과 연습 1: 예제를 사용하여 봇 생성에서 생성한 Amazon Lex V2 봇 간에 전송되는 JSON 구조를 검토합니다. 대화에서는 RecognizeText 작업을 사용하여 JSON 구조를 생성합니다. RecognizeUtterance는 응답의 HTTP 헤더와 동일한 정보를 반환합니다.

JSON 구조는 대화의 각 차례에 따라 구분됩니다. 은 클라이언트 애플리케이션의 요청과 봇의 응답입니다.

턴 1

대화가 처음 시작되면 클라이언트 애플리케이션이 봇과의 대화를 시작합니다. URI와 요청 본문은 모두 요청에 대한 정보를 제공합니다.

POST /bots/botId/botAliases/botAliasId/botLocales/localeId/sessions/sessionId/text HTTP/1.1 Content-type: application/json { "text": "I would like to order flowers" }
  • URI는 클라이언트 애플리케이션이 통신 중인 봇을 식별합니다. 또한 사용자와 봇 간의 특정 대화를 식별하는 클라이언트 애플리케이션에서 생성한 세션 식별자도 포함됩니다.

  • 요청 본문에는 사용자가 클라이언트 애플리케이션에 입력한 텍스트가 포함됩니다. 이 경우에는 텍스트만 전송되지만 애플리케이션은 요청 속성이나 세션 상태와 같은 추가 정보를 전송할 수 있습니다. 자세한 정보는 RecognizeText 작업을 참조하세요.

text에서 Amazon Lex V2는 꽃을 주문하려는 사용자의 의도를 감지합니다. Amazon Lex V2는 의도의 슬롯(FlowerType) 중 하나와 슬롯에 대한 프롬프트 중 하나를 선택한 후 다음 응답을 클라이언트 애플리케이션에 보냅니다. 클라이언트가 사용자에게 응답을 표시합니다.

{ "interpretations": [ { "intent": { "confirmationState": "None", "name": "OrderFlowers", "slots": { "FlowerType": null, "PickupDate": null, "PickupTime": null }, "state": "InProgress" }, "nluConfidence": { "score": 0.95 } }, { "intent": { "name": "FallbackIntent", "slots": {} } } ], "messages": [ { "content": "What type of flowers would you like to order?", "contentType": "PlainText" } ], "sessionId": "bf445a49-7165-4fcd-9a9c-a782493fba5c", "sessionState": { "dialogAction": { "slotToElicit": "FlowerType", "type": "ElicitSlot" }, "intent": { "confirmationState": "None", "name": "OrderFlowers", "slots": { "FlowerType": null, "PickupDate": null, "PickupTime": null }, "state": "InProgress" }, "originatingRequestId": "9e8add70-4106-4a10-93f5-2ce2cb959e5f" } }

턴 2

턴 2에서 사용자는 턴 1에서 Amazon Lex V2 봇의 프롬프트에 FlowerType 슬롯을 채우는 값으로 응답합니다.

{ "text": "1 dozen roses" }

턴 2에 대한 응답은 FlowerType 슬롯이 채워진 것을 보여주고 다음 슬롯 값을 유도하라는 메시지를 표시합니다.

{ "interpretations": [ { "intent": { "confirmationState": "None", "name": "OrderFlowers", "slots": { "FlowerType": { "value": { "interpretedValue": "dozen roses", "originalValue": "dozen roses", "resolvedValues": [] } }, "PickupDate": null, "PickupTime": null }, "state": "InProgress" }, "nluConfidence": { "score": 0.98 } }, { "intent": { "name": "FallbackIntent", "slots": {} } } ], "messages": [ { "content": "What day do you want the dozen roses to be picked up?", "contentType": "PlainText" } ], "sessionId": "bf445a49-7165-4fcd-9a9c-a782493fba5c", "sessionState": { "dialogAction": { "slotToElicit": "PickupDate", "type": "ElicitSlot" }, "intent": { "confirmationState": "None", "name": "OrderFlowers", "slots": { "FlowerType": { "value": { "interpretedValue": "dozen roses", "originalValue": "dozen roses", "resolvedValues": [] } }, "PickupDate": null, "PickupTime": null }, "state": "InProgress" }, "originatingRequestId": "9e8add70-4106-4a10-93f5-2ce2cb959e5f" } }

턴 3

턴 3에서 사용자는 턴 2에서 Amazon Lex V2 봇의 프롬프트에 PickupDate 슬롯을 채우는 값으로 응답합니다.

{ "text": "next monday" }

턴 3에 대한 응답은 FlowerTypePickupDate 슬롯이 채워진 것을 보여주고 다음 슬롯 값을 유도하라는 메시지를 표시합니다.

{ "interpretations": [ { "intent": { "confirmationState": "None", "name": "OrderFlowers", "slots": { "FlowerType": { "value": { "interpretedValue": "dozen roses", "originalValue": "dozen roses", "resolvedValues": [] } }, "PickupDate": { "value": { "interpretedValue": "2022-12-28", "originalValue": "next monday", "resolvedValues": [ "2021-01-04" ] } }, "PickupTime": null }, "state": "InProgress" }, "nluConfidence": { "score": 1.0 } }, { "intent": { "name": "FallbackIntent", "slots": {} } } ], "messages": [ { "content": "At what time do you want the 1 dozen roses to be picked up?", "contentType": "PlainText" } ], "sessionId": "bf445a49-7165-4fcd-9a9c-a782493fba5c", "sessionState": { "dialogAction": { "slotToElicit": "PickupTime", "type": "ElicitSlot" }, "intent": { "confirmationState": "None", "name": "OrderFlowers", "slots": { "FlowerType": { "value": { "interpretedValue": "dozen roses", "originalValue": "dozen roses", "resolvedValues": [] } }, "PickupDate": { "value": { "interpretedValue": "2021-01-04", "originalValue": "next monday", "resolvedValues": [ "2021-01-04" ] } }, "PickupTime": null }, "state": "InProgress" }, "originatingRequestId": "9e8add70-4106-4a10-93f5-2ce2cb959e5f", "sessionAttributes": {} } }

턴 4

턴 4에서 사용자는 의도의 최종 슬롯 값, 즉 꽃을 픽업한 시간을 제공합니다.

{ "text": "5 in the evening" }

이에 대한 응답으로 Amazon Lex V2는 주문이 올바른지 확인하는 확인 메시지를 사용자에게 보냅니다. dialogActionConfirmIntent로 설정되고 confirmationStateNone입니다.

{ "interpretations": [ { "intent": { "confirmationState": "None", "name": "OrderFlowers", "slots": { "FlowerType": { "value": { "interpretedValue": "dozen roses", "originalValue": "dozen roses", "resolvedValues": [] } }, "PickupDate": { "value": { "interpretedValue": "2021-01-04", "originalValue": "next monday", "resolvedValues": [ "2021-01-04" ] } }, "PickupTime": { "value": { "interpretedValue": "17:00", "originalValue": "5 evening", "resolvedValues": [ "17:00" ] } } }, "state": "InProgress" }, "nluConfidence": { "score": 1.0 } }, { "intent": { "name": "FallbackIntent", "slots": {} } } ], "messages": [ { "content": "Okay, your dozen roses will be ready for pickup by 17:00 on 2021-01-04. Does this sound okay?", "contentType": "PlainText" } ], "sessionId": "bf445a49-7165-4fcd-9a9c-a782493fba5c", "sessionState": { "dialogAction": { "type": "ConfirmIntent" }, "intent": { "confirmationState": "None", "name": "OrderFlowers", "slots": { "FlowerType": { "value": { "interpretedValue": "dozen roses", "originalValue": "dozen roses", "resolvedValues": [] } }, "PickupDate": { "value": { "interpretedValue": "2021-01-04", "originalValue": "next monday", "resolvedValues": [ "2021-01-04" ] } }, "PickupTime": { "value": { "interpretedValue": "17:00", "originalValue": "5 evening", "resolvedValues": [ "17:00" ] } } }, "state": "InProgress" }, "originatingRequestId": "9e8add70-4106-4a10-93f5-2ce2cb959e5f" } }

턴 5

마지막 턴에서 사용자는 확인 프롬프트에 응답합니다.

{ "text": "yes" }

응답에서 Amazon Lex V2 전송은 confirmationStateConfirmed로 설정하고 dialogAction을 종료하도록 설정하여 의도가 이행되었음을 나타냅니다. 모든 슬롯 값은 클라이언트 애플리케이션에서 사용할 수 있습니다.

{ "interpretations": [ { "intent": { "confirmationState": "Confirmed", "name": "OrderFlowers", "slots": { "FlowerType": { "value": { "interpretedValue": "dozen roses", "originalValue": "dozen roses", "resolvedValues": [] } }, "PickupDate": { "value": { "interpretedValue": "2021-01-04", "originalValue": "next monday", "resolvedValues": [ "2021-01-04" ] } }, "PickupTime": { "value": { "interpretedValue": "17:00", "originalValue": "5 evening", "resolvedValues": [ "17:00" ] } } }, "state": "Fulfilled" }, "nluConfidence": { "score": 1.0 } }, { "intent": { "name": "FallbackIntent", "slots": {} } } ], "messages": [ { "content": "Thanks. ", "contentType": "PlainText" } ], "sessionId": "bf445a49-7165-4fcd-9a9c-a782493fba5c", "sessionState": { "dialogAction": { "type": "Close" }, "intent": { "confirmationState": "Confirmed", "name": "OrderFlowers", "slots": { "FlowerType": { "value": { "interpretedValue": "dozen roses", "originalValue": "dozen roses", "resolvedValues": [] } }, "PickupDate": { "value": { "interpretedValue": "2021-01-04", "originalValue": "next monday", "resolvedValues": [ "2021-01-04" ] } }, "PickupTime": { "value": { "interpretedValue": "17:00", "originalValue": "5 evening", "resolvedValues": [ "17:00" ] } } }, "state": "Fulfilled" }, "originatingRequestId": "9e8add70-4106-4a10-93f5-2ce2cb959e5f" } }

이 페이지에서

프라이버시사이트 이용 약관쿠키 기본 설정
© 2025, Amazon Web Services, Inc. 또는 계열사. All rights reserved.