top_k
value in your query_engine. top_K
is 2. SimilarityPostprocessor
this can be helpful for you as well. Using this you can set up a threshold value below which will not be picked as source_nodes to prepare your response. query_engine = vector_index.as_query_engine(similarity_top_k=3,node_postprocessors=[SimilarityPostprocessor(similarity_cutoff=0.75)])
graph = ComposableGraph.from_indices( SummaryIndex, [notion_index, gdrive_index], index_summaries=["General purpose index from Notion", "General purpose index from Google Drive"], service_context=service_context, top_k=1, )
query_engine = graph.as_query_engine( top_k=1, text_qa_template=prompt )
similarity_top_k
in place of top_k
inside your query_enginequery_engine = graph.as_query_engine( similarity_top_k=1, text_qa_template=prompt )