zed
zed copied to clipboard
AI: Error parsing JSON: data did not match any variant of untagged enum Part
Summary
Error interacting with language model
Error parsing JSON: Error("data did not match any variant of untagged enum Part", line: 1, column: 128)
"{\"candidates\": [{\"content\": {\"parts\": [{\"thought\": true,\"thoughtSignature\": \"AVSoXO6EGdhl66HxUCGrjuOO4NBWjIkKUFYEacEtLeYoriZK\"}],\"role\": \"model\"},\"index\": 0}],\"usageMetadata\": {\"promptTokenCount\": 5276,\"totalTokenCount\": 5279,\"promptTokensDetails\": [{\"modality\": \"TEXT\",\"tokenCount\": 5276}],\"thoughtsTokenCount\": 3},\"modelVersion\": \"models/gemini-2.5-pro-preview-05-06\",\"responseId\": \"pLk9aI7UOq2gxN8PjOzlqQo\"}"
Zed Version and System Specs
Zed: v0.188.5 (Zed) OS: Linux Wayland fedora 42 Memory: 62.2 GiB Architecture: x86_64 GPU: Intel(R) Graphics (MTL) || Intel open-source Mesa driver || Mesa 25.0.6
same here:
Zed: v0.188.5 (Zed) OS: Linux X11 ubuntu 24.04 Memory: 62 GiB Architecture: x86_64 GPU: AMD Radeon Graphics (RADV RAPHAEL_MENDOCINO) || radv || Mesa 24.2.8-1ubuntu1~24.04.1
I'm seeing this as well with the following:
Zed: v0.188.5 (Zed)
OS: macOS 14.7.2
Memory: 36 GiB
Architecture: aarch64
I opened https://github.com/zed-industries/zed/pull/31925 to hopefully address, though I'm not sure if more needs to be done for the thinking to show properly in the agent window. I followed the convention for function parts from what I could see in that provider. At the very least I seem to be able to call 2.5 locally with this build using cargo run and opening my project.
Same here Zed 0.188.5
The untagged enum in question seems to be
https://github.com/zed-industries/zed/blob/3f90bc81bd9ab31a6bba32ac92fd744d626513f8/crates/google_ai/src/google_ai.rs#L198-L205
and the actual expected format documented by google
https://ai.google.dev/api/caching#Part
@lovasoa yeah, I basically nooped that part of the payload when handling responses. If someone wants to tack onto my PR with an implementation that shows the thinking in the agent window that'd be neat. It's not something I need right now tho, the local build with those changes unblocked me for the work I'm doing w/ Google models.
https://ai.google.dev/gemini-api/docs/thinking
The model returns thought signatures in the response object when using thinking and function calling is enabled. To ensure the model maintains context across multiple turns of a conversation, you must return the thought signatures in your subsequent requests.
https://ai.google.dev/gemini-api/docs/function-calling?example=meeting#thinking
tack onto my PR with an implementation that shows the thinking in the agent window
Sounds like this is not possible, given the docs. Google hides the thinking. You cannot see it, only forward it during your next call to the api.
Yeah based on the links you shared (nice find, btw!) it sounds like the signature needs to be handled and returned regardless so that the model works properly, whether we see the thinking or not.
I actually can't tell if thinking is involved at all in my current session. I've had a conversation going for ~10 turns and the model seems to be keeping track of what we're working on. I don't see anything immediately obvious in the zed logs either 🤔
I believe thinking is enabled by default in 2.5.
Came across this because I'm also running into this issue this morning. The above gemini docs link only included reference to thoughtSignature as of yesterday (see the previous version at https://web.archive.org/web/20250529033204/https://ai.google.dev/gemini-api/docs/thinking). But there was no corresponding API changelog https://ai.google.dev/gemini-api/docs/changelog .
2.5 Pro doesn't yet support thinking budgets like 2.5 Flash, it was all happening behind the scenes before yesterday. My guess is that Google accidentally pushed out breaking API changes while preparing to roll out thinking budgets in the pro version. So just a heads up that this might get rolled back, as they would usually break off a breaking API change to a different model version.
My guess is that Google accidentally pushed out breaking API changes while preparing to roll out thinking budgets in the pro version. So just a heads up that this might get rolled back, as they would usually break off a breaking API change to a different model version.
Is this really a breaking API change? Looking at their Go SDK, the new field would be ignored, resulting in an empty part object, not an error. https://github.com/googleapis/go-genai/blob/080fd90ce79acdf77cb74f803f721e643e711740/models.go#L85 checks for known fields, but ignores new fields. The code for handle thoughtSignature was added 3 days ago.
Should we open a different issue until the thought parts are correctly reused?
Yeah it makes sense to me to track as a new issue