How to use the metadata
parameter in retriever.get_relevant_documents()
?
#28787
Replies: 1 comment
-
Hello @AlexPascu001! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this issue together! To filter documents based on the
Here's an example of how you might set this up: results = retriever.get_relevant_documents(
query="your_query",
metadata=metadata_filter,
callbacks=your_callbacks # Optional: if you have any callbacks to handle events
) This setup will retrieve documents that have the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
I have an ElasticSearch retriever that I am using to get different Elasticsearch Documents (chunks). Each chunk has a metadata called
category
that I want to use to be able to filter documents based on that category (i. e. get only the documents that have metadata.category == my_category). I saw that there is ametadata
parameter in theget_relevant_documents()
function, however I don't understand how I can use it along with thecallbacks
and whether this would be able to solve my problem by getting only some documents from elastic.Beta Was this translation helpful? Give feedback.
All reactions