Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
888c77cb
Commit
888c77cb
authored
Mar 17, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Add space after thought tags in prompt seeding
Now ends with ']~b] ' instead of ']~b]'
parent
916ced3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
18 deletions
+9
-18
templates.py
codai/models/templates.py
+9
-18
No files found.
codai/models/templates.py
View file @
888c77cb
...
...
@@ -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\n
System: {sys}
\n\n
Human: {user}
\n\n
Assistant: <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}
\n
User: {user}
\n
Assistant: <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}
\n
User: {user}
\n
Assistant: <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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment