Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: add default model gpt4.1 (#5897)
Ari Webbda11d80bf4bf
diff --git a/letta/constants.py b/letta/constants.pyindex 5e568f918..0e93f8ae4 100644--- a/letta/constants.py+++ b/letta/constants.py@@ -439,3 +439,6 @@ WEB_SEARCH_MODEL_ENV_VAR_DEFAULT_VALUE = "gpt-4.1-mini-2025-04-14"EXCLUDE_MODEL_KEYWORDS_FROM_BASE_TOOL_RULES = ["claude-4-sonnet", "claude-3-5-sonnet", "gpt-5", "gemini-2.5-pro"]# But include models with these keywords in base tool rules (overrides exclusion)INCLUDE_MODEL_KEYWORDS_BASE_TOOL_RULES = ["mini"]++# Default handle for model used to generate tools+DEFAULT_GENERATE_TOOL_MODEL_HANDLE = "openai/gpt-4.1"diff --git a/letta/server/rest_api/routers/v1/tools.py b/letta/server/rest_api/routers/v1/tools.pyindex 899ee5cf6..490c0698b 100644--- a/letta/server/rest_api/routers/v1/tools.py+++ b/letta/server/rest_api/routers/v1/tools.py@@ -7,6 +7,7 @@ from httpx import ConnectError, HTTPStatusErrorfrom pydantic import BaseModel, Fieldfrom starlette.responses import StreamingResponse+from letta.constants import DEFAULT_GENERATE_TOOL_MODEL_HANDLEfrom letta.errors import (LettaInvalidArgumentError,LettaInvalidMCPSchemaError,@@ -817,7 +818,7 @@ async def generate_tool_from_prompt(Generate a tool from the given user prompt."""actor = await server.user_manager.get_actor_or_default_async(actor_id=headers.actor_id)- llm_config = await server.get_cached_llm_config_async(actor=actor, handle=request.handle or "anthropic/claude-3-5-sonnet-20240620")+ llm_config = await server.get_cached_llm_config_async(actor=actor, handle=request.handle or DEFAULT_GENERATE_TOOL_MODEL_HANDLE)formatted_prompt = (f"Generate a python function named {request.tool_name} using the instructions below "+ (f"based on this starter code: \n\n```\n{request.starter_code}\n```\n\n" if request.starter_code else "\n")