`tool_choice: "none"` drops the tools from the prompt, so the prompt cache misses

オープン
#28 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
zig

調査の方向性

Start with zig/src/server/tool_specs.zig and zig/src/server/server.zig, then trace how the DeepSeek-V4.1 template in tools/dsv41-hip/assets/chat_template.jinja renders offered tools and handles DSML calls. Compare the none, named-function, and required paths, and read the “Keeping the prompt cache” section in docs/api.md for current behavior. Done means the chosen behavior preserves the prior prompt while preventing disallowed tool calls; the issue leaves open whether this should be DeepSeek-V4.1-specific or behind a server flag.

索引モデルが issue の本文から書いたものです。

説明

enhancement

What happens

With tool_choice: "none", tool_specs.active (zig/src/server/tool_specs.zig) returns no tools, so the DeepSeek-V4.1
chat template renders no tools block. The template writes that block right after the system text
(tools/dsv41-hip/assets/chat_template.jinja), so the prompt changes near its start, and the kept prompt state from
the turn before can't be resumed: the whole conversation is read again.

With thinking on it changes more: the template keeps earlier turns' thinking only while tools are offered (eff_drop),
so without tools every earlier assistant turn is rendered differently too.

A tool_choice that names one function has the same effect: tool_specs.active returns only that tool, so the tools
block changes.

Why it matters

Agent harnesses send tool_choice: "none" (or leave the tools out) to get a final answer at a step or time limit,
which is when the conversation is longest. Prompt reading runs at about 1,100–1,250 tok/s, so a 131K-token conversation
takes about 108 s on a Ryzen AI Halo pair, and while it reads, every other request on the pair waits (see the issue on
cold reads stalling the pair).

The workaround today is in docs/api.md ("Keeping the prompt cache"): keep the tools offered with tool_choice: "auto"
and say in a message that no more tools will run. That relies on the model following the message.

Ask

  • "none": keep the offered tools in the rendered prompt and forbid calls while decoding. For "required" on
    DeepSeek-V4.1, checkFeatures in zig/src/server/server.zig already gives the engine a .calls structure that holds
    the reply to a DSML block. "none" would need the reverse: after the think end, never allow the DSML calls opener.
  • A named function: render every offered tool, as for "auto", and hold the .calls structure to the named one.

Both keep the prompt identical to the turn before, so the cache resumes it.

docs/api.md documents the current behaviour ("none hides tools from the template", on every backend), so this
may be better as a DeepSeek-V4.1 change, or behind a server flag, than a change for every family.

主要言語
Zig
スター
76
フォーク
9
平均マージ
21時間 59分
マージ済み PR(30日)
34

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Shoestring-dev/StrixFold のほかの issue

Shoestring-dev/StrixFold の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。