Skip to main content

Generative AI

From Concepts to Creation: Building Amazon Q Application with Amazon S3 Integration

Two programmers working on some coding together

Amazon Q is a fully managed, generative AI powered assistant created by Amazon Web Services. As per press release – ‘Amazon Q can help you get fast, relevant answers to pressing questions, solve problems, generate content, and take actions using the data and expertise found in your company’s information repositories, code, and enterprise systems’. With Amazon Q, you can build an interactive chat application for your organization’s end users, using a combination of your enterprise data and large language model knowledge.

Amazon Q works by using generative AI techniques to understand questions, find relevant information from data sources, and provide helpful responses. When a user askes question, it analyzes the question using natural language understanding and searches through connected data sources to find relevant answers. Amazon Q aims to have natural conversations to resolve issues by understanding follow up questions in the context of the full dialogue.

Amazon Q uses Retrieval Augmented Generation (RAG) and Large Language Models (LLMs) to provide more helpful responses. With RAG, when you ask a question, Amazon Q:

  1. Searches relevant information from various data sources connected to it, like documentation, code repositories etc.
  2. Understands the question context using the retrieved information along with its training.
  3. Generates a response based on both the retrieved data and its own knowledge, to give a more accurate and informative answer tailored to your specific question.

This helps to address limitations of only using LLM knowledge like lack of traceability, inability to reference multiple data sources etc. Amazon Q aims to seamlessly integrate RAG capabilities to provide customized assistance for your AWS workflows.

A retriever in Amazon Q is used to fetch documents stored in a search index. When a user asks a question, the retriever finds documents relevant to the query and uses it to generate answers. Retriever must be connected to single or multiple data source. Amazon Q can connect to supported data sources like databases, file shares etc. to retrieve documents. In this blog post, let’s walk through the steps of building Amazon Q application with AWS S3 as data source.

 

Prerequisites:

IAM Role – You need IAM role that allows Amazon Q to communicate with S3 on your behalf. IAM role should have policies to get objects, list of buckets from S3. Also, role should have policies to ingest documents in Amazon Q.

S3 object – You need to have object in S3 path that has data you want application to train with.

 

Following are the steps that can be followed to create Amazon Q application with S3 data source:

Step 1) Open Amazon Q service using AWS console and click on ‘Create application’ button as shown in below screenshot:

Step 1

Step 2) New page, as shown in below screenshot, will open after completion of step 1. You must provide name for application. Use the service role having appropriate permissions. Click on ‘Create’ button.

Step 2

After hitting ‘Create’, it takes few minutes to create the application.

 

Step 3) In this step, retriever type needs to be selected for your application. As shown in the below screenshot, select ‘Use native retriever’ and hit ‘Next’.

Step 3

Step 4) As shown in the below screenshot, Amazon Q provides options for data sources. You have to click on ‘+’ sign in ‘Amazon S3’ option.

Step 4

Step 5) As shown in the below screenshot, provide name to the data source in ‘Data source name’ section.

Step 5

Select IAM role in ‘IAM role’ section. This role should have policies that are discussed in prerequisite section of this blog. In ‘Sync scope’ section, click on ‘Browse S3’ to get option to select the path to object in S3.

Step 5a

After clicking on ‘Browse S3’, select object referring to below screenshot and hit ‘Choose’.

Step 5b

Select the needed frequency to sync data source and click on ‘Add data source’.

Step 5c

Step 6) After action from step 5, Amazon Q provides option to add data source again. If needed, you can add new data source else click on ‘Create application’ as shown in below screenshot.

Step 6

After completing above steps, you have successfully created the Amazon Q application. You can find your application listed under ‘Applications’ section on Amazon Q dashboard as shown below:

Step 6a

Step 7) Open the application. In the ‘Data sources’ section, select the data source and hit ‘Sync now’.

Step 7

Amazon Q can take from a few minutes to few hours. Sync speeds are dependent on factors such as remote repository throughput and throttling, network bandwidth, and the size of documents. During this step, ‘Current sync state’ changes from ‘Idle’ to ‘Syncing-indexing’ to ‘Idle’. Once the sync process completes, the system updates the ‘Last sync time’ and ‘Last sync status’ as shown in the screenshot below:

Step 7a

 

Step 8) Once the data source syncs, the application becomes ready for web preview. Click on ‘Preview web experience’ as below:

Step 8

Once the preview is open, you can update the title, subtitle, and welcome message. This is the place where you can have a preview of how your application is going to respond to questions related to the dataset.

Step 8a

By following the steps covered so far, one can create an Amazon Q application that enables users to preview the web experience.

If you want end users to login and chat, then deploy application from Amazon Q application main page as shown below:

Step 8b

To deploy the web experience, identity provider must be complaint with SAML 2.0 standard. This enables authentication of authorized users.

As Amazon Q service is in preview, service me come up with updates in future. Hence, there is possibility of changes in above steps. Amazon Q offers flexible pricing plans to suit different business needs. The exact costs depend on factors like the number of users, features required and usage. For the most accurate and up-to-date pricing information, please check the link. Amazon Q marks one more breakthrough in the world of Generative AI. As businesses want to embrace AI, simple services like Amazon Q can help businesses to implement applications that allows interaction with data.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Akshay Admane

Akshay Admane works at Perficient as a Lead Technical Consultant and brings a wealth of expertise in data engineering to the forefront. He is passionate about exploring new technologies and learning new things to stay productive.

More from this Author

Categories
Follow Us