Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
copilot: Add Claude 3.7-Sonnet-Thought model to Copilot Chat (#27409)
isomobaf03e355be7
diff --git a/crates/copilot/src/copilot_chat.rs b/crates/copilot/src/copilot_chat.rsindex 3c3c193e78e..15a4cddf20f 100644--- a/crates/copilot/src/copilot_chat.rs+++ b/crates/copilot/src/copilot_chat.rs@@ -43,6 +43,11 @@ pub enum Model {Claude3_5Sonnet,#[serde(alias = "claude-3-7-sonnet", rename = "claude-3.7-sonnet")]Claude3_7Sonnet,+ #[serde(+ alias = "claude-3.7-sonnet-thought",+ rename = "claude-3.7-sonnet-thought"+ )]+ Claude3_7SonnetThinking,#[serde(alias = "gemini-2.0-flash", rename = "gemini-2.0-flash-001")]Gemini20Flash,}@@ -54,7 +59,8 @@ impl Model {| Self::Gpt4| Self::Gpt3_5Turbo| Self::Claude3_5Sonnet- | Self::Claude3_7Sonnet => true,+ | Self::Claude3_7Sonnet+ | Self::Claude3_7SonnetThinking => true,Self::O3Mini | Self::O1 | Self::Gemini20Flash => false,}}@@ -68,6 +74,7 @@ impl Model {"o3-mini" => Ok(Self::O3Mini),"claude-3-5-sonnet" => Ok(Self::Claude3_5Sonnet),"claude-3-7-sonnet" => Ok(Self::Claude3_7Sonnet),+ "claude-3.7-sonnet-thought" => Ok(Self::Claude3_7SonnetThinking),"gemini-2.0-flash-001" => Ok(Self::Gemini20Flash),_ => Err(anyhow!("Invalid model id: {}", id)),}@@ -82,6 +89,7 @@ impl Model {Self::O1 => "o1",Self::Claude3_5Sonnet => "claude-3-5-sonnet",Self::Claude3_7Sonnet => "claude-3-7-sonnet",+ Self::Claude3_7SonnetThinking => "claude-3.7-sonnet-thought",Self::Gemini20Flash => "gemini-2.0-flash-001",}}@@ -95,6 +103,7 @@ impl Model {Self::O1 => "o1",Self::Claude3_5Sonnet => "Claude 3.5 Sonnet",Self::Claude3_7Sonnet => "Claude 3.7 Sonnet",+ Self::Claude3_7SonnetThinking => "Claude 3.7 Sonnet Thinking",Self::Gemini20Flash => "Gemini 2.0 Flash",}}@@ -108,6 +117,7 @@ impl Model {Self::O1 => 20_000,Self::Claude3_5Sonnet => 200_000,Self::Claude3_7Sonnet => 90_000,+ Self::Claude3_7SonnetThinking => 90_000,Model::Gemini20Flash => 128_000,}}diff --git a/crates/language_models/src/provider/copilot_chat.rs b/crates/language_models/src/provider/copilot_chat.rsindex 3d41144fc69..f5cea2666ee 100644--- a/crates/language_models/src/provider/copilot_chat.rs+++ b/crates/language_models/src/provider/copilot_chat.rs@@ -186,6 +186,7 @@ impl LanguageModel for CopilotChatLanguageModel {match self.model {CopilotChatModel::Claude3_5Sonnet => count_anthropic_tokens(request, cx),CopilotChatModel::Claude3_7Sonnet => count_anthropic_tokens(request, cx),+ CopilotChatModel::Claude3_7SonnetThinking => count_anthropic_tokens(request, cx),CopilotChatModel::Gemini20Flash => count_google_tokens(request, cx),_ => {let model = match self.model {@@ -195,6 +196,7 @@ impl LanguageModel for CopilotChatLanguageModel {CopilotChatModel::O1 | CopilotChatModel::O3Mini => open_ai::Model::Four,CopilotChatModel::Claude3_5Sonnet| CopilotChatModel::Claude3_7Sonnet+ | CopilotChatModel::Claude3_7SonnetThinking| CopilotChatModel::Gemini20Flash => {unreachable!()}