language_model: Remove CloudModel enum (#31322)

This PR removes the `CloudModel` enum, as it is no longer needed after
#31316.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-23 22:04:51 -04:00 committed by GitHub
parent fc8702a8f8
commit 7fb9569c15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 3 additions and 67 deletions

View file

@ -22,19 +22,16 @@ base64.workspace = true
client.workspace = true
collections.workspace = true
futures.workspace = true
google_ai = { workspace = true, features = ["schemars"] }
gpui.workspace = true
http_client.workspace = true
icons.workspace = true
image.workspace = true
open_ai = { workspace = true, features = ["schemars"] }
parking_lot.workspace = true
proto.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true
smol.workspace = true
strum.workspace = true
telemetry_events.workspace = true
thiserror.workspace = true
util.workspace = true

View file

@ -7,67 +7,9 @@ use gpui::{
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, ReadGlobal as _,
};
use proto::{Plan, TypedEnvelope};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use smol::lock::{RwLock, RwLockUpgradableReadGuard, RwLockWriteGuard};
use strum::EnumIter;
use thiserror::Error;
use crate::LanguageModelToolSchemaFormat;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
#[serde(tag = "provider", rename_all = "lowercase")]
pub enum CloudModel {
Anthropic(anthropic::Model),
OpenAi(open_ai::Model),
Google(google_ai::Model),
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema, EnumIter)]
pub enum ZedModel {
#[serde(rename = "Qwen/Qwen2-7B-Instruct")]
Qwen2_7bInstruct,
}
impl Default for CloudModel {
fn default() -> Self {
Self::Anthropic(anthropic::Model::default())
}
}
impl CloudModel {
pub fn id(&self) -> &str {
match self {
Self::Anthropic(model) => model.id(),
Self::OpenAi(model) => model.id(),
Self::Google(model) => model.id(),
}
}
pub fn display_name(&self) -> &str {
match self {
Self::Anthropic(model) => model.display_name(),
Self::OpenAi(model) => model.display_name(),
Self::Google(model) => model.display_name(),
}
}
pub fn max_token_count(&self) -> usize {
match self {
Self::Anthropic(model) => model.max_token_count(),
Self::OpenAi(model) => model.max_token_count(),
Self::Google(model) => model.max_token_count(),
}
}
pub fn tool_input_format(&self) -> LanguageModelToolSchemaFormat {
match self {
Self::Anthropic(_) | Self::OpenAi(_) => LanguageModelToolSchemaFormat::JsonSchema,
Self::Google(_) => LanguageModelToolSchemaFormat::JsonSchemaSubset,
}
}
}
#[derive(Error, Debug)]
pub struct PaymentRequiredError;