Find answers from the community

Updated 6 months ago

Hi, I am using the

At a glance

The community member is using the QueryFusionTransformer and the QueryFusionRetriever, and has questions about injecting their own query into the generated queries list, how filtering works with multiple indexes, and how to do filtering using this retriever. The comments suggest that injecting a custom query may not be possible directly, but the community member could create the queries themselves and add them to the list. For filtering, the comments indicate that the community member is not sure how it works with multiple indexes. One community member suggests subclassing the retriever and updating a specific method to add extra queries, but does not have much idea about the filtering.

Useful resources
Hi, I am using the QueryFusionTransformer -
retriever = QueryFusionRetriever(
[index_1.as_retriever(), index_2.as_retriever()],
similarity_top_k=5,
num_queries=4, # set this to 1 to disable query generation
use_async=True,
verbose=True,
# query_gen_prompt="...", # we could override the query generation prompt here
)
Can we inject our own query into the generated queries list and then proceed ahead for the retrieval? Also, while doing filtering, will it be passed through both indexes? More importantly how to do filtering using this retriever.
W
P
6 comments
I dont think you can inject your own query directly. Maybe create the queries at your side and add your queries and then pass it to the next intended operation.
what about filters?
where to pass it?
lol tell me something xD
For adding more queries, i think you can subclass and update the following method as per your need to add extra queries: https://github.com/run-llama/llama_index/blob/ca9634e660b91799a86ee9f9f0a697eb236bcefd/llama-index-core/llama_index/core/retrievers/fusion_retriever.py#L83

For the filters: Not much idea
Hi, getting this error - ImportError: cannot import name 'BaseNodePostprocessor' from 'llama_index.core.postprocessor' (/usr/local/lib/python3.10/dist-packages/llama_index/core/postprocessor/init.py)
Add a reply
Sign up and join the conversation on Discord