Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: max output tokens for gemini 3 models (#7322)
Ari Webbe47eb2352271
diff --git a/letta/constants.py b/letta/constants.pyindex a52d12ffe..882f9ce3e 100644--- a/letta/constants.py+++ b/letta/constants.py@@ -360,6 +360,9 @@ LLM_MAX_CONTEXT_WINDOW = {"gemini-2.5-flash-preview-09-2025": 1048576,"gemini-2.5-flash-lite-preview-09-2025": 1048576,"gemini-2.5-computer-use-preview-10-2025": 1048576,+ # gemini 3+ "gemini-3-pro-preview": 1048576,+ "gemini-3-flash-preview": 1048576,# gemini latest aliases"gemini-flash-latest": 1048576,"gemini-flash-lite-latest": 1048576,diff --git a/letta/llm_api/google_constants.py b/letta/llm_api/google_constants.pyindex 3a50fb1be..a7e9151a8 100644--- a/letta/llm_api/google_constants.py+++ b/letta/llm_api/google_constants.py@@ -1,4 +1,6 @@GOOGLE_MODEL_TO_CONTEXT_LENGTH = {+ "gemini-3-pro-preview": 1048576,+ "gemini-3-flash-preview": 1048576,"gemini-2.5-pro": 1048576,"gemini-2.5-flash": 1048576,"gemini-live-2.5-flash": 1048576,diff --git a/letta/schemas/providers/google_gemini.py b/letta/schemas/providers/google_gemini.pyindex ea6c5fcfc..1659a6cd5 100644--- a/letta/schemas/providers/google_gemini.py+++ b/letta/schemas/providers/google_gemini.py@@ -28,7 +28,7 @@ class GoogleAIProvider(Provider):def get_default_max_output_tokens(self, model_name: str) -> int:"""Get the default max output tokens for Google Gemini models."""- if "2.5" in model_name or "2-5" in model_name: # gemini-2.5-* or gemini-2-5-*+ if "2.5" in model_name or "2-5" in model_name or model_name.startswith("gemini-3"):return 65536return 8192 # default for google geminidiff --git a/letta/schemas/providers/google_vertex.py b/letta/schemas/providers/google_vertex.pyindex b8572e5d2..dca3d6bbd 100644--- a/letta/schemas/providers/google_vertex.py+++ b/letta/schemas/providers/google_vertex.py@@ -18,7 +18,7 @@ class GoogleVertexProvider(Provider):def get_default_max_output_tokens(self, model_name: str) -> int:"""Get the default max output tokens for Google Vertex models."""- if "2.5" in model_name or "2-5" in model_name: # gemini-2.5-* or gemini-2-5-*+ if "2.5" in model_name or "2-5" in model_name or model_name.startswith("gemini-3"):return 65536return 8192 # default for google vertex