fix(providers): add Gemini 3.x known_location Global routing and KNOWN_MODELS entries (#9142)

Signed-off-by: Hugues Clouâtre <hugues@linux.com>
Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Hugues Clouâtre
2026-05-13 11:14:07 -04:00
committed by GitHub
parent 78eff2e6f9
commit 3d16c88b19
@@ -75,6 +75,8 @@ pub const KNOWN_MODELS: &[&str] = &[
"claude-sonnet-4@20250514", "claude-sonnet-4@20250514",
"claude-3-5-haiku@20241022", "claude-3-5-haiku@20241022",
"claude-3-haiku@20240307", "claude-3-haiku@20240307",
"gemini-3.1-flash-lite",
"gemini-3.1-pro-preview",
"gemini-3-pro-preview", "gemini-3-pro-preview",
"gemini-3-flash-preview", "gemini-3-flash-preview",
"gemini-2.5-pro", "gemini-2.5-pro",
@@ -112,13 +114,15 @@ impl fmt::Display for GcpVertexAIModel {
impl GcpVertexAIModel { impl GcpVertexAIModel {
/// Returns the default GCP location for the model. /// Returns the default GCP location for the model.
/// ///
/// Each model family has a well-known location based on availability: /// Location routing by model family:
/// - Claude models default to Ohio (us-east5) /// - Claude models: Ohio (us-east5)
/// - Gemini models default to Iowa (us-central1) /// - Gemini 3.x models: Global
/// - MaaS models default to Iowa (us-central1) /// - Other Gemini models: Iowa (us-central1)
/// - MaaS models: Iowa (us-central1)
pub fn known_location(&self) -> GcpLocation { pub fn known_location(&self) -> GcpLocation {
match self { match self {
Self::Claude(_) => GcpLocation::Ohio, Self::Claude(_) => GcpLocation::Ohio,
Self::Gemini(name) if name.starts_with("gemini-3") => GcpLocation::Global,
Self::Gemini(_) => GcpLocation::Iowa, Self::Gemini(_) => GcpLocation::Iowa,
Self::MaaS(_, _) => GcpLocation::Iowa, Self::MaaS(_, _) => GcpLocation::Iowa,
} }
@@ -369,6 +373,9 @@ mod tests {
let gemini_model = GcpVertexAIModel::try_from("gemini-2.5-flash")?; let gemini_model = GcpVertexAIModel::try_from("gemini-2.5-flash")?;
assert_eq!(gemini_model.known_location(), GcpLocation::Iowa); assert_eq!(gemini_model.known_location(), GcpLocation::Iowa);
let gemini_3_model = GcpVertexAIModel::try_from("gemini-3.1-flash-lite")?;
assert_eq!(gemini_3_model.known_location(), GcpLocation::Global);
Ok(()) Ok(())
} }