agentic-rl-main / data_utils /rl_prompt.py
Jack04810's picture
Add files using upload-large-folder tool
534c64f verified
Raw
History Blame Contribute Delete
781 Bytes
"""Shared RL prompt template for VQA / chart / math tasks."""
from config import CONFIG
def build_rl_prompt_template(answer_flag: str | None = None) -> str:
"""Build user prompt text before chat template is applied.
Avoids the legacy ``"Answer: .."`` quoted placeholder, which biased the model
to emit token 340 (``)``) immediately after ``<|im_start|>assistant``.
"""
flag = answer_flag or CONFIG["rl"]["answer_flag"]
return (
"Your task is to answer the question below. "
"Think step by step before giving your final answer. "
f"When you are ready, end your response with a line starting with {flag} "
"followed by your answer.\n\n"
"Question:\n\n{question}"
)
PROMPT_TEMPLATE = build_rl_prompt_template()