Close context sections with </NAME> + blank line so boundaries are explicit
The Inkling template renders message content verbatim with no separator, so closing tags were glued to <|end_message|> and the model did not perceive section boundaries. compose() now emits each static section as <NAME>... </NAME> followed by a blank line, and DIALOG opener/closer on their own lines. Added an #[ignore] ground-truth test rendering the composed context through the REAL chat_template.jinja asserting </SYSTEM_PROMPT>\n\n, </TOOL_USE>\n\n and </DIALOG> survive. Live probe: model now cites </TOOL_USE> + blank line and </DIALOG>. 140 tests green, clippy/fmt clean.
This commit is contained in:
1 parent
a4722b7379
commit
840410a08f
3 files changed
+57
-10
No files matched your search
+3
-3
@@ -41,12 +41,12 @@ pub fn compose(
|
||||
.replace("{session_prompt}", &session_prompt);
|
||||
messages.push(text_message(
|
||||
Role::System,
|
||||
format!("<{}>\n{}\n</{}>", sec.name, rendered, sec.name),
|
||||
format!("<{}>\n{}\n</{}>\n\n", sec.name, rendered, sec.name),
|
||||
));
|
||||
}
|
||||
// The interactive region is its own section: opener/closer markers around the
|
||||
// real role messages, which keep the engine's turn structure intact.
|
||||
messages.push(text_message(Role::System, "<DIALOG>".to_string()));
|
||||
messages.push(text_message(Role::System, "<DIALOG>\n".to_string()));
|
||||
for m in history {
|
||||
// Per-turn provenance for the model: [SPEAKER: name - datetime]. The
|
||||
// human uses the global user name; the assistant uses the session name.
|
||||
@@ -94,7 +94,7 @@ pub fn compose(
|
||||
reasoning_content: None,
|
||||
});
|
||||
}
|
||||
messages.push(text_message(Role::System, "</DIALOG>".to_string()));
|
||||
messages.push(text_message(Role::System, "\n</DIALOG>\n\n".to_string()));
|
||||
messages
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user