File size: 612 Bytes
63c6bf0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# prompts/cot.py
from utils.logger import log_output
def apply_cot_prompt(question: str) -> str:
return (
f"Solve the following problem step by step with the fromat of LaTex:\n"
f"{question}\n\n"
f"Clearly show your reasoning and your answer.\n"
)
def apply_cot_answer(question: str, model, dataset: str, model_name: str, qid: int, prompt_method="cot") -> str:
prompt = apply_cot_prompt(question)
answer = model.generate(prompt)
log_output(dataset, model_name, prompt_method, qid, {
"question": question,
"answer": answer
})
return answer
|