from llama_index import get_response_synthesizer custom_synthesizer = get_response_synthesizer(response_mode="compact") response = custom_synthesizer.synthesize(query_str, node_with_scores)
def generate_response(retrieved_nodes, query_str,patient_information, qa_prompt, llm): context_str = "\n\n".join([r.get_content() for r in retrieved_nodes]) fmt_qa_prompt = qa_prompt.format(context_str=context_str, query_str=query_str, patient_information=patient_information) print(fmt_qa_prompt) response = llm.complete(fmt_qa_prompt) return str(response), fmt_qa_prompt