Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: Add thinking budget for vertex gemini (#1960)
Matthew Zhou09cbb00d80e3
diff --git a/letta/llm_api/google_vertex_client.py b/letta/llm_api/google_vertex_client.pyindex 76a84daf3..177eac8d9 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_time_intfrom 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 llm_config.enable_reasoner else 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(