Unify language model event stream handling (#63520)

Closes https://github.com/zed-industries/zed/issues/63314
Closes https://github.com/zed-industries/zed/issues/42584

Follow-up to https://github.com/zed-industries/zed/pull/62652

Removes a lot of duplicated code in favor of throwing it
into`language_core` as well as removing duplicate struct definitions
that were only different because of entirely unused fields.

Furthermore, improves error-messages so that these untagged enum errors
are no longer a thing in an effort to make this more maintainable in the
future.

Lastly, includes a small but nice improvement changing a `Value` to a
`RawValue` so that we don't have to clone for deserialization in that
specific case.

Release Notes:

- Improved streaming for OpenAI-compatible providers.

---------

Co-authored-by: Anant Goel <anant@zed.dev>
This commit is contained in:
Finn EversandAnant Goel authored and GitHub committed 2026-09-02 15:41:05 +00:00
1 parent 73d8912639
commit af2c5b36c7
22 files changed
+1725 -1845

No files matched your search

Generated
+3
View File
@@ -9630,6 +9630,7 @@ dependencies = [
"anyhow",
"async-lock",
"cloud_llm_client",
"collections",
"futures 0.3.32",
"gpui_shared_string",
"http_client",
@@ -10213,6 +10214,7 @@ dependencies = [
"anyhow",
"futures 0.3.32",
"http_client",
"language_model_core",
"schemars 1.0.4",
"serde",
"serde_json",
@@ -10237,6 +10239,7 @@ dependencies = [
"anyhow",
"futures 0.3.32",
"http_client",
"language_model_core",
"schemars 1.0.4",
"serde",
"serde_json",