Yea fair point. Its a long story. It makes more sense when you look at the low-level API. Since
as_retriever()
is a general shorthand to create a
VectorIndexRetriever()
, all args get passed into there.
And even (worse?)
as_query_engine()
is shorthand for creating a retriever AND a retriever query engine. Now we have double the amount of args.
Due to how many args there are, and how many indexes, the current code just abuses kwargs and passes them to underlying components.
There are a few examples of setting
similarity_top_k
floating around.
https://docs.llamaindex.ai/en/stable/understanding/querying/querying.html#customizing-the-stages-of-querying