Skip to main content

Guidance for Building Custom Chatbots for Order Recommendations Using Agents for Amazon Bedrock

Build chatbots tailored to your customer

Overview

This Guidance shows how to build an AI-generated chatbot using the Amazon Bedrock suite of services. The chatbot employs a Retrieval-Augmented Generation (RAG) process, which optimizes the output of a large language model by referencing an authoritative knowledge base, thereby providing more contextual and informed responses. And by integrating with the user's existing internal systems and data sources, the chatbot enables the generation of context-specific responses, such as recommendations based on order history, order placement, order status, and order tracking information. After configuring this Guidance, users can quickly build a highly personalized and efficient conversational AI application that integrates with their business operations.

How it works

This architecture diagram shows how to build a serverless, scalable generative AI chatbot using both Agents for Amazon Bedrock and Knowledge Bases for Amazon Bedrock. The chatbot can integrate with internal systems to provide personalized recommendations, order placement, and order status.

Well-Architected Pillars

The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.

Lambda, API Gateway, and Amazon Cognito are serverless services that help users achieve operational excellence by reducing the operational overhead of managing infrastructure. With Lambda, users can run code without provisioning or managing servers, enabling them to focus on their application logic rather than infrastructure management. API Gateway provides a fully managed service for creating, publishing, and securing APIs, eliminating the need to manage API infrastructure. Amazon Cognito simplifies user authentication and authorization, allowing users to offload the complexities of identity management to a managed service.

Read the Operational Excellence whitepaper

CloudFront increases the security of the web application with data encryption, geographic restriction, and integration with AWS WAF to protect against common exploits and AWS Shield Standard for distributed denial of service (DDoS) attacks. AWS Identity and Access Management (IAM) supplies the least privileges to users and services and integrates into Amazon Cognito to manage roles and policies. Furthermore, API Gateway is able to throttle requests and integrates with Amazon Cognito to provide authorization to the endpoint.

Read the Security whitepaper

API Gateway and Lambda provide reliability to an application by decoupling the backend logic from the frontend, allowing for a scalable and fault-tolerant infrastructure. Specifically, API Gateway handles incoming requests and routes them to the appropriate Lambda functions, which can automatically scale up or down based on demand for high availability and resiliency of the application.

Read the Reliability whitepaper

Lambda automatically scales compute resources to handle fluctuating workloads. It supports efficient resource utilization and provides improved computational performance through the use of AWS Graviton Processors in comparison to the more traditional Intel 8086 microprocessor and its successors. In addition, Amazon Bedrock offers pre-optimized large language models and GPU-backed inference capabilities to accelerate AI-powered applications. Lastly, Amazon OpenSearch Serverless automatically scales compute and storage resources to meet the demands of search and analytics workloads.

Read the Performance Efficiency whitepaper

CloudFront optimizes costs by caching content at edge locations, thereby reducing the need to serve data directly from the origin server. API Gateway offers a pay-as-you-go pricing model and caching capabilities to minimize backend service calls. Lambda also provides cost optimization by enabling users to execute code without the need for provisioning or managing servers, charging only for the consumed compute time. Lastly, Amazon S3 offers flexible storage classes, allowing users to align storage costs with their specific data access patterns.

Read the Cost Optimization whitepaper

API Gateway, Lambda, OpenSearch Serverless, Amazon S3, and Amazon Bedrock all contribute to sustainability through their serverless and cloud-native architectures. These services minimize the need for physical hardware and infrastructure, reducing the overall energy and resource consumption required to run applications. By abstracting away the underlying infrastructure, these services enable developers to focus on building and deploying their applications without the burden of managing servers, networks, and other low-level resources.

Read the Sustainability whitepaper

Disclaimer

The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running Amazon EC2 instances or using Amazon S3 storage.References to third-party services or organizations in this Guidance do not imply an endorsement, sponsorship, or affiliation between Amazon or AWS and the third party. Guidance from AWS is a technical starting point, and you can customize your integration with third-party services when you deploy the architecture.