Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: support opus 4.1 and gpt-5 (#3806)

Sarah Woodersce4438601180
diff --git a/letta/llm_api/anthropic.py b/letta/llm_api/anthropic.py
index 8b8445a2c..9e03aa3c0 100644
--- a/letta/llm_api/anthropic.py
+++ b/letta/llm_api/anthropic.py
@@ -55,6 +55,11 @@ BASE_URL = "https://api.anthropic.com/v1"
# https://docs.anthropic.com/claude/docs/models-overview
# Sadly hardcoded
MODEL_LIST = [
+ ## Opus 4.1
+ {
+ "name": "claude-opus-4-1-20250805",
+ "context_window": 200000,
+ },
## Opus 3
{
"name": "claude-3-opus-20240229",
diff --git a/letta/llm_api/openai_client.py b/letta/llm_api/openai_client.py
index 84675f6ce..2b54a6e35 100644
--- a/letta/llm_api/openai_client.py
+++ b/letta/llm_api/openai_client.py
@@ -49,6 +49,11 @@ def is_openai_reasoning_model(model: str) -> bool:
return is_reasoning
+def is_openai_5_model(model: str) -> bool:
+ """Utility function to check if the model is a '5' model"""
+ return model.startswith("gpt-5")
+
+
def accepts_developer_role(model: str) -> bool:
"""Checks if the model accepts the 'developer' role. Note that not all reasoning models accept this role.
@@ -65,7 +70,7 @@ def supports_temperature_param(model: str) -> bool:
Example error: 400 - {'error': {'message': "Unsupported parameter: 'temperature' is not supported with this model.", 'type': 'invalid_request_error', 'param': 'temperature', 'code': 'unsupported_parameter'}}
"""
- if is_openai_reasoning_model(model):
+ if is_openai_reasoning_model(model) or is_openai_5_model(model):
return False
else:
return True
diff --git a/letta/schemas/providers/openai.py b/letta/schemas/providers/openai.py
index e1cb633e2..24c5d0298 100644
--- a/letta/schemas/providers/openai.py
+++ b/letta/schemas/providers/openai.py
@@ -11,7 +11,7 @@ from letta.schemas.providers.base import Provider
logger = get_logger(__name__)
-ALLOWED_PREFIXES = {"gpt-4", "o1", "o3", "o4"}
+ALLOWED_PREFIXES = {"gpt-4", "gpt-5", "o1", "o3", "o4"}
DISALLOWED_KEYWORDS = {"transcribe", "search", "realtime", "tts", "audio", "computer", "o1-mini", "o1-preview", "o1-pro"}
DEFAULT_EMBEDDING_BATCH_SIZE = 1024