Amazon Q Business is an AI-powered generative assistant that can answer questions, provide summaries, generate content, and securely complete tasks based on the data and information in your enterprise systems. Most of that information is contained in text descriptions stored in various document formats such as PDFs, Word files, and HTML pages. Some information is also stored in the same document type, in CSV, or in tables embedded in spreadsheets, such as pricing tables and product specification tables. Amazon Q Business can provide accurate answers from descriptive text, but getting answers from these tables requires special processing of more structured information.
On November 21, 2024, Amazon Q Business began supporting tabular search. You can use it to extract answers from tables embedded in documents ingested into Amazon Q Business. Tabular search is a built-in feature of Amazon Q Business that works seamlessly across many domains and requires no configuration by administrators or end users.
This post ingests different types of documents that include tables and shows how Amazon Q Business responds to questions related to the data in the tables.
Prerequisites
To proceed with this tutorial, you must meet the following prerequisites:
- An AWS account where you can follow the steps in this post.
- Requires at least one Amazon Q Business user. For more information, see Amazon Q Business Pricing.
- You must enable cross-region inference in your Amazon Q application.
- Amazon Q Business applications created after November 21, 2024 will automatically benefit from the new features. If your application was created before this date, you will need to re-populate the content and update the index.
Tabular search overview
Tabular search extends the power of Amazon Q Business to find answers beyond paragraphs of text and analyzes tables embedded in corporate documents to get answers to a wide range of queries, including finding facts from tables. You can.
Amazon Q Business’s tabular search allows you to ask questions like, “What credit card has the lowest APR and no annual fee?” or “Which credit cards offer travel insurance?” You can find the answer in a product comparison table, within a marketing PDF stored in your internal repository, or on your website.
This feature supports a wide range of file formats, including PDF, Word documents, CSV files, Excel spreadsheets, HTML, and SmartSheet (via the SmartSheet connector). In particular, tabular search can also extract data from tables represented as images in a PDF, or retrieve information from single or multiple cells. Additionally, you can perform aggregation of numerical data to provide valuable insights to your users.
Ingest documents with Amazon Q Business
Follow these steps to create an Amazon Q Business application, an acquirer, and an index to retrieve data in real time during a conversation. Create and configure an Amazon Q application Section “Discovering Insights from Amazon S3 using the Amazon Q S3 Connector” in the AWS Machine Learning blog post.
This post uses The World’s Billionaires, which lists the world’s top 10 billionaires from 1987 to 2024 in a tabular format. This data can be downloaded as a PDF from Wikipedia using the following link. tool menu. Upload the PDF to an Amazon Simple Storage Service (Amazon S3) bucket to use as a data source for your Amazon Q Business application.
Run a query on Amazon Q
You can start asking questions to Amazon Q using the following command: Web experience URLYou can find it at application page as shown in the following screenshot.
Let’s say you want to know the ratio of men to women on Forbes’ 2024 World’s Richest List. As you can see from the following screenshot, of billionaires of the world PDF, there were 383 women and 2398 men.
To pull that information from a PDF using Amazon Q Business, enter the following into the Web Experience chatbot:
“In 2024, what will be the ratio of men to women on Forbes’ 2024 Oldest People?”
Amazon Q Business provides the answer, as shown in the following screenshot.
The following screenshot is a list of the top 10 millionaires of 2009.
Type “How many of the top 10 billionaires in 2009 were from countries other than the United States?”
Amazon Q Business provides the answer, as shown in the following screenshot.
Next, I used the crime statistics example here to demonstrate how Amazon Q Business retrieves data from a CSV file.
Enter the question, “How many criminal incidents were reported in Hollywood?”
Amazon Q Business provides the answer, as shown in the following screenshot.
metadata boost
To improve the accuracy of responses from Amazon Q Business applications using CSV files, you can add metadata to documents in your S3 bucket using metadata files. Metadata is additional information that further describes a document to improve retrieval accuracy for document formats that lack context, such as CSV with cryptic column names. Additional fields such as title and creation date and time are also useful if you want to search for titles or need documents from a specific time period.
To do this, follow Enabling Document Attributes for Search in Amazon Q Business.
For more information about metadata boosting, see Configuring Document Attributes for Boosting with Amazon Q Business in the Amazon Q User Guide.
cleaning
To avoid future charges and remove unused roles and policies, delete the resources you created (Amazon Q application, data source, and corresponding IAM role).
To remove your Amazon Q application, follow these steps.
- In the Amazon Q console, choose: application Then select your application.
- in action Select from drop-down menu erase.
- To confirm the deletion, type “delete” in the field and select. erase. Wait until you see a confirmation message. This process may take up to 15 minutes.
To delete the S3 bucket created in Prepare your S3 bucket as a data sourcefollow these steps:
- Follow the steps in Empty the Bucket.
- Follow the steps in Delete a Bucket.
To delete the IAM Identity Center instance that you created as part of the prerequisites, follow the instructions in Delete an IAM Identity Center Instance.
conclusion
By following this post, you can import different types of documents including tables. Then, you can ask Amazon Q questions that are related to the information in the table, and Amazon Q will give you answers in natural language.
For information about metadata search, see Configuring Metadata Controls in Amazon Q Business.
For information about setting up S3 data sources, see Setting Up Amazon Q Business Applications with S3 Data Sources.
About the author
Jiten Dedia He is a senior AIML solutions architect with over 20 years of experience in the software industry. He has assisted Fortune 500 companies with their AIML/Generative AI needs.
Sapna Maheshwari He is a Senior Solutions Architect at AWS and has a passion for designing impactful technology solutions. She is an engaging speaker and enjoys sharing her insights at conferences.