{"id":7531,"date":"2025-01-15T08:00:00","date_gmt":"2025-01-15T07:00:00","guid":{"rendered":"https:\/\/blog.besharp.it\/?p=7531"},"modified":"2025-01-14T15:56:50","modified_gmt":"2025-01-14T14:56:50","slug":"amazon-bedrocks-sorry-im-unable-to-assist-you-with-this-request-solved-a-journey-into-troubleshooting-and-resolution","status":"publish","type":"post","link":"https:\/\/blog.besharp.it\/amazon-bedrocks-sorry-im-unable-to-assist-you-with-this-request-solved-a-journey-into-troubleshooting-and-resolution\/","title":{"rendered":"Amazon Bedrock’s \u201cSorry, I\u2019m unable to assist you with this request\u201d solved: a journey into troubleshooting and resolution."},"content":{"rendered":"\n

“When you have eliminated the impossible, whatever remains, however improbable, must be the truth.”<\/em><\/p>\n\n\n\n

Sherlock Holmes<\/p>\n\n\n\n

Having a companion (let\u2019s call it Watson!) that helps us retrieve information and answer questions is always helpful. You know, digging and searching vast knowledge bases can be a time-consuming task. Lucky for us, these days, large language models (LLM) are here to help us\u2014until they refuse to do their job.<\/p>\n\n\n\n

In this article, we will describe the process of troubleshooting the \u201cSorry, I\u2019m unable to assist you with this request\u201d response when programmatically running a \u201cretrieve&generate\u201d query using Amazon Bedrock and Python boto3 library.<\/p>\n\n\n\n

TL;DR<\/h2>\n\n\n\n

Use the boto3 Amazon Bedrock \u201cretrieve&generate\u201d query to provide a prompt template with the $output_format_instructions$ placeholder that has already been evaluated and create an XML parser.<\/p>\n\n\n\n

This will always give you the output text that, if syntactically correct, you can parse it with your custom XML parser to extract the real text. Moreover, this still activates the boto3 built-in references XML parser to extract knowledge-base document citations.<\/p>\n\n\n\n

Otherwise, if it\u2019s not aligned with the XML-defined structure, you just need to sanitize the XML tags to extract the output text.<\/p>\n\n\n\n

The issue<\/h2>\n\n\n\n

We were tasked with implementing a knowledge base search system for a pharmaceutical company. <\/p>\n\n\n\n

We chose Amazon Bedrock to solve this problem since summarization and responding to natural language queries are easy to achieve. <\/p>\n\n\n\n

Unfortunately, things don\u2019t always go as planned, so when we first implemented the solution, we found that programmatically using boto3 to run a retrieve and generate query was unpredictably giving us the error \u201cSorry, I\u2019m unable to assist you with this request\u201d<\/strong> without additional information or logs. <\/p>\n\n\n\n

Needless to say, no documentation is available, nor are articles on the Internet, so we started the quest to troubleshoot. <\/p>\n\n\n\n

Today, we are sharing our (successful) troubleshooting journey so that you can find the solution if you are experiencing the same issue.<\/p>\n\n\n\n

Keep reading!<\/p>\n\n\n\n

Our implementation and use case<\/h2>\n\n\n\n

Let\u2019s briefly introduce the use case to better understand the context and the solution. This will be very important to understand, check by check, where the problem is.<\/p>\n\n\n\n

Our task was to implement a search system to easily find drug package leaflets amongst all the documentation of the product catalog. The drug leaflet text must be accessible via API so that the feature can be integrated inside the customer web application and used by their user base to ease the user experience (UX).<\/p>\n\n\n\n

The overall system can be described using 3 macro-areas:<\/p>\n\n\n\n