Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
use reasoning tokens for gemini flash
Andrew Fitz6d8d5cdb06a1
diff --git a/letta/llm_api/google_vertex_client.py b/letta/llm_api/google_vertex_client.pyindex 3bd4eb956..38ad4db55 100644--- a/letta/llm_api/google_vertex_client.py+++ b/letta/llm_api/google_vertex_client.py@@ -2,7 +2,7 @@ import uuidfrom typing import List, Optionalfrom google import genai-from google.genai.types import FunctionCallingConfig, FunctionCallingConfigMode, GenerateContentResponse, ToolConfig+from google.genai.types import FunctionCallingConfig, FunctionCallingConfigMode, GenerateContentResponse, ThinkingConfig, ToolConfigfrom letta.helpers.datetime_helpers import get_utc_timefrom letta.helpers.json_helpers import json_dumps@@ -60,6 +60,15 @@ class GoogleVertexClient(GoogleAIClient):)request_data["config"]["tool_config"] = tool_config.model_dump()+ # Add thinking_config+ # If enable_reasoner is False, set thinking_budget to 0+ # Otherwise, use the value from max_reasoning_tokens+ thinking_budget = 0 if not self.llm_config.enable_reasoner else self.llm_config.max_reasoning_tokens+ thinking_config = ThinkingConfig(+ thinking_budget=thinking_budget,+ )+ request_data["config"]["thinking_config"] = thinking_config.model_dump()+return request_datadef convert_response_to_chat_completion(diff --git a/letta/schemas/llm_config.py b/letta/schemas/llm_config.pyindex 77114ea3b..7a3531bb5 100644--- a/letta/schemas/llm_config.py+++ b/letta/schemas/llm_config.py@@ -72,7 +72,7 @@ class LLMConfig(BaseModel):description="The reasoning effort to use when generating text reasoning models",)max_reasoning_tokens: int = Field(- 0, description="Configurable thinking budget for extended thinking, only used if enable_reasoner is True. Minimum value is 1024."+ 0, description="Configurable thinking budget for extended thinking. Used for enable_reasoner and also for Google Vertex models like Gemini 2.5 Flash. Minimum value is 1024 when used with enable_reasoner.")# FIXME hack to silence pydantic protected namespace warning