This project demonstrates how to build a bilingual (English/Japanese) banking chatbot using AWS Lex V2 for conversational interface, AWS Lambda for backend logic, and Amazon Bedrock (with Anthropic Claude Instant) for generative AI capabilities. It simulates core banking tasks like checking balance and transferring funds, specifically targeting the Asia Pacific (Tokyo) ap-northeast-1
AWS region.
Note: This project is built for learning purposes and uses simulated data and simplified security. It is not production-ready for real banking operations.
Project Components & Uses:
✅ AWS Lex V2: Serves as the core conversational engine.
Manages the dialogue flow based on defined intents and slots.
Supports both English (en-US) and Japanese (ja-JP) languages.
Uses aliases (TestBotAlias
) to manage versions (in a production scenario).
✅ AWS Lambda: Provides the backend logic for the chatbot.
Receives requests from Lex via fulfillment code hooks.
Processes user requests for balance checks and transfers.
Generates simulated banking data (balances, confirmation numbers).
Selects appropriate responses based on language and intent.
✅ Amazon Bedrock (with Anthropic Claude Instant): Integrates generative AI capabilities.
Used by Lambda to generate more natural responses for English balance inquiries and fallback messages (in both languages).
Requires explicit model access and IAM permissions.
✅ IAM Roles: Manages secure access between AWS services.
A custom role for Lex (LexV2BotRole-ProBilingual-Tokyo
) allows it to invoke Lambda.
A role for Lambda (LambdaExecutionRole-ProBilingual-Tokyo
) allows it to write logs and invoke Bedrock.
A role for Cognito Identity Pool allows the frontend to call Lex (simplified security).
✅ Bilingual Localization: Text strings, prompts, and messages are managed within Lambda to support both English and Japanese correctly based on the user’s chosen language/locale.
Includes specific mapping logic in Lambda (JA_ACCOUNT_MAP
) to translate canonical English slot values (like “Checking”) back to their Japanese terms (like “普通預金”) for display in final messages.
✅ Date Input Validation: Implements a custom validation check within the Lambda DialogCodeHook for the dateOfBirth
slot to ensure the user provides input in the correct YYYY-MM-DD format, re-prompting if invalid.
✅ Custom Transfer Confirmation: Disables Lex’s built-in confirmation and uses the Lambda DialogCodeHook to generate and return a ConfirmIntent
response with a fully localized Japanese confirmation prompt for MakeTransfer
, ensuring correct account names are displayed.
✅ Context Management: Uses Lex output/input contexts (contextCheckBalance
) to carry over information (like date of birth verification status) between intents (CheckBalance
and FollowupCheckBalance
), enabling smoother follow-up conversations.
✅ Simulated Backend: All banking data and transactions are simulated within the Lambda code; no connection to real financial systems exists.
⬜ Frontend Chat Interface: A basic HTML, CSS, and JavaScript application that runs in a web browser, providing a visual interface for users to interact with the Lex bot API (using Amazon Cognito for simplified authentication).
✅ CloudWatch Logs: Provides detailed logs from the Lambda function for monitoring, debugging, and analyzing bot behavior.