Choose specific documents from Kendra index for RAG

0

Hi! I want to choose specific document IDs from Kendra index to pass to Bedrock as RAG. How do I do it in RetrieveCommand()? I could not fin d an argument that would correspond to it in this function.

KK
已提問 2 個月前檢視次數 140 次
1 個回答
2

Hi KK,

To filter results to specific document IDs in your Kendra index when using the Retrieve API, you can utilize the AttributeFilter parameter. This parameter allows you to define filtering rules based on document attributes or fields. For instance, if you have a unique identifier or a specific attribute that correlates with your document IDs, you can construct an AttributeFilter to include only documents that match these identifiers.

When indexing documents in Kendra, you can also define custom attributes for your documents. A custom attribute could be any key-value pair that you decide to associate with a document, such as a "DocumentID," "CustomID," or any other identifier that uniquely identifies your documents. For more information on the process of creating custom documents you can refer to this. After that when you call the Retrieve API to fetch documents, you can use the AttributeFilter parameter to specify filtering criteria based on your custom attributes.

More resources on setting up your Retrieve API.

AWS
aykazmi
已回答 2 個月前
profile picture
專家
已審閱 1 個月前

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

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

回答問題指南