Commit 888c77cb authored by Your Name's avatar Your Name

fix: Add space after thought tags in prompt seeding

Now ends with ']~b] ' instead of ']~b]'
parent 916ced3b
......@@ -23,16 +23,16 @@ class AgenticTemplateManager:
# Family-specific prefixes for Prompt Seeding (force reasoning start)
# These templates end with the thought tag to force the model to start reasoning
REASONING_PREFIXES = {
"qwen": "<|im_start|>system\n{sys}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n<think>\n",
"deepseek": "<|begin_of_sentence|><|im_start|>system\n{sys}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n<think>\n",
"qwen": "<|im_start|>system\n{sys}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n<think> \n",
"deepseek": "<|begin_of_sentence|><|im_start|>system\n{sys}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n<think> \n",
"llama3": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n{sys}<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{user}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n<thought>\n",
"mistral": "[INST] {sys}\n\n{user} [/INST] Thought:\n",
"anthropic": "\n\nSystem: {sys}\n\nHuman: {user}\n\nAssistant: <thinking>\n",
"command-r": "<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{sys}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>{user}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|><thought>\n",
"gemma": "<bos><start_of_turn>user\n{sys}\n\n{user}<end_of_turn>\n<start_of_turn>model\n<thought>\n",
"phi3": "<|system|>\n{sys}<|end|>\n<|user|>\n{user}<|end|>\n<|assistant|>\n<|thought|>\n",
"yi": "<|im_start|>system\n{sys}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n<think>\n",
"generic": "System: {sys}\nUser: {user}\nAssistant: <think>\n"
"yi": "<|im_start|>system\n{sys}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n<think> \n",
"generic": "System: {sys}\nUser: {user}\nAssistant: <think> \n"
}
# Stop tokens for each family (used to stop reasoning generation)
......@@ -128,16 +128,7 @@ class AgenticTemplateManager:
self.REASONING_PREFIXES["generic"]
)
# Format the base template
prompt = template.format(sys=system_prompt, user=user_question)
# Get the thought tag for this family
thought_tag = self.THOUGHT_TAGS.get(self.family_key, "<think>")
# Add "The user requested" after the thought tag to guide reasoning
prompt += f"The user requested: {user_question}\n"
return prompt
return template.format(sys=system_prompt, user=user_question)
def get_stop_tokens(self) -> List[str]:
"""
......@@ -156,16 +147,16 @@ class AgenticTemplateManager:
# Map family keys to their thought tags for extraction
THOUGHT_TAGS = {
"qwen": "<think>",
"deepseek": "<think>",
"qwen": "<think> ",
"deepseek": "<think> ",
"llama3": "<thought>",
"mistral": "Thought:",
"anthropic": "<thinking>",
"gemma": "<thought>",
"phi3": "<|thought|>",
"yi": "</think>",
"yi": "</think> ",
"cohere": "<thought>",
"generic": "<think>"
"generic": "<think> "
}
# Closing tags for each family
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment