def doc_to_text(doc) -> str: question = doc['question'] choices = "" for idx, choice in enumerate(doc['answer']['aliases']): if idx >= 5: break letter = "ABCDE"[idx] choices+= f"{letter}. {choice}\n" return f"Question: {question}\n{choices}Answer:"