Archived
chat: tagged calls whose name the opener opens -- GLM-5's <tool_call>NAME<arg_key>
GLM-5 writes <tool_call>NAME<arg_key>K</arg_key><arg_value>V</arg_value>...</tool_call>: no prefix of the name's own and no suffix, the name ends at the first argument or at the call's close. The tagged family now takes an empty name_suffix when name_prefix opens the call (no call_open): the derivation from the template makes the per-call opener the prefix and its closer call_end, the grammar takes eps() for the suffix, and the streaming parser finds the name's end byte by byte (name_stop, name_plausible) and reads the closing tag as the first item of the body. arg_name_suffix and arg_value_prefix may both be set and are read back to back, so chat_format_markers keeps both tags. value_newlines comes from a probe render of the template rather than a constant (GLM and MiniCPM false, Qwen true). The ABI struct is unchanged; its comments say what an empty name_suffix means now. chatparse_test: GLM's template serves tools; the derived format equals the one a plugin would declare; every rendered reply in the corpus reads back as the message it rendered, split at every byte; and replies that stray from the grammar. Each fails without this change. The Gemma refusal names call_end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ac0bc9690
commit
e60810116c
6 files changed
+507
-22
No files matched your search
+4
-1
@@ -1110,10 +1110,13 @@ typedef struct RadChatFormat {
|
||||
const char* call_open; /* around each call; "" when calls are not wrapped */
|
||||
const char* call_close;
|
||||
const char* name_prefix; /* "" when the model has no tool calls */
|
||||
/* "" when nothing of its own ends the name: then the object's `{` does, or, for tagged
|
||||
* arguments in an unwrapped call, the first arg_prefix or call_end, which begin the body */
|
||||
const char* name_suffix;
|
||||
const char* call_end;
|
||||
const char* arg_prefix;
|
||||
const char* arg_name_suffix; /* "" when arg_value_prefix alone ends the name */
|
||||
/* "" when arg_value_prefix alone ends the name; both set are written back to back */
|
||||
const char* arg_name_suffix;
|
||||
const char* arg_value_prefix;
|
||||
const char* arg_value_suffix;
|
||||
|
||||
|
||||
Reference in new issue
Block a user