Reputation: 149
I am working with Bedrock to call a lambda via the action group:
Despite getting an appropriate response from Lambda, I get the below error:
The server encountered an error processing the Lambda response. Check the Lambda response and retry the request
Lambda response:
{'messageVersion': '1.0', 'response': {'actionGroup': 'action-group-quick-start-55acd', 'function': 'connectSQL', 'functionResponse': {'responseBody': [{'total_count': 10000}]}}}
Upvotes: 2
Views: 738
Reputation: 149
I found the fix. The issue was with the incorrect lambda response. https://docs.aws.amazon.com/bedrock/latest/userguide/agents-lambda.html#agents-lambda-response
Modified the lambda response to :
response_body = {
'TEXT': {
'body': "sample response"
}
}
function_response = {
'actionGroup': event['actionGroup'],
'function': event['function'],
'functionResponse': {
'responseBody': response_body
}
}
session_attributes = event['sessionAttributes']
prompt_session_attributes = event['promptSessionAttributes']
action_response = {
'messageVersion': '1.0',
'response': function_response,
'sessionAttributes': session_attributes,
'promptSessionAttributes': prompt_session_attributes
}
Upvotes: 1