RetrieveAndGenerate API response is giving empty list for retrievedReferences even when output is being generated and mapped to source docs.

0

Using retrieve_and_generate API to query knowledge base on AWS Bedrock. The response body consist of output answer along with the source mapping but the cited retrievedReferences is an empty list. And the citations['generatedResponsePart']['textResponsePart']['text'] is showing 'Sorry, I am unable to assist you with this request.'

{ "citations": [ { "generatedResponsePart": { "textResponsePart": { "span": { "end": 50, "start": 0 }, "text": "Sorry, I am unable to assist you with this request." } }, "retrievedReferences": [] } ] }

I need to get the cited responses.

I am using boto3 1.34.85 Same issue is with the latest boto3 version as well. I have tried this with different claude models and all have same issue.

Any idea whats causing the issue?

1 Answer
0

Hi,

I have been testing a workshop which uses Retrieve and Generate, seems to work pretty well. Maybe you can gather some hints from the lambda python code being used in this step. I am assuming you already referred this documentation which has examples.

Hope this helps!

Thanks, Rama

profile pictureAWS
Rama
answered 19 days ago
  • Thanks for the response. Actually I am able to get the answer from the retrieve and generate response. But unable to get the citations for that answer.

    I tried to use the default boto3 version in lambda python runtime which is boto3 1.34.42 and this is able to give both answer and citations in response. But it doesn't accept "generationConfiguration" and "retrievalConfiguration" parameters in request. So custom prompt and number of vector search results cannot be provided. Answer is also not mapped to the source documents.

    "generationConfiguration" and "retrievalConfiguration" parameters are acceptable in boto3 1.34.78 or above. But here the retrieve and generate response doesn't provide the citations. It is just showing an empty list for retrievedReferences. But the answer is being mapped with the source docs.

    Requirement is to get the answer-source mapping, use custom prompt and get cited source text.

  • In this case, I would suggest you to please check if there are any similar issues being discussed here. If not, suggest raising it.

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.

Guidelines for Answering Questions