Archived
chat: read a function name that ends at whitespace (Ling 3.0)
Ling-3.0-flash's template writes a call as the opener, the function name, a
newline, and only then the argument tags:
<tool_call>read
<arg_key>path</arg_key>
<arg_value>/a</arg_value>
</tool_call>
The differential analysis names the function between the opener and the first
argument tag, so its end is the bare newline and name_suffix comes out as
whitespace alone. chat_format_check refused that, so every request carrying
tools answered 501 with "this model's tool calls cannot be read back:
name_suffix must end the function name with something besides whitespace" --
the whole tool-calling surface, for every Ling-3.0 checkpoint.
A suffix with no core of its own is the suffixless ending written out: the
name stops at the whitespace. The reader now takes it that way (name_open keys
on the trimmed core, so the name runs to the first arg_prefix or call_end,
whitespace trimmed), while the grammar still writes the template's newline.
The object family has no such terminator -- its brace ends the name -- and
keeps the refusal, as does the wrapped format whose bare name_prefix would
otherwise read as a call.
Adds the real template as a fixture and a regression test that derives the
format, builds the grammar, and reads a two-call reply built from the derived
fields; a second test pins the object family's refusal.
This commit is contained in:
1 parent
bd3fa646bc
commit
b988378e70
8 files changed
+275
-21
No files matched your search
+12
-8
@@ -202,10 +202,13 @@ int chat_format_check(const ChatFormat& f, std::string* why) {
|
||||
if (object && !f.section_open.empty())
|
||||
return no("section-wrapped object arguments are not supported");
|
||||
/* Without a suffix the name ends at what follows it: the object's `{`, or a tagged call's
|
||||
* first argument or close. */
|
||||
if (!f.name_suffix.empty()) {
|
||||
if (trim_ws(f.name_suffix).empty())
|
||||
return no("name_suffix must end the function name with something besides whitespace");
|
||||
* first argument or close. A suffix of nothing but whitespace is that same ending, written
|
||||
* out: the name stops at the whitespace (Ling 3.0's `<tool_call>NAME\n<arg_key>`), so the
|
||||
* reader treats it as a suffixless name, while the grammar still writes the template's
|
||||
* newline. The object family has no such terminator -- its `{` ends the name -- and keeps
|
||||
* the refusal. */
|
||||
const bool name_by_ws = !object && !f.name_suffix.empty() && trim_ws(f.name_suffix).empty();
|
||||
if (!f.name_suffix.empty() && !name_by_ws) {
|
||||
if (is_ws((unsigned char)f.name_suffix[0]))
|
||||
return no("name_suffix " + show(f.name_suffix) + " may not begin with whitespace");
|
||||
}
|
||||
@@ -216,10 +219,11 @@ int chat_format_check(const ChatFormat& f, std::string* why) {
|
||||
if (f.arg_name_suffix.empty() && f.arg_value_prefix.empty())
|
||||
return no("nothing ends an argument name: arg_name_suffix and arg_value_prefix are "
|
||||
"empty");
|
||||
if (f.name_suffix.empty()) {
|
||||
/* The name runs to the first arg_prefix or call_end. A wrapped format also reads
|
||||
* name_prefix alone as a call, told from prose only by its closed name tag, and
|
||||
* without a suffix there is none. */
|
||||
if (f.name_suffix.empty() || name_by_ws) {
|
||||
/* The name runs to the first arg_prefix or call_end, written either with no suffix
|
||||
* or with the whitespace that ends it. A wrapped format also reads name_prefix
|
||||
* alone as a call, told from prose only by its closed name tag, and without a
|
||||
* suffix there is none. */
|
||||
if (!f.call_open.empty())
|
||||
return no("name_suffix is empty, which a tagged call allows only when name_prefix "
|
||||
"opens it, and call_open is set");
|
||||
|
||||
Reference in new issue
Block a user