![Generative AI Serverless - RAG using Bedrock Knowledge base, & Single document chat via AWS Console!](https://assets.community.aws/a/2h9sAHSNVLkhSAqMOa7jVWMeI70/Comm.webp)
Generative AI Serverless - RAG using Bedrock Knowledge base, & Single document chat via AWS Console!
RAG using Bedrock Knowledge base, & Single document chat via Anthropic Sonnet model.
Published May 29, 2024
Generative AI - Has Generative AI captured your imagination to the extent it has for me?
Generative AI is indeed fascinating! The advancements in foundation models have opened up incredible possibilities. Who would have imagined that technology would evolve to the point where you can generate content summaries from transcripts, have chatbots that can answer questions on any subject without requiring any coding on your part, or even create custom images based solely on your imagination by simply providing a prompt to a Generative AI service and foundation model? It's truly remarkable to witness the power and potential of Generative AI unfold.
'Chat with your document' is the latest Generative AI feature added by Amazon to its already feature-rich areas of GenAI, Knowledge Base, and RAG.
RAG, which stands for Retrieval Augmented Generation, is becoming increasingly popular in the world of Generative AI. It allows organizations to overcome the limitations of LLMs and utilize contextual data for their Generative AI solutions.
Amazon Bedrock is a fully managed service that offers a choice of many foundation models, such as Anthropic Claude, AI21 Jurassic-2, Stability AI, Amazon Titan, and others.
I will use the recently released Anthropic Sonnet foundation model and invoke it via the Amazon Console Bedrock Knowledge Base. As of May 2024, this is the only model supported by AWS for the single document knowledge base or 'Chat with your document' function.
There are many use cases where generative AI chat with your document function can help increase productivity. Few examples will be technical support extracting info from user manual for quick resolution of questions from the customers, or HR answering questions based on policy documents or developer using technical documentation to get info about specific function or a call center team addressing inquiries from customers quickly by chatting with product documentation.
Let's look at our use cases:
- MyBankGB, a fictitious bank, offers various credit cards to consumers. The document "MyBankGB Credit Card Offerings.pdf" contains detailed information about all the features and details of the credit cards offered by the bank.
- MyBankGB is interested in implementing a Generative AI solution using the "Chat with your document" function of Amazon Bedrock Knowledge Base. This solution will enable the call center team to quickly access information about the card features and efficiently address customer inquiries.
- This is a proof of concept hence API based solution not required, rather access will be provided to selected call center team members via AWS Console for Bedrock knowledge base chat with your document function.
Here is the architecture diagram for our use case.
![AWS Bedrock Knowledge Base - Chat with your document AWS Bedrock Knowledge Base](https://assets.community.aws/a/2h9sUhsX725N6JlFs1dzGCPisop/Bedr.webp)
Let's see the steps to create a single document knowledge base in Bedrock and start consuming it using AWS Console.
Review AWS Bedrock 'Chat with your document
Chat with document is a new feature. You can use it via AWS Console or can use SDK to invoke it via Bedrock, Lambda and API.
![Amazon Bedrock Knowledge Base - Chat with your document Amazon Bedrock Knowledge Base](https://assets.community.aws/a/2h9siPGEIT0v6FBxSDpoCr7Lxud/img1.webp)
For Data, you can upload a file from your computer OR you can provide ARN for the file posted in the S3 bucket.
![Chat with your document - Anthropic Sonnet Chat with your document - Anthropic Sonnet](https://assets.community.aws/a/2h9smc2qiqL8un4UIpyUhjfm5R6/img2.webp)
Select model. Anthropic Claude 3 Sonnet is the only supported model as of May, 2024.
Request Model Access
Before you can use the model, you must request access to the model.
Chat with your document using AWS Console
Letβs chat with the document and review responses.
![Chat with your document Chat with your document](https://assets.community.aws/a/2h9uTmCxWYJzBLtUSIgWmcdi66y/c1-p.webp)
Review the response
![Chat with your document Chat with your document](https://assets.community.aws/a/2h9uWbkT6p4tKyagl7WFnuGEf0c/c2-p.webp)
Let's review more prompts and responses!
![Chat with your document Chat with your document](https://assets.community.aws/a/2h9uZAgjcXheMS84QaO9vVE6FUk/c3-p.webp)
![Chat with your document Chat with your document](https://assets.community.aws/a/2h9ubBXBVosJ9R0p4Ok58LbLKg6/c4-p.webp)
As you can see above, all answers are provided in the context of the document uploaded in the S3 bucket. This is where RAG makes the generative AI responses more accurate and reliable, and controls the hallucination.
With these steps, a serverless GenAI solution has been successfully implemented to build a serverless GenAI RAG solution for creating a single-document knowledge base using the Amazon Bedrock Console. Selected call center team members who have access to the AWS Console and the Anthropic Sonnet model can utilize the 'chat with your document' function and then provide feedback on whether an automated solution using APIs should be developed.
As GenAI solutions keep improving, they will change how we work and bring real benefits to many industries. This workshop shows how powerful AI can be in solving real-world problems and creating new opportunities for innovation.
Thanks for reading!
Click here to get to YouTube video for this solution.
π’πΎππΎππ½ β¬π½πΆππΎπΆ
πππ ππ¦π³π΅πͺπ§πͺπ¦π₯ ππ°ππΆπ΅πͺπ°π― ππ³π€π©πͺπ΅π¦π€π΅ & ππ¦π·π¦ππ°π±π¦π³ ππ΄π΄π°π€πͺπ’π΅π¦
πππ°πΆπ₯ ππ¦π€π©π―π°ππ°π¨πΊ ππ―π΅π©πΆπ΄πͺπ’π΄π΅
Β
Β