language_models: Skip empty delta text content in OpenAI and OpenAI compatible provider#37626
Conversation
…ible provider Signed-off-by: Umesh Yadav <git@umesh.dev>
b88a763 to
912ac51
Compare
|
@dhbrojas, I have fixed the issue for z.ai. I have tested it and thanks for the keys. Can you also try this branch and see it has fixed the issue for you as well. |
|
It works perfectly! Thanks a lot @imumesh18 ❤️
|
|
Oh, actually, I'm getting an error in the logs: It seems the same pattern is used when handling summaries. |
|
So the normal chat works after this change only the thread errors are getting logged right now disruption in the agent panel? Will check that as well. Might be related to thread summary loop or something all together different. |
There is no visible disruption in the agent panel. Simply a log line. The normal chat works. |
|
Okay not been able to trigger that log. Also in your agent panel does the thread has title for the thread you saw the error for? If yes then this might be from some previous thread or different issue 🤔 . |
benbrandt
left a comment
There was a problem hiding this comment.
Seems like a valid improvement. thanks!
…ompatible provider (zed-industries#37626) Closes zed-industries#37302 Related: zed-industries#37614 In case of open_ai_compatible providers like Zhipu AI and z.ai they return empty content along with usage data. below is the example json captured from z.ai. We now ignore empty content returned by providers now to avoid this issue where we would return the same empty content back to provider which would error out. ``` OpenAI Stream Response JSON: { "id": "2025090518465610d80dc21e66426d", "created": 1757069216, "model": "glm-4.5", "choices": [ { "index": 0, "finish_reason": "tool_calls", "delta": { "role": "assistant", "content": "" } } ], "usage": { "prompt_tokens": 7882, "completion_tokens": 150, "total_tokens": 8032, "prompt_tokens_details": { "cached_tokens": 7881 } } } ``` Release Notes: - Skip empty delta text content in OpenAI and OpenAI compatible provider Signed-off-by: Umesh Yadav <git@umesh.dev>

Closes #37302
Related: #37614
In case of open_ai_compatible providers like Zhipu AI and z.ai they return empty content along with usage data. below is the example json captured from z.ai. We now ignore empty content returned by providers now to avoid this issue where we would return the same empty content back to provider which would error out.
Release Notes: