匯入及匯出的 JSON 格式 - Amazon Lex V1

如果您使用的是 Amazon Lex V2,請改參閱 Amazon Lex V2 指南

 

如果您使用的是 Amazon Lex V1,建議您將機器人升級至 Amazon Lex V2。我們不再將新功能新增至 V1,強烈建議所有新機器人都使用 V2。

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

匯入及匯出的 JSON 格式

下列範例示範以 Amazon Lex 格式,匯出及匯入參數槽類型、意圖和機器人的 JSON 結構。

參數槽類型結構

以下為自訂參數槽類型的 JSON 結構。當您匯入或匯出參數槽類型時,以及當您匯出相依於自訂參數槽類型的意圖時,請使用此結構。

{ "metadata": { "schemaVersion": "1.0", "importType": "LEX", "importFormat": "JSON" }, "resource": { "name": "slot type name", "version": "version number", "enumerationValues": [ { "value": "enumeration value", "synonyms": [] }, { "value": "enumeration value", "synonyms": [] } ], "valueSelectionStrategy": "ORIGINAL_VALUE or TOP_RESOLUTION" } }

意圖結構

以下為意圖的 JSON 結構。當您匯入或匯出意圖以及相依於意圖的機器人時,請使用此結構。

{ "metadata": { "schemaVersion": "1.0", "importType": "LEX", "importFormat": "JSON" }, "resource": { "description": "intent description", "rejectionStatement": { "messages": [ { "contentType": "PlainText or SSML or CustomPayload", "content": "string" } ] }, "name": "intent name", "version": "version number", "fulfillmentActivity": { "type": "ReturnIntent or CodeHook" }, "sampleUtterances": [ "string", "string" ], "slots": [ { "name": "slot name", "description": "slot description", "slotConstraint": "Required or Optional", "slotType": "slot type", "valueElicitationPrompt": { "messages": [ { "contentType": "PlainText or SSML or CustomPayload", "content": "string" } ], "maxAttempts": value }, "priority": value, "sampleUtterances": [] } ], "confirmationPrompt": { "messages": [ { "contentType": "PlainText or SSML or CustomPayload", "content": "string" }, { "contentType": "PlainText or SSML or CustomPayload", "content": "string" } ], "maxAttempts": value }, "slotTypes": [ List of slot type JSON structures. For more information, see 參數槽類型結構. ] } }

機器人結構

以下為機器人的 JSON 結構。當您匯入或匯出機器人時,請使用此結構。

{ "metadata": { "schemaVersion": "1.0", "importType": "LEX", "importFormat": "JSON" }, "resource": { "name": "bot name", "version": "version number",, "nluIntentConfidenceThreshold": 0.00-1.00, "enableModelImprovements": true | false, "intents": [ List of intent JSON structures. For more information, see 意圖結構. ], "slotTypes": [ List of slot type JSON structures. For more information, see 參數槽類型結構. ], "voiceId": "output voice ID", "childDirected": boolean, "locale": "en-US", "idleSessionTTLInSeconds": timeout, "description": "bot description", "clarificationPrompt": { "messages": [ { "contentType": "PlainText or SSML or CustomPayload", "content": "string" } ], "maxAttempts": value }, "abortStatement": { "messages": [ { "contentType": "PlainText or SSML or CustomPayload", "content": "string" } ] } } }