hybrid_retriever = index.as_retriever(
vector_store_query_mode=VectorStoreQueryMode.HYBRID,
similarity_top_k=top_k,
sparse_top_k=10,
enable_hybrid=True,
)
logger.success("retriever created")
response_synthesizer = get_response_synthesizer(
llm=llm,
text_qa_template=qa_prompt,
response_mode="compact",
)
logger.success("response synthesizer created")
# todo find how to use tokenizer
chat_template = open(
"../../resources/chat_templates/chat_templates/mistral-instruct.jinja"
).read()
chat_template = chat_template.replace(" ", "").replace("\n", "")
# tokenizer.chat_template = chat_template
query_engine = RetrieverQueryEngine(
retriever=hybrid_retriever,
node_postprocessors=[SimilarityPostprocessor(similarity_cutoff=0.5)],
response_synthesizer=response_synthesizer,
callback_manager=Settings.callback_manager,
)
`