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
demandé il y a 2 mois140 vues
1 réponse
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
répondu il y a 2 mois
profile picture
EXPERT
vérifié il y a un mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions