in generation/llm_swarm_script.py [0:0]
def extract_qa_pairs(text):
qa_pattern = re.compile(r'(Q\d+:\s*.*?)(A\d+:\s*.*?)(?=(Q\d+:)|$)', re.DOTALL)
matches = qa_pattern.findall(text)
qa_pairs = [(q.strip(), a.strip()) for match in matches for q, a in [match[:2]]]
return qa_pairs