Find answers from the community

Updated 3 months ago

Hello, fallowing this recursive_

Hello, fallowing this recursive_retriever example https://docs.llamaindex.ai/en/stable/examples/query_engine/recursive_retriever_agents/ can I query composable retriever and route queries to multiple agents and not only to one? changing similarity_top_k=2 or more will query in the same time on more or I should use another technique ?
L
J
7 comments
Plain Text
# define top-level retriever
vector_index = VectorStoreIndex(
    objects=objects,
)
query_engine = vector_index.as_query_engine(similarity_top_k=2, verbose=True)


This will retrieve and run 2 agents yes
another question, it is possible to put a subquery engine in front of this top-level retriever and base on subquestions trigger different agents to resolve the user query ?
or there is a better technique to use when we require a multistep workflow approach ?
@Logan M it is possible to put a subquery engine in front of this top-level retriever ?
You can yea, just wrap the query engine above into a sub-question query engine
do you have any example how I can do that ?
just make a query engine tool and give it to the sub-question query engine?

Plain Text
tool = QueryEngineTool.from_defaults(query_engine, name="...", description="...")

sub_question = SubQuestionQueryEngine.from_defaults([tool], llm=llm, verbose=True)
Add a reply
Sign up and join the conversation on Discord