Use Amazon Q Business to Chat with Documents and Systems
Amazon Q Business is a generative AI assistant that streamlines tasks, extracts insights, and summarizes organizational information.
Published Dec 9, 2024
Last Modified Dec 10, 2024
Retrieval Augmented Generation (RAG) workflows enable AI systems to integrate relevant information with pre-trained models, enhancing the accuracy of their outputs. On AWS, you can set up these workflows in two ways: build your own custom pipeline or use AWS’s fully managed services.
Managed services are simple to use because they take care of most of the complex tasks for you. However, they may not offer the flexibility to customize everything to fit your specific needs. If you want a fast and hassle-free solution, managed services are a great choice.
As stated in the AWS Prescriptive Guidance, AWS offers the following managed tools to help with RAG workflows:
- Knowledge Bases for Amazon Bedrock
- Amazon Q Business
- Amazon SageMaker Canvas
Among these, Amazon Q Business is the most recommended for fully managed RAG setups. Still, it might not work for every situation. You may consider other options if:
- The service is not available in your AWS region, and moving your data is not possible.
- Your workflow needs special customization that Amazon Q Business does not offer.
- You need to connect to an existing database or a specific AI model.
In this post, I will show you how to use Amazon Q Business to interact with a knowledge base and a system. For a step-by-step guide, I developed an Amazon Q Business workshop to help you set up and use the application with ease.
The workshop demonstrates how the Q application enables end users to explore lunch menu options and make table reservations seamlessly. Additionally, it showcases how a banking user can query FAQ information from an uploaded file data source and control the application’s responses based on specific topics.
1. Set Up User Access
First, create a federated identity for user access. In this example, we’re using AWS IAM Identity Center.
Once that’s done, create a Q application and assign users from the Identity Center. After that, you’re ready to set up your knowledge bases.
2. Connect Data Sources
Amazon Q Business can connect to various data sources, like databases, SaaS platforms, and more. In this example, we’re using Amazon S3, a web crawler, and uploaded files as our data sources.
3. Interact with the Q Application
Access your Q application via the Deployed URL, sign in with the user you set up earlier, and start asking questions based on your configured data.
- “When will I receive a debit card after opening an account?”
- “What are the options on the lunch menu?”
If answers aren’t available in your data sources, you can switch to a pre-trained model for general knowledge.
You can also generate content, like creating email templates, directly from the application.
- “Your task is to create a reminder email template for guests who have already reserved a table for the Wednesday lunch special menu. Use clear, professional language and appropriate formatting, including an opening, a summary, and bullet points. Ensure the email is easy to understand and provides a succinct overview of the content.”
4. Control message returned
Customize the Q application to use pre-trained models when your knowledge base doesn’t have the answer.
For example, ask, “What is ChatGPT?”, and it’s not in the data sources, the app will fall back to the pre-trained model to provide an answer.
You can also control specific topics by configuring rules to use enterprise data or block certain inputs.
Try asking “Should I invest in Bitcoin?” to see a custom blocking message in action.
5. Integrate with Third-Party Systems
Amazon Q Business can handle tasks like creating Jira tickets using built-in plugins. You can also create custom plugins to connect to your own systems by defining interactions with OpenAPI schemas.
In this example, you can book a restaurant table using natural language. The app will create a request, send it to the server, and return a response.
Then, use the booking ID to check or cancel the reservation.
The app will generate the appropriate APIs and send them to the system for you.
Conclusion
Amazon Q Business provides a quick and efficient way to build a fully managed RAG workflow on AWS. With built-in data source connectors, you don’t need to worry about choosing embedding models or managing embedding data stores. It also supports integration with third-party systems, enhancing its functionality. With its simple setup and versatile features, Amazon Q Business helps teams, especially internal users, boost productivity and efficiently manage repetitive tasks like IT support, HR queries, and more.
For the latest updates, features, and announcements about Amazon Q, visit the official AWS Blog at Category: Amazon Q. Stay informed about how Amazon Q can enhance your productivity and AWS experience.”
P.S. The blog is cross-posted from the DoiT Engineer blog.