llama.cpp 发布 b9656 强化 PEG 工具调用解析与错误处理
英文摘要
llama.cpp release b9656 hardens the PEG-native tool call parsing. It now accepts an optional leading "type":"function" field to accommodate OpenAI-style tool call serialization. On a final parse failure, the parser returns a clean error and logs the unparsed fragment instead of throwing raw internal state. The raw arguments string is preserved when it is not valid JSON, preventing an abort of the prompt rendering. Parse failures are surfaced with clearer error messages, eliminating silent empty assistant turns. The lenient handling of the "type":"function" field is gated behind an analysis flag.
中文摘要
llama.cpp b9656 版本强化了 PEG 原生工具调用解析。现在可接受可选的 "type":"function" 字段,以兼容 OpenAI 风格的工具调用序列化。最终解析失败时,解析器返回清晰的错误并记录未解析的片段,而非抛出原始内部状态。当 raw arguments 不是合法 JSON 时会保留原始字符串,避免中断提示渲染。解析失败会以更清晰的错误消息呈现,消除静默的空 assistant 回合。对 "type":"function" 字段的宽松解析受分析标志控制。
关键要点
PEG tool call parser now accepts an optional leading "type":"function" field for OpenAI-style serializations.
PEG 工具调用解析器现在接受可选的 "type":"function" 字段,以支持 OpenAI 风格的序列化。
On final parse failure, a clean error is returned and the unparsed fragment is logged, replacing the raw parser position throw.
最终解析失败时,返回清晰错误并记录未解析的片段,替代原先抛出原始解析器位置的方式。
Raw arguments string is preserved when not valid JSON, preventing prompt render abort.
当 raw arguments 不是合法 JSON 时,保留原始字符串,避免提示渲染中断。
Parse failures are surfaced with explicit error messages, removing the silent empty assistant turn.
解析失败会以明确的错误消息呈现,消除了静默的空 assistant 回复。
Lenient parsing of the "type":"function" field is controlled by an analysis flag.
"type":"function" 字段的宽松解析由分析标志控制。