Repository navigation
Replies: 3 comments
|
This is the same bug already reported on #1713 (BehindTheCartan, SGLang) β your one-line fix is exactly right, and I verified it line-by-line against master (47f9438) when that thread was open. Worth converging the two threads so the fix lands once. Confirmation (current master):
The fix (both threads agree): if (call.id != null) block.callId = call.id
if (call.function?.name != null) block.name = call.function.nameplus One thing both reports missed: the regression-test gap in Details (reachable surface, scope, lint) are in my #1713 reply: #1713 (comment). If you have the wire capture handy, adding it to #1713 would give the maintainers a single thread with both provider samples. |
|
Supporting your one-line fix with a measured reference semantic from the other accumulator in this ecosystem: We fault-injected the real pi-ai openai-completions accumulator (client/SSE parser/assembly unmodified; only the wire bytes synthetic) with this exact delta family β empty-string id/name continuations, late identity, parallel calls with no ids at all (index-keyed interleave), and index-less id-keyed deltas: all assemble correctly. The semantics that make it immune: blocks are keyed by That measured rule (index-first keying + first-non-empty-wins) is a ready-made semantic for the |
Uh oh!
There was an error while loading. Please reload this page.
Streaming tool calls lose
function.namewhen continuation chunks sendname: nullPackage:
@deepseek-ai/dsh-llm-deepseek(also affects@deepseek-ai/dsh) Β· Version: 0.1.0-rc.6Repo path:
packages/llm/llm-deepseek/.../index.jsSummary
Every tool call made by the model is rejected at dispatch with
unknown tool ""when theLLM is reached over an OpenAI-compatible streaming chat-completions endpoint whose
continuation chunks include
function.name: null(a valid, common variant of the OpenAIstreaming tool-call protocol β the name is sent once in the first chunk, then
nullwhilethe arguments stream).
Root cause
In the SSE tool-call accumulator:
The guard
call.function?.name !== void 0only skipsundefined. When the provider streamsfunction.name: nullin continuation chunks (after the first chunk carried the real name),null !== undefinedistrue, soblock.nameis overwritten withnull. Atfinalization
name: block.name ?? ""collapses to"", and the runtime then rejects thecall as
unknown tool "".Observed stream (first chunk has the name, rest send
name: null):Non-streaming responses from the same endpoint return the complete
function.name, so thedefect is specific to the streaming accumulator.
Fix (one line)
Guard against
nullas well asundefined:(
!= nullmatches bothnullandundefined.) The same care should be applied to thetool-call-deltaemit that follows, so a laternullnever blanks a previously known name.Impact
Tool use is completely broken for any OpenAI-compatible provider that emits
name: nulloncontinuation chunks β the agent can never call
write/bash/fs/etc. Confirmed fixrestores tool use (verified end-to-end: model created a file via its file tool).
All reactions