Skip to content

Bedrock knowledgebases: how to retrieve document metadata along with search results

0

Hi, when I use retrieveAndGenerate, the search results appear to come with the s3 object metadata (i.e. the custom metadata defined in *.metadata.json files). However, this metadata is not available to agents, it appears. My use case requires obtaining the metadata for each search result. Any ideas on how to do this?

1 Answer
0

Hello.

It seems that metadata can be obtained using the invoke_agent() API, but as mentioned in the GitHub issue, it seems that there is a bug or something that prevents the metadata from being obtained.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/invoke_agent.html

It seems likely that it will be possible to obtain it in the response of the invoke_agent() API in the future.
https://github.com/aws/aws-sdk/issues/746

Therefore, currently I think the only way to retrieve it is to execute the retrieve_and_generate() API directly on the knowledge base.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/retrieve_and_generate.html

EXPERT
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.