Architecture overview
This section provides a reference implementation architecture diagram for the components deployed with this solution.
Architecture diagram
Deploying this solution with the default parameters deploys the following components in your AWS account (components with dotted line border are optional).
The high-level process flow for the solution components deployed
with the
AWS CloudFormation
-
The admin deploys the solution into their AWS account, opens the content designer UI or Amazon Lex
web client, and uses Amazon Cognito to authenticate. -
After authentication, Amazon API Gateway
and Amazon S3 deliver the contents of the content designer UI. -
The admin configures questions and answers in the content designer and the UI sends requests to Amazon API Gateway to save the questions and answers.
-
The
Content designer
AWS Lambdafunction saves the input in Amazon OpenSearch Service in a question bank index. If using text embeddings, these request pass through LLMs hosted on Amazon SageMaker or Amazon Bedrock to generate embeddings before being saved into the question bank on OpenSearch. In addition, the Content designer saves default and custom configuration settings in the AWS Systems Manager Parameter Store. -
Chatbot users interact with Amazon Lex via the web client UI, Amazon Alexa
, or Amazon Connect . -
Amazon Lex forwards requests to the
Bot fulfillment
Lambda function. Users can also send requests to this Lambda function via Amazon Alexadevices. -
The user and chat information is stored in Amazon DynamoDB
to disambiguate follow-up questions from previous question and answer context. -
The
Bot fulfillment
AWS Lambda function takes the user’s input and uses Amazon Comprehendand Amazon Translate (if necessary) to translate non-native language requests to the native language selected during the deployment, and then looks up the answer in OpenSearch Service. If using LLM features such as text generation and text embeddings, these requests first pass through various LLMs hosted on SageMaker or Amazon Bedrock to generate the search query and embeddings to compare with those saved in the question bank on OpenSearch. -
If no match is returned from the OpenSearch question bank, then the
Bot fulfillment
Lambda function forwards the request as follows:-
If an Amazon Kendra
index is configured for fallback, then the Bot fulfillment
Lambda function forwards the request to Amazon Kendra if no match is returned from the OpenSearch question bank. The text generation LLM can optionally be used to create the search query and to synthesize a response from the returned document excerpts. -
If an Amazon Bedrock Knowledge Base
ID is configured, then the Bot fulfillment
Lambda function forwards the request to the Amazon Bedrock knowledge base. TheBot Fulfillment
Lambda function leverages theRetrieveAndGenerate
API Gateway API to fetch the relevant results for a user query, augment the foundational model's prompt, and return the response.
-
-
User interactions with the
Bot fulfillment
Lambda function generate logs and metrics data, which is sent to Amazon Data Firehoseand then to Amazon S3 for later data analysis. -
The OpenSearch Dashboards can be used to view usage history, logged utterances, no hits utterances, positive user feedback, and negative user feedback, and also provides the ability to create custom reports.