Skip to content

Automate browser based workflows with AI

preserve preview suffix in vertex cache model name (#4426)

pedrohsdb6be2ef3fc68e
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py
index 76c34126c..550cf3415 100644
--- a/skyvern/forge/agent.py
+++ b/skyvern/forge/agent.py
@@ -2699,8 +2699,11 @@ class ForgeAgent:
except Exception as e:
LOG.debug("Failed to extract model name from config, using default", error=str(e))
- # Normalize model name to the canonical Vertex identifier (e.g., gemini-2.5-pro)
- match = re.search(r"(gemini-\d+(?:\.\d+)?-(?:flash-lite|flash|pro))", model_name, re.IGNORECASE)
+ # Normalize model name to the canonical Vertex identifier (e.g., gemini-2.5-pro).
+ # Preserve preview suffixes so we don't strip required identifiers (e.g., gemini-3-flash-preview).
+ match = re.search(
+ r"(gemini-\d+(?:\.\d+)?-(?:flash-lite|flash|pro)(?:-preview)?)", model_name, re.IGNORECASE
+ )
if match:
model_name = match.group(1).lower()