def math_prompt_function()

in src/math_verify/tasks.py [0:0]


def math_prompt_function(x: dict, task_name: str) -> Doc:
    if x.get("__few_shots"):
        index = x["__index"]
        few_shot_doc = (
            MATH_HARD_FEW_SHOTS[index]
            if index < len(MATH_HARD_FEW_SHOTS)
            else MATH_HARD_FEW_SHOTS[-1]
        )
        answer = few_shot_doc["answer"]
        question = few_shot_doc["question"]
    else:
        answer = str(x["answer"])
        question = x["problem"]

    query = dedent(
        f"""\
Question: {question}
Step-by-Step Answer:\
"""
    ).strip()

    choices = [answer]
    return Doc(query=query, choices=choices, gold_index=0)