What do you mean by 'every user message'? I only want it to retrieve the context for latest user message. I already have a query engine that I’m passing to condenseQuestionChatEngine, but the CondensePlusContext function doesn’t accept a query engine as a parameter. Instead, it requires a response synthesizer. How can I handle this situation?
def initialize_query_engine(vector_index, docstore, top_k_context):
try:
custom_retriever = QueryFusionRetriever(
[
vector_index.as_retriever(similarity_top_k=top_k_context),
BM25Retriever.from_defaults(docstore=docstore, similarity_top_k=int(top_k_context))
],
similarity_top_k=12,
mode='reciprocal_rerank',
use_async=True,
verbose=True,
query_gen_prompt=query_gen_str,
)
response_synthesizer = get_response_synthesizer(
response_mode="compact",
text_qa_template=custom_qa_prompt,
verbose=True,
use_async=True,
streaming=False
)
custom_query_engine = RetrieverQueryEngine.from_args(
retriever=custom_retriever,
node_postprocessors=[
MetadataReplacementPostProcessor(target_metadata_key="table_df"),
reranker,
PrevNextNodePostprocessor(docstore=docstore, num_nodes=1)
],
response_synthesizer=response_synthesizer,
verbose=True,
use_async = True
)
return custom_query_engine