google: Add latest versions of Gemini 2.5 Pro and Flash Preview (#32183)

Release Notes:

- Added the latest versions of Gemini 2.5 Pro and Flash Preview
This commit is contained in:
Oleksiy Syvokon 2025-06-05 22:30:34 +03:00 committed by GitHub
parent d15d85830a
commit 04cd3fcd23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 44 additions and 6 deletions

View file

@ -39,7 +39,7 @@ fn eval_extract_handle_command_output() {
// Model | Pass rate
// ----------------------------|----------
// claude-3.7-sonnet | 0.98
// gemini-2.5-pro | 0.86
// gemini-2.5-pro-06-05 | 0.77
// gemini-2.5-flash | 0.11
// gpt-4.1 | 1.00

View file

@ -508,6 +508,16 @@ pub enum Model {
Gemini25ProPreview0325,
#[serde(rename = "gemini-2.5-flash-preview-04-17")]
Gemini25FlashPreview0417,
#[serde(
rename = "gemini-2.5-flash-preview-latest",
alias = "gemini-2.5-flash-preview-05-20"
)]
Gemini25FlashPreview,
#[serde(
rename = "gemini-2.5-pro-preview-latest",
alias = "gemini-2.5-pro-preview-06-05"
)]
Gemini25ProPreview,
#[serde(rename = "custom")]
Custom {
name: String,
@ -535,6 +545,24 @@ impl Model {
Model::Gemini25ProExp0325 => "gemini-2.5-pro-exp-03-25",
Model::Gemini25ProPreview0325 => "gemini-2.5-pro-preview-03-25",
Model::Gemini25FlashPreview0417 => "gemini-2.5-flash-preview-04-17",
Model::Gemini25FlashPreview => "gemini-2.5-flash-preview-latest",
Model::Gemini25ProPreview => "gemini-2.5-pro-preview-latest",
Model::Custom { name, .. } => name,
}
}
pub fn request_id(&self) -> &str {
match self {
Model::Gemini15Pro => "gemini-1.5-pro",
Model::Gemini15Flash => "gemini-1.5-flash",
Model::Gemini20Pro => "gemini-2.0-pro-exp",
Model::Gemini20Flash => "gemini-2.0-flash",
Model::Gemini20FlashThinking => "gemini-2.0-flash-thinking-exp",
Model::Gemini20FlashLite => "gemini-2.0-flash-lite-preview",
Model::Gemini25ProExp0325 => "gemini-2.5-pro-exp-03-25",
Model::Gemini25ProPreview0325 => "gemini-2.5-pro-preview-03-25",
Model::Gemini25FlashPreview0417 => "gemini-2.5-flash-preview-04-17",
Model::Gemini25FlashPreview => "gemini-2.5-flash-preview-05-20",
Model::Gemini25ProPreview => "gemini-2.5-pro-preview-06-05",
Model::Custom { name, .. } => name,
}
}
@ -548,8 +576,10 @@ impl Model {
Model::Gemini20FlashThinking => "Gemini 2.0 Flash Thinking",
Model::Gemini20FlashLite => "Gemini 2.0 Flash Lite",
Model::Gemini25ProExp0325 => "Gemini 2.5 Pro Exp",
Model::Gemini25ProPreview0325 => "Gemini 2.5 Pro Preview",
Model::Gemini25FlashPreview0417 => "Gemini 2.5 Flash Preview",
Model::Gemini25ProPreview0325 => "Gemini 2.5 Pro Preview (0325)",
Model::Gemini25FlashPreview0417 => "Gemini 2.5 Flash Preview (0417)",
Model::Gemini25FlashPreview => "Gemini 2.5 Flash Preview",
Model::Gemini25ProPreview => "Gemini 2.5 Pro Preview",
Self::Custom {
name, display_name, ..
} => display_name.as_ref().unwrap_or(name),
@ -569,6 +599,8 @@ impl Model {
Model::Gemini25ProExp0325 => ONE_MILLION,
Model::Gemini25ProPreview0325 => ONE_MILLION,
Model::Gemini25FlashPreview0417 => ONE_MILLION,
Model::Gemini25FlashPreview => ONE_MILLION,
Model::Gemini25ProPreview => ONE_MILLION,
Model::Custom { max_tokens, .. } => *max_tokens,
}
}
@ -582,6 +614,8 @@ impl Model {
| Self::Gemini20FlashThinking
| Self::Gemini20FlashLite
| Self::Gemini25ProExp0325
| Self::Gemini25ProPreview
| Self::Gemini25FlashPreview
| Self::Gemini25ProPreview0325
| Self::Gemini25FlashPreview0417 => GoogleModelMode::Default,
Self::Custom { mode, .. } => *mode,

View file

@ -362,7 +362,7 @@ impl LanguageModel for GoogleLanguageModel {
}
fn telemetry_id(&self) -> String {
format!("google/{}", self.model.id())
format!("google/{}", self.model.request_id())
}
fn max_token_count(&self) -> usize {
@ -374,7 +374,7 @@ impl LanguageModel for GoogleLanguageModel {
request: LanguageModelRequest,
cx: &App,
) -> BoxFuture<'static, Result<usize>> {
let model_id = self.model.id().to_string();
let model_id = self.model.request_id().to_string();
let request = into_google(request, model_id.clone(), self.model.mode());
let http_client = self.http_client.clone();
let api_key = self.state.read(cx).api_key.clone();
@ -411,7 +411,11 @@ impl LanguageModel for GoogleLanguageModel {
>,
>,
> {
let request = into_google(request, self.model.id().to_string(), self.model.mode());
let request = into_google(
request,
self.model.request_id().to_string(),
self.model.mode(),
);
let request = self.stream_completion(request, cx);
let future = self.request_limiter.stream(async move {
let response = request