diff --git a/crates/goose/src/providers/formats/gcpvertexai.rs b/crates/goose/src/providers/formats/gcpvertexai.rs index 16edea891dbc..1a90e6347955 100644 --- a/crates/goose/src/providers/formats/gcpvertexai.rs +++ b/crates/goose/src/providers/formats/gcpvertexai.rs @@ -29,6 +29,8 @@ pub enum GcpLocation { Iowa, /// Represents the us-east5 region in Ohio Ohio, + /// Represents the global endpoint (required for Gemini 3 models) + Global, } impl fmt::Display for GcpLocation { @@ -36,18 +38,7 @@ impl fmt::Display for GcpLocation { match self { Self::Iowa => write!(f, "us-central1"), Self::Ohio => write!(f, "us-east5"), - } - } -} - -impl TryFrom<&str> for GcpLocation { - type Error = ModelError; - - fn try_from(s: &str) -> Result { - match s { - "us-central1" => Ok(Self::Iowa), - "us-east5" => Ok(Self::Ohio), - _ => Err(ModelError::UnsupportedLocation(s.to_string())), + Self::Global => write!(f, "global"), } } } @@ -82,8 +73,8 @@ pub const KNOWN_MODELS: &[&str] = &[ "claude-sonnet-4@20250514", "claude-3-5-haiku@20241022", "claude-3-haiku@20240307", - "gemini-3-pro", - "gemini-3-flash", + "gemini-3-pro-preview", + "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite", diff --git a/crates/goose/src/providers/gcpvertexai.rs b/crates/goose/src/providers/gcpvertexai.rs index bba880fbf69f..5e567c6e2043 100644 --- a/crates/goose/src/providers/gcpvertexai.rs +++ b/crates/goose/src/providers/gcpvertexai.rs @@ -155,7 +155,7 @@ impl GcpVertexAIProvider { let config = crate::config::Config::global(); let project_id = config.get_param("GCP_PROJECT_ID")?; let location = Self::determine_location(config)?; - let host = format!("https://{}-aiplatform.googleapis.com", location); + let host = Self::build_host_url(&location); let client = Client::builder() .timeout(Duration::from_secs(DEFAULT_TIMEOUT_SECS)) @@ -226,6 +226,14 @@ impl GcpVertexAIProvider { .unwrap_or_else(|| GcpLocation::Iowa.to_string())) } + fn build_host_url(location: &str) -> String { + if location == "global" { + "https://aiplatform.googleapis.com".to_string() + } else { + format!("https://{}-aiplatform.googleapis.com", location) + } + } + /// Retrieves an authentication token for API requests. async fn get_auth_header(&self) -> Result { self.auth