Lex V2에서 봇을 가져오고 내보내는 JSON 형식 - Amazon Lex

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

Lex V2에서 봇을 가져오고 내보내는 JSON 형식

리소스의 일부를 설명하는 JSON 구조가 포함된 .zip 파일을 사용하여 Amazon Lex V2에서 봇, 봇 로캘 또는 사용자 지정 어휘를 가져오고 내보냅니다. 리소스를 내보내면 Amazon Lex V2에서 .zip 파일을 생성하고 Amazon S3의 사전 서명된 URL을 사용하여 사용할 수 있도록 합니다. 리소스를 가져올 때는 JSON 구조가 포함된 .zip 파일을 생성하여 S3의 사전 서명된 URL에 업로드해야 합니다.

Amazon Lex는 봇을 내보낼 때 .zip 파일에 다음과 같은 디렉터리 구조를 생성합니다. 봇 로캘을 내보내는 경우 해당 로캘 아래의 구조만 내보냅니다. 사용자 지정 어휘를 내보내는 경우 사용자 지정 어휘 아래의 구조만 내보내집니다.

BotName_BotVersion_ExportID_LexJson.zip -or- BotName_BotVersion_LocaleId_ExportId_LEX_JSON.zip --> manifest.json --> BotName ----> Bot.json ----> BotLocales ------> Locale_A --------> BotLocale.json --------> Intents ----------> Intent_A ------------> Intent.json ------------> Slots --------------> Slot_A ----------------> Slot.json --------------> Slot_B ----------------> Slot.json ----------> Intent_B ... --------> SlotTypes ----------> SlotType_A ------------> SlotType.json ----------> SlotType_B ... --------> CustomVocabulary ------------> CustomVocabulary.json ------> Locale_B ...

매니페스트 파일 구조

매니페스트 파일에는 내보내기 파일의 메타데이터가 들어 있습니다.

{ "metadata": { "schemaVersion": "1.0", "fileFormat": "LexJson", "resourceType": "Bot | BotLocale | CustomVocabulary" } }

못 파일 구조

봇 파일에는 봇에 대한 구성 정보가 포함되어 있습니다.

{ "name": "BotName", "identifier": "identifier", "version": "number", "description": "description", "dataPrivacy": { "childDirected": true | false }, "idleSessionTTLInSeconds": seconds }

봇 로캘 파일 구조

봇 로캘 파일에는 봇의 로캘 또는 언어에 대한 설명이 들어 있습니다. 봇을 내보내는 경우 .zip 파일에 둘 이상의 봇 로캘 파일이 있을 수 있습니다. 봇 로캘을 내보내는 경우 zip 파일에는 로캘이 하나뿐입니다.

{ "name": "locale name", "identifier": "locale ID", "version": "number", "description": "description", "voiceSettings": { "voiceId": "voice", "engine": "standard | neural }, "nluConfidenceThreshold": number }

의도 파일 구조

의도 파일에는 의도의 구성 정보가 들어 있습니다. .zip 파일에는 특정 로캘의 각 의도에 대한 의도 파일이 하나씩 있습니다.

다음은 샘플 BookTrip 봇의 BookCar 의도에 대한 JSON 구조의 예시입니다. 의도의 JSON 구조 전체 예시는 CreateIntent 작업을 참조하세요.

{ "name": "BookCar", "identifier": "891RWHHICO", "description": "Intent to book a car.", "parentIntentSignature": null, "sampleUtterances": [ { "utterance": "Book a car" }, { "utterance": "Reserve a car" }, { "utterance": "Make a car reservation" } ], "intentConfirmationSetting": { "confirmationPrompt": { "messageGroupList": [ { "message": { "plainTextMessage": { "value": "OK, I have you down for a {CarType} hire in {PickUpCity} from {PickUpDate} to {ReturnDate}. Should I book the reservation?" }, "ssmlMessage": null, "customPayload": null, "imageResponseCard": null }, "variations": null } ], "maxRetries": 2 }, "declinationResponse": { "messageGroupList": [ { "message": { "plainTextMessage": { "value": "OK, I have cancelled your reservation in progress." }, "ssmlMessage": null, "customPayload": null, "imageResponseCard": null }, "variations": null } ] } }, "intentClosingSetting": null, "inputContexts": null, "outputContexts": null, "kendraConfiguration": null, "dialogCodeHook": null, "fulfillmentCodeHook": null, "slotPriorities": [ { "slotName": "DriverAge", "priority": 4 }, { "slotName": "PickUpDate", "priority": 2 }, { "slotName": "ReturnDate", "priority": 3 }, { "slotName": "PickUpCity", "priority": 1 }, { "slotName": "CarType", "priority": 5 } ] }

슬롯 파일 구조

슬롯 파일에는 의도의 슬롯에 대한 구성 정보가 들어 있습니다. .zip 파일에는 특정 로캘의 의도에 대해 정의된 각 슬롯에 대한 슬롯 파일이 하나씩 있습니다.

다음은 고객이 BookTrip 예시 봇의 BookCar 의도에서 대여하려는 자동차 유형을 선택할 수 있는 슬롯의 JSON 구조입니다. 슬롯의 JSON 구조의 전체 예는 CreateSlot 작업을 참조하세요.

{ "name": "CarType", "identifier": "KDHJWNGZGC", "description": "Type of car being reserved.", "multipleValuesSetting": { "allowMutlipleValues": false }, "slotTypeName": "CarTypeValues", "obfuscationSetting": null, "slotConstraint": "Required", "defaultValueSpec": null, "slotValueElicitationSetting": { "promptSpecification": { "messageGroupList": [ { "message": { "plainTextMessage": { "value": "What type of car would you like to rent? Our most popular options are economy, midsize, and luxury" }, "ssmlMessage": null, "customPayload": null, "imageResponseCard": null }, "variations": null } ], "maxRetries": 2 }, "sampleValueElicitingUtterances": null, "waitAndContinueSpecification": null, } }

다음 예는 복합 슬롯의 JSON 구조를 보여줍니다.

{ "name": "CarType", "identifier": "KDHJWNGZGC", "description": "Type of car being reserved.", "multipleValuesSetting": { "allowMutlipleValues": false }, "slotTypeName": "CarTypeValues", "obfuscationSetting": null, "slotConstraint": "Required", "defaultValueSpec": null, "slotValueElicitationSetting": { "promptSpecification": { "messageGroupList": [ { "message": { "plainTextMessage": { "value": "What type of car would you like to rent? Our most popular options are economy, midsize, and luxury" }, "ssmlMessage": null, "customPayload": null, "imageResponseCard": null }, "variations": null } ], "maxRetries": 2 }, "sampleValueElicitingUtterances": null, "waitAndContinueSpecification": null, }, "subSlotSetting": { "slotSpecifications": { "firstname": { "valueElicitationSetting": { "promptSpecification": { "allowInterrupt": false, "messageGroupsList": [ { "message": { "imageResponseCard": null, "ssmlMessage": null, "customPayload": null, "plainTextMessage": { "value": "please provide firstname" } }, "variations": null } ], "maxRetries": 2, "messageSelectionStrategy": "Random" }, "defaultValueSpecification": null, "sampleUtterances": [ { "utterance": "my name is {firstName}" } ], "waitAndContinueSpecification": null }, "slotTypeId": "AMAZON.FirstName" }, "eyeColor": { "valueElicitationSetting": { "promptSpecification": { "allowInterrupt": false, "messageGroupsList": [ { "message": { "imageResponseCard": null, "ssmlMessage": null, "customPayload": null, "plainTextMessage": { "value": "please provide eye color" } }, "variations": null } ], "maxRetries": 2, "messageSelectionStrategy": "Random" }, "defaultValueSpecification": null, "sampleUtterances": [ { "utterance": "eye color is {eyeColor}" }, { "utterance": "I have eyeColor eyes" } ], "waitAndContinueSpecification": null }, "slotTypeId": "7FEVCB2PQE" } }, "expression": "(firstname OR eyeColor)" } }

슬롯 유형 파일 구조

슬롯 유형 파일에는 언어 또는 로캘에서 사용되는 사용자 지정 슬롯 유형에 대한 구성 정보가 들어 있습니다. .zip 파일에는 특정 로캘의 각 사용자 지정 슬롯 유형에 대해 하나의 슬롯 유형 파일이 있습니다.

다음은 BookTrip 예시 봇에서 사용할 수 있는 자동차 유형을 나열하는 슬롯 유형의 JSON 구조입니다. 슬롯 유형에 대한 JSON 구조의 전체 예는 CreateSlotType 작업을 참조하세요.

{ "name": "CarTypeValues", "identifier": "T1YUHGD9ZR", "description": "Enumeration representing possible types of cars available for hire", "slotTypeValues": [{ "synonyms": null, "sampleValue": { "value": "economy" } }, { "synonyms": null, "sampleValue": { "value": "standard" } }, { "synonyms": null, "sampleValue": { "value": "midsize" } }, { "synonyms": null, "sampleValue": { "value": "full size" } }, { "synonyms": null, "sampleValue": { "value": "luxury" } }, { "synonyms": null, "sampleValue": { "value": "minivan" } }], "parentSlotTypeSignature": null, "valueSelectionSetting": { "resolutionStrategy": "TOP_RESOLUTION", "advancedRecognitionSetting": { "audioRecognitionStrategy": "UseSlotValuesAsCustomVocabulary" }, "regexFilter": null } }

다음 예시는 복합 슬롯 유형의 JSON 구조를 보여줍니다.

{ "name": "CarCompositeType", "identifier": "TPA3CC9V", "description": null, "slotTypeValues": null, "parentSlotTypeSignature": null, "valueSelectionSetting": { "regexFilter": null, "resolutionStrategy": "CONCATENATION" }, "compositeSlotTypeSetting": { "subSlots": [ { "name": "model", "slotTypeId": "MODELTYPEID" # custom slot type Id for model }, { "name": "city", "slotTypeId": "AMAZON.City" }, { "name": "country", "slotTypeId": "AMAZON.Country" }, { "name": "make", "slotTypeId": "MAKETYPEID" # custom slot type Id for make } ] } }

다음은 사용자 지정 문법을 사용하여 고객의 말을 이해하는 슬롯 유형입니다. 자세한 내용은 문법 슬롯 유형 단원을 참조하세요.

{ "name": "custom_grammar", "identifier": "7KEAQIQKPX", "description": "Slot type using a custom grammar", "slotTypeValues": null, "parentSlotTypeSignature": null, "valueSelectionSetting": null, "externalSourceSetting": { "grammarSlotTypeSetting": { "source": { "kmsKeyArn": "arn:aws:kms:Region:123456789012:alias/customer-grxml-key", "s3BucketName": "grxml-test", "s3ObjectKey": "grxml_files/grammar.grxml" } } } }

사용자 지정 어휘 파일 구조

사용자 지정 어휘 파일에는 단일 언어 또는 로캘에 대한 사용자 지정 어휘의 항목이 포함되어 있습니다. .zip 파일에는 사용자 지정 어휘가 있는 각 로캘에 대한 사용자 지정 어휘 파일이 하나씩 있습니다.

다음은 식당 주문을 받는 봇을 위한 사용자 지정 어휘 파일입니다. 봇에는 로캘당 하나의 파일이 있습니다.

{ "customVocabularyItems": [ { "weight": 3, "phrase": "wafers" }, { "weight": null, "phrase": "extra large" }, { "weight": null, "phrase": "cremini mushroom soup" }, { "weight": null, "phrase": "ramen" }, { "weight": null, "phrase": "orzo" } ] }