Repository navigation
Conversation
… calls @ai-sdk/mistral 3.0.51 requires a tool_call "id" in every streaming chunk. Mistral only sends it in the first delta per index, so any model that fragments tool-call arguments across chunks fails on the first tool call. This makes the zai-glm-* relay models unusable in opencode. Fixed upstream in @ai-sdk/mistral 3.0.59 via StreamingToolCallTracker, which falls back to accumulating by index when the id is absent. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
This fix works when done locally in the config file. |
jope35
reviewed
Sep 22, 2026
| "@ai-sdk/google-vertex": "4.0.181", | ||
| "@ai-sdk/groq": "3.0.31", | ||
| "@ai-sdk/mistral": "3.0.51", | ||
| "@ai-sdk/mistral": "3.0.64", |
There was a problem hiding this comment.
Suggested change
| "@ai-sdk/mistral": "3.0.64", | |
| "@ai-sdk/mistral": "3.0.65", |
|
thanks @TimoStolz for driving this, looking forward to the merge of this PR! |
|
Unfortunately, this version doesn't support prompt caching. See #50748 for more details. |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #49692
Type of change
What does this PR do?
Bumps
@ai-sdk/mistralfrom 3.0.51 to 3.0.64 so that streamed tool calls work on the GLM models Mistral relays (zai-glm-5,zai-glm-5-2,zai-glm-5-3,zai-glm-latest). Today they abort on the first tool call.The pinned 3.0.51 declares
id: z.string()for every entry in atool_callsdelta. That is stricter than the wire format: Mistral sendsidandfunction.nameonly in the first delta for a givenindex, and continuation chunks carryargumentsfragments alone — clients are meant to accumulate byindex. So the chunk that continues a tool call fails validation, the arguments never get assembled, and the tool is invoked with an empty object.This only surfaces on the relayed GLM models because Mistral's own models don't fragment tool-call arguments — they return the whole tool call in one chunk,
idincluded, so the continuation path is never taken. That is also why the bump is safe for them: their behaviour doesn't change.3.0.59 fixed this upstream by relaxing the schema to
id: z.string().nullish()and routing deltas throughStreamingToolCallTracker, which falls back totoolCallsByIndexwhen the id is absent. I picked 3.0.64 as the latest release on the 3.x line this repo already tracks; 3.0.59 is the minimum that works.The lockfile change is the one resolution entry plus its dependency pins (
@ai-sdk/[email protected], which is where the tracker lives).How did you verify your code works?
Reproduced the failure on 1.18.29, then pinned the new version locally via a config override (
"npm": "@ai-sdk/[email protected]"), which exercises the same code path as this diff:Several consecutive tool calls, clean finish. Same check on
zai-glm-5-2. I also confirmed against the raw SSE stream thatmistral-large-latest,mistral-medium-latest,magistral-medium-latestandcodestral-latestemit tool calls in a single chunk withidset, so they never hit the changed path.Screenshots / recordings
n/a — not a UI change.
Checklist