AWS Logo
Menu
Amazon Q custom connector to Amazon Q Business

Amazon Q custom connector to Amazon Q Business

A quick overview on how to implement Amazon Q custom connector

Nitin Eusebius
Amazon Employee
Published Aug 21, 2024
Last Modified Oct 1, 2024
Amazon Q Business is a generative AI–powered assistant that can answer questions, provide summaries, generate content, and securely complete tasks based on data and information in your enterprise systems. It empowers employees to be more creative, data-driven, efficient, prepared, and productive.

Connecting Amazon Q custom connector to Amazon Q Business

You can use a custom data source when you have a repository that Amazon Q Business doesn’t yet provide a data source connector for. When you create a custom data source, you have complete control over how the documents to index are selected. Amazon Q only provides metric information that you can use to monitor your data source sync jobs. You must create and run the crawler that determines the documents your data source indexes.
We can also use Amazon Q Business Amazon S3 connector to export your content to Amazon S3 as an alternative.
Lets take a look at a sample on how to use custom data source. Here we will index some of the public websites info for user to ask questions. As you can see below that when you set up Amazon Biz Q for your enterprise data only, it may not be able to answer questions which are outside your data.
Note: This is demo code for illustrative purposes only. Not intended for production use.

Prerequisites

Before we get started, we need to have the following prerequisites in place
  1. A valid working AWS account with required resource access and CLI configuration
  2. Latest boto3 version
  3. Amazon Q Business set up, please visit getting started guide
    1. Complete the steps to create your Amazon Q application.
    2. Complete the steps for selecting an Amazon Q retriever.

Getting Started

Now lets quickly set up the custom connector. The below functions are created to help collect and create sample data. You can view the required attributes info here
Next we will set up required configuration values. These values are present in your created application
Now start the data source sync job and save the returned job execution id which will be used further.
Now we will create the sample documents passing in the datasource id and job execution id to be included in the json document as mentioned in the documentation before.
The sample document to be pushed looks like below
Then we will call batch_put_document passing in the documents including application id, index id and role arn
Once the sync is completed you can retry the previous queries. As you can see now we are able to get our synced data and also able to verify the custom source_uri as well.
In this post we saw how we can leverage the AWS Enterprise Q APIs to create their own custom connectors and push content directly into Amazon Q Business from any content repository.
Happy Building!
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments