Format JSON untuk mengimpor dan mengekspor - Amazon Lex

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Format JSON untuk mengimpor dan mengekspor

Anda mengimpor dan mengekspor bot, lokal bot, atau kosakata khusus dari Amazon Lex V2 menggunakan file.zip yang berisi struktur JSON yang menggambarkan bagian-bagian sumber daya. Saat Anda mengekspor sumber daya, Amazon Lex V2 membuat file.zip dan membuatnya tersedia untuk Anda menggunakan URL yang telah ditandatangani sebelumnya Amazon S3. Saat mengimpor sumber daya, Anda harus membuat file.zip yang berisi struktur JSON dan mengunggahnya ke URL yang telah ditandatangani sebelumnya S3.

Amazon Lex membuat struktur direktori berikut dalam file.zip saat Anda mengekspor bot. Saat Anda mengekspor lokal bot, hanya struktur di bawah lokal yang diekspor. Saat Anda mengekspor kosakata khusus, hanya struktur di bawah kosakata khusus yang diekspor.

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 ...

Struktur file manifes

File manifes berisi metadata untuk file ekspor.

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

Struktur file bot

File bot berisi informasi konfigurasi untuk bot.

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

Struktur file lokal bot

File lokal bot berisi deskripsi lokal atau bahasa bot. Saat Anda mengekspor bot, bisa ada lebih dari satu file lokal bot di file.zip. Saat Anda mengekspor lokal bot, hanya ada satu lokal di file zip.

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

Struktur file maksud

File maksud berisi informasi konfigurasi untuk maksud. Ada satu file intent dalam file.zip untuk setiap intent di lokal tertentu.

Berikut ini adalah contoh struktur JSON untuk BookCar maksud dalam bot sampelBookTrip. Untuk contoh lengkap struktur JSON untuk intent, lihat operasinya. 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 } ] }

Struktur file slot

File slot berisi informasi konfigurasi untuk slot dalam maksud. Ada satu file slot di file.zip untuk setiap slot yang ditentukan untuk maksud di lokal tertentu.

Contoh berikut adalah struktur JSON dari slot yang memungkinkan pelanggan untuk memilih jenis mobil yang ingin mereka sewa dalam BookCar maksud dalam bot BookTrip contoh. Untuk contoh lengkap dari struktur JSON untuk slot, lihat CreateSlotoperasi.

{ "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, } }

Contoh berikut menunjukkan struktur JSON slot komposit.

{ "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)" } }

Struktur file tipe slot

File jenis slot berisi informasi konfigurasi untuk jenis slot khusus yang digunakan dalam bahasa atau lokal. Ada satu file jenis slot di file.zip untuk setiap jenis slot khusus di lokal tertentu.

Berikut ini adalah struktur JSON untuk jenis slot yang mencantumkan jenis mobil yang tersedia di bot BookTrip contoh. Untuk contoh lengkap dari struktur JSON untuk jenis slot, lihat CreateSlotTypeoperasi.

{ "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 } }

Contoh berikut menunjukkan struktur JSON untuk jenis slot komposit.

{ "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 } ] } }

Berikut ini adalah jenis slot yang menggunakan tata bahasa khusus untuk memahami ucapan pelanggan. Untuk informasi selengkapnya, lihat Jenis slot tata bahasa.

{ "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" } } } }

Struktur file kosakata khusus.

File kosakata khusus berisi entri dalam kosakata khusus untuk satu bahasa atau lokal. Ada satu file kosakata khusus dalam file.zip untuk setiap lokal yang memiliki kosakata khusus.

Berikut ini adalah file kosakata khusus untuk bot yang menerima pesanan restoran. Ada satu file per lokal di bot.

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