Skip to content

Bedrock RetrieveAndGenerate API Always Returns "Sorry, I am unable to assist you with this request."

0

Hi there, I am new to AWS Bedrock. I am building an RAG application and met this unexpected error. My code is like :

  const request = {
    input: {
      'text': "<Questions Related to the File Storaged in my S3>",
    },
    retrieveAndGenerateConfiguration : {
          'type': 'KNOWLEDGE_BASE',
          'knowledgeBaseConfiguration': {
              'knowledgeBaseId': "ID",
              'modelArn': "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0", 
            }
      },
    } 
  const command = new RetrieveAndGenerateCommand(request);
  const response = await client.send(command);

However, it always returns response with "Sorry, I am unable to assist you with this request". Moreover, the citations are always empty list [].

For better assisting you, I have some extra observations for the problem:

  1. I also met the problem in the Bedrock Console in "Test Knowledgebase" at first when there is no wiki in my external sources S3. But the problem get fixed when I add a file to S3 and sync the S3.
  2. If I set retrieveAndGenerateConfiguration type to "external source" and assign the S3 object location, the problem also get fixed.

Any suggestions would be appreciated. Thanks very much.

asked a year ago2.8K views
1 Answer
0

Based on your description, it seems the issue you're experiencing with the RetrieveAndGenerate API in Amazon Bedrock is likely related to the knowledge base configuration or content. Here are some suggestions to troubleshoot and resolve the problem:

  1. Verify Knowledge Base Content: Ensure that your knowledge base contains relevant information. As you mentioned, the problem was initially resolved in the console when you added content to your S3 bucket. Make sure your knowledge base is properly populated and synced with the latest content.

  2. Check Knowledge Base ID: Confirm that the 'knowledgeBaseId' you're using in your code is correct and corresponds to a valid, existing knowledge base in your account.

  3. Model Compatibility: Verify that the model ARN you're using (anthropic.claude-3-sonnet-20240229-v1:0) is compatible with the knowledge base feature. Some models may have specific requirements or limitations.

  4. Permissions: Ensure that your IAM role or user has the necessary permissions to access both the knowledge base and the specified model.

  5. Query Relevance: The query "What is the Volume Control workflow in AOSP?" might not match any content in your knowledge base. Try using a query that you're certain matches content in your knowledge base to rule out content-related issues.

  6. API Request Format: Double-check that your API request format is correct. The structure you provided looks generally correct, but ensure all required fields are included and properly formatted.

  7. Error Handling: Implement proper error handling in your code to catch and log any specific error messages or codes returned by the API. This can provide more detailed information about what's going wrong.

  8. Consider Using External Sources: As you mentioned that using external sources resolved the issue, you might want to consider this approach if the knowledge base continues to cause problems. However, it's worth investigating why the knowledge base isn't working as expected.

  9. Check Service Health: Verify that there are no ongoing issues with Amazon Bedrock in your region by checking the AWS Service Health Dashboard.

If you continue to experience issues after trying these solutions, it would be advisable to contact AWS Support for further assistance tailored to your specific use case and account configuration.
Sources
Troubleshooting Amazon Bedrock API Error Codes - Amazon Bedrock
RetrieveAndGenerate - Amazon Bedrock
RetrieveAndGenerateInput - Amazon Bedrock

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.