mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 15:10:34 +01:00
933d8d9381
Follow-up to #64750. `LanguageModelProvider` mixes two concerns: serving requests to a model, and offering models to Zed's registry, picker and settings. Hosts that keep their own registry and UI but serve requests through this API had to stub out the registry and UI methods (`provided_models`, `default_model`, `authenticate`, `settings_view`, …). This splits the request methods into a new supertrait, `LanguageModelClient`: `stream_completion`, `stream_completion_text`, `stream_completion_tool`, `count_input_tokens`, `compact` and `api_key`, with signatures, docs and default bodies unchanged. `LanguageModelProvider: LanguageModelClient` keeps everything else. Each provider's request methods move into a separate `impl LanguageModelClient` block; no bodies change and no call sites change, since supertrait methods remain callable on `dyn LanguageModelProvider`. Provider-side sessions will live on `LanguageModelClient`. Tested: `language_model`, `language_models`, `language_models_cloud`, `copilot_chat`, `openai_subscribed`, `x_ai_subscribed`, and `agent` (753 tests), plus `cargo check --workspace --tests`. Release Notes: - N/A