Repository navigation
Commit a631763
committed
Keep prose tool-tag mentions in GLM answers as text
GLM's argument-tag parser had the same defect in answer text: any `<tool_call>`
after `</think>` started a call. A quoted tag in prose aborted the response at
EOS with "incomplete GLM tool call", and a quoted tag followed by a real call
cut the answer short and returned a call whose function name was the
intervening prose. Reasoning was unaffected because GLM's `<tool_call>` does not
end reasoning.
ArgumentTags now implements ToolDialect::starts_call: `<tool_call>` starts a
call only when followed by a function name and then `<arg_key>` or
`</tool_call>`, matching the GLM 5.3 chat template. Other text keeps the tag in
the answer, and an unresolved prefix is held until later tokens decide. An
undecided tag at finish is still parsed as a call, so truncated calls keep
their EOS error and output-limit handling. This applies to the glm53 recipe;
there is no Protobuf or package change.
Validation: rebased onto bce032c and rerun on a 32-core build host. Helios
library suite for this commit: 1213 passed, 21 ignored, 5 failed, the same five
that fail on unmodified main (four engram::reader staging ENOMEM on that host,
and a package cache test that cannot fail when the suite runs as root). The new
test covers a quoted answer mention, unconfirmed and partial inline tags, and a
mention followed by a real call at every two-way split point, and rustfmt
--check reports no difference in the file. A probe on the unchanged parser
reproduced the abort and the misnamed call for these inputs.
Limitations: not run against GLM output or a live Flare service; Helios
integration tests, Heliopause, Python, and CUDA tests were not run. A complete
call example in prose still parses as a call.
Design-Signed-Off-By: mark-yong (AI-assisted Cursor and DeepSeek-V4.1-Flash review); design-review=babb1 parent e44ac30 commit a631763
1 file changed
Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
67 | 93 | | |
68 | 94 | | |
69 | 95 | | |
| |||
143 | 169 | | |
144 | 170 | | |
145 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
146 | 218 | | |
147 | 219 | | |
148 | 220 | | |
| |||
0 commit comments