llama.cpp b11622:修复 jinja tojson 浮点数输出
原标题:b11622
AI 摘要
llama.cpp 发布 b11622 版本,修复了 jinja 模板中 tojson 输出浮点数的问题:此前通过 C++ 流打印浮点数只保留 6 位有效数字且省略 .0,导致 48.858844 变成 48.8588、1.0 变成 1,影响工具定义、工具调用参数等模板输出。现在改为像 Python json.dumps 一样输出能读回相同值的最短数字,字符串和 safe 过滤器中的浮点数也使用同一逻辑。该版本同时提供 macOS、Linux、Windows、Android 等多平台预编译包。
正文节选
<details open> jinja : write floats in tojson as Python does (#30362) tojson printed floats through a C++ stream (6 significant digits, no ".0"), so 48.858844 became 48.8588 and 1.0 became 1 in tool definitions, tool-call arguments and other template output. Write the shortest digits that read back as the same value, as json.dumps does. The string and safe filters of a float use the same code. </details> **Website:** - <https://llama.app> **Attestations:** - <https://github.com/ggml-org/lla