I wrote a code to access the Amazon Bedrock Knowledge Base and it worked successfully but now I am having the error below. How to fix it?
Exception occurred: An error occurred (InternalServerException) when calling the RetrieveAndGenerate operation (reached max retries: 4): Internal Server Exception
**Code:
def askQuestion2(question):
session = boto3.Session()
bedrock_agent_runtime = session.client('bedrock-agent-runtime')
request = {
"input": {'text': question},
"retrieveAndGenerateConfiguration": {
"type": "KNOWLEDGE_BASE",
"knowledgeBaseConfiguration": {
"knowledgeBaseId": "xxxxxxxxx",
"modelArn": "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-v2"
}
},
}