prompt = self._prompt(municipality_dto.name) prompt = re.sub( r"\s{3,}", " ", prompt, ) response_synthesizer = CompactAndAccumulate( text_qa_template=CUSTOM_TEXT_QA_PROMPT, output_cls=ContactList, ) query_engine_contact = index.as_query_engine( response_synthesizer=response_synthesizer ) contact_list: PydanticResponse = query_engine_contact.query(prompt) # type: ignore
response_synthesizer = CompactAndAccumulate( text_qa_template=CUSTOM_TEXT_QA_PROMPT, output_cls=ContactList, use_async=True, ) query_engine_contact = index.as_query_engine( response_synthesizer=response_synthesizer ) contact_list: PydanticResponse = await query_engine_contact.aquery(prompt) # type: ignore
asyncio.run(asyncio.gather(...))