Find answers from the community

Updated 6 months ago

Is it possible to obtain the complete

At a glance

The community member is asking if it is possible to obtain the complete set of nodes from a query engine, including those results that were initially retrieved but later excluded by the node processor. Their goal is to use the top N documents for LLM with the node postprocessor while also having access to the full list of results initially retrieved by the retriever.

In the comments, another community member suggests using a custom callback to hook into that functionality. However, they also mention that it might be easier to use the retriever, node postprocessors, and response synthesizer separately instead of relying on a query engine. They provide an example code snippet demonstrating this approach.

The other community members seem to agree that the suggested approach provides "full control" and is "perfect".

Is it possible to obtain the complete set of nodes from a query engine, including those results that were initially retrieved but later excluded by the node processor? My goal is to use the top N documents for LLM with the node postprocessor while also having access to the full list of results initially retrieved by the retriever.
L
J
4 comments
I think if you use a custom callback, you could hook into that

But tbh it's probably easier to use the retriever + node postrprocessors + response synthesizer seperately instead of relying on a query engine
Plain Text
retriever = index.as_retreiver(similarity_top_k=2)

from llama_index import get_response_synthesizer
response_synthesizer = get_response_synthesizer()

nodes = retriver.retrieve(query_str)
nodes = postprocessor.postprocess_nodes(nodes)

response = response_synthesizer.synthesize(query_str, nodes=nodes)
full control πŸ™‚
Ahh this is perfect. Thanks a lot
Add a reply
Sign up and join the conversation on Discord