跳至內容

Bedrock, Knowledge Base API - exclude JSON citations array

0

Hello,

For Bedrock, Knowledge Base, /retrieveAndGenerate API, is there an input configuration that should specify that the response should not contain the citations JSON array ?

Thank you,

已提問 1 年前檢視次數 250 次

1 個回答
0
已接受的答案

There isn't a direct configuration option in the Amazon Bedrock RetrieveAndGenerate API to specifically exclude the citations JSON array from the response. The inclusion of citations in the response is actually a feature designed to provide attribution for information sourced from the knowledge base.

The challenge with citations is actually the opposite of what you're asking - many users struggle with getting citations to appear consistently in responses. Citations may sometimes appear and sometimes not, depending on how the model processes the information.

If you're looking to control the format of the response more precisely, you have a few options:

  1. You could separate the retrieve and generate steps by using the Retrieve API first to get relevant chunks, then passing these to a foundation model via a separate call where you have more control over the response format.

  2. You could use the Converse API with a toolConfig that defines a specific JSON schema for the response, which would give you more control over the structure of the output.

  3. You could implement post-processing in your application to filter out the citations array from the response if it's present.

However, there isn't a simple parameter or flag in the RetrieveAndGenerate API that allows you to specify "don't include citations" in the response.
Sources
Problems with limited answer references in the Bedrock knowledge base | AWS re:Post
aws bedrock-runtime converse or invoke to get response in a given JSON schema format | AWS re:Post
How to have a bedrock agent reliably include knowledge base citations in the final response of InvokeAgent for Agents for Amazon Bedrock Runtime? | AWS re:Post

已回答 1 年前

AWS
專家

已審閱 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。