Decouple cloud provider from Model in Zed (#40281)

Release Notes:

- N/A

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
David Kleingeld
2025-10-15 20:54:57 +00:00
committed by GitHub
co-authored by Marshall Bowers
parent 186237bb1a
commit 77933f83e5
2 changed files with 9 additions and 14 deletions
@@ -322,6 +322,9 @@ pub struct LanguageModel {
pub supports_images: bool,
pub supports_thinking: bool,
pub supports_max_mode: bool,
// only used by OpenAI and xAI
#[serde(default)]
pub supports_parallel_tool_calls: bool,
}
#[derive(Debug, Serialize, Deserialize)]
+6 -14
View File
@@ -810,15 +810,11 @@ impl LanguageModel for CloudLanguageModel {
}
cloud_llm_client::LanguageModelProvider::OpenAi => {
let client = self.client.clone();
let model = match open_ai::Model::from_id(&self.model.id.0) {
Ok(model) => model,
Err(err) => return async move { Err(anyhow!(err).into()) }.boxed(),
};
let request = into_open_ai(
request,
model.id(),
model.supports_parallel_tool_calls(),
model.supports_prompt_cache_key(),
&self.model.id.0,
self.model.supports_parallel_tool_calls,
true,
None,
None,
);
@@ -860,15 +856,11 @@ impl LanguageModel for CloudLanguageModel {
}
cloud_llm_client::LanguageModelProvider::XAi => {
let client = self.client.clone();
let model = match x_ai::Model::from_id(&self.model.id.0) {
Ok(model) => model,
Err(err) => return async move { Err(anyhow!(err).into()) }.boxed(),
};
let request = into_open_ai(
request,
model.id(),
model.supports_parallel_tool_calls(),
model.supports_prompt_cache_key(),
&self.model.id.0,
self.model.supports_parallel_tool_calls,
false,
None,
None,
);