Fix interaction with Anthropic models when using it via zed.dev (#15009)
Release Notes: - N/A --------- Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
dde9d37cf9
commit
728650f94a
3 changed files with 22 additions and 30 deletions
|
@ -1,4 +1,3 @@
|
|||
use crate::LanguageModelRequest;
|
||||
pub use anthropic::Model as AnthropicModel;
|
||||
pub use ollama::Model as OllamaModel;
|
||||
pub use open_ai::Model as OpenAiModel;
|
||||
|
@ -88,19 +87,4 @@ impl CloudModel {
|
|||
Self::Custom { max_tokens, .. } => max_tokens.unwrap_or(200_000),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn preprocess_request(&self, request: &mut LanguageModelRequest) {
|
||||
match self {
|
||||
Self::Claude3Opus
|
||||
| Self::Claude3Sonnet
|
||||
| Self::Claude3Haiku
|
||||
| Self::Claude3_5Sonnet => {
|
||||
request.preprocess_anthropic();
|
||||
}
|
||||
Self::Custom { name, .. } if name.starts_with("anthropic/") => {
|
||||
request.preprocess_anthropic();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ impl LanguageModelRequest {
|
|||
pub fn preprocess(&mut self) {
|
||||
match &self.model {
|
||||
LanguageModel::OpenAi(_) => {}
|
||||
LanguageModel::Anthropic(_) => {}
|
||||
LanguageModel::Anthropic(_) => self.preprocess_anthropic(),
|
||||
LanguageModel::Ollama(_) => {}
|
||||
LanguageModel::Cloud(model) => match model {
|
||||
CloudModel::Claude3Opus
|
||||
|
@ -54,6 +54,9 @@ impl LanguageModelRequest {
|
|||
| CloudModel::Claude3_5Sonnet => {
|
||||
self.preprocess_anthropic();
|
||||
}
|
||||
CloudModel::Custom { name, .. } if name.starts_with("anthropic/") => {
|
||||
self.preprocess_anthropic();
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue