Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Pass through Anthropic cache configuration when using Zed provider (#16685)

Marshall Bowers93642c9c51c1
diff --git a/crates/language_model/src/provider/cloud.rs b/crates/language_model/src/provider/cloud.rs
index 0517986f289..6cefa8de7d4 100644
--- a/crates/language_model/src/provider/cloud.rs
+++ b/crates/language_model/src/provider/cloud.rs
@@ -445,6 +445,21 @@ impl LanguageModel for CloudLanguageModel {
self.model.max_token_count()
}
+ fn cache_configuration(&self) -> Option<LanguageModelCacheConfiguration> {
+ match &self.model {
+ CloudModel::Anthropic(model) => {
+ model
+ .cache_configuration()
+ .map(|cache| LanguageModelCacheConfiguration {
+ max_cache_anchors: cache.max_cache_anchors,
+ should_speculate: cache.should_speculate,
+ min_total_token: cache.min_total_token,
+ })
+ }
+ CloudModel::OpenAi(_) | CloudModel::Google(_) | CloudModel::Zed(_) => None,
+ }
+ }
+
fn count_tokens(
&self,
request: LanguageModelRequest,