Find answers from the community

Updated last year

Retriever

At a glance
I can't set the similarity_top_k value when using ObjectRetriever. It always uses the DEFAULT_SIMILARITY_TOP_K value which is 2. But when using it inside SQLTableRetrieverQueryEngine, it works fine.
Plain Text
//Only returns 2 (there are more than 2 objects)
obj_retriever.as_retriever(similarity_top_k=4).retrieve(query)
L
B
l
7 comments
Attachment
image.png
You set k=3, it should be similarity_top_k=3
My bad. I was using similarity_top_k before, but i might've spelled it wrong. Thanks a lot.
Could you help me with one more thing. Is there any techniques i can use to reduce the token usage for sending table schema ? I'm using gpt 3.5 16k model and the max number of tables i can send is around 6-8.
I am using QueryFusionRetriever, but when I increase similarity_top_k, the retrieved nodes are always 4, is there anything wrong with my code?

from llama_index.retrievers import QueryFusionRetriever
retriever = QueryFusionRetriever(
[index1.as_retriever(), index2.as_retriever()],
similarity_top_k=6,
num_queries=1, # set this to 1 to disable query generation
use_async=False,
verbose=True,
# query_gen_prompt="...", # we could override the query generation prompt here
)
@louis Since the default top k for your two indexes is two each, then there is only 4 nodes to return.

Try increasing the top k of each sub-retriever to like 10
Add a reply
Sign up and join the conversation on Discord