Bot
Source:
src/AWS/LexV2/Bot.ts
An Amazon Lex V2 conversational bot. The bot is the container for locales, intents, and slot types; conversations run against an alias of a built version.
Creating a Bot
Section titled “Creating a Bot”Basic Bot
import * as AWS from "alchemy/AWS";
const role = yield* AWS.IAM.Role("BotRole", { assumeRolePolicyDocument: { Version: "2012-10-17", Statement: [ { Effect: "Allow", Principal: { Service: "lexv2.amazonaws.com" }, Action: ["sts:AssumeRole"], }, ], },});
const bot = yield* AWS.LexV2.Bot("OrderBot", { roleArn: role.roleArn,});Bot with Session and Privacy Settings
const bot = yield* AWS.LexV2.Bot("KidsBot", { roleArn: role.roleArn, dataPrivacy: { childDirected: true }, idleSessionTTL: "10 minutes", description: "A bot for children",});Building the Conversation Graph
Section titled “Building the Conversation Graph”const locale = yield* AWS.LexV2.BotLocale("En", { botId: bot.botId, localeId: "en_US",});const intent = yield* AWS.LexV2.Intent("Greet", { botId: locale.botId, localeId: locale.localeId, sampleUtterances: ["hello", "hi"],});const version = yield* AWS.LexV2.BotVersion("V1", { botId: intent.botId, localeIds: [intent.localeId],});const alias = yield* AWS.LexV2.BotAlias("Live", { botId: version.botId, botVersion: version.botVersion,});