Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: add missing hardcodings for popular OpenAI models (#1863)
Charles Packerfb8ba76e423a
diff --git a/letta/constants.py b/letta/constants.pyindex 84fa0a76f..e8fac6796 100644--- a/letta/constants.py+++ b/letta/constants.py@@ -75,6 +75,27 @@ NON_USER_MSG_PREFIX = "[This is an automated system message hidden from the userLLM_MAX_TOKENS = {"DEFAULT": 8192,## OpenAI models: https://platform.openai.com/docs/models/overview+ # "o1-preview+ "chatgpt-4o-latest": 128000,+ # "o1-preview-2024-09-12+ "gpt-4o-2024-08-06": 128000,+ "gpt-4-turbo-preview": 128000,+ "gpt-4o": 128000,+ "gpt-3.5-turbo-instruct": 16385,+ "gpt-4-0125-preview": 128000,+ "gpt-3.5-turbo-0125": 16385,+ # "babbage-002": 128000,+ # "davinci-002": 128000,+ "gpt-4-turbo-2024-04-09": 128000,+ # "gpt-4o-realtime-preview-2024-10-01+ "gpt-4-turbo": 8192,+ "gpt-4o-2024-05-13": 128000,+ # "o1-mini+ # "o1-mini-2024-09-12+ # "gpt-3.5-turbo-instruct-0914+ "gpt-4o-mini": 128000,+ # "gpt-4o-realtime-preview+ "gpt-4o-mini-2024-07-18": 128000,# gpt-4"gpt-4-1106-preview": 128000,"gpt-4": 8192,diff --git a/letta/providers.py b/letta/providers.pyindex c524d9394..361d1728d 100644--- a/letta/providers.py+++ b/letta/providers.py@@ -70,6 +70,12 @@ class OpenAIProvider(Provider):configs.append(LLMConfig(model=model_name, model_endpoint_type="openai", model_endpoint=self.base_url, context_window=context_window_size))++ # for OpenAI, sort in reverse order+ if self.base_url == "https://api.openai.com/v1":+ # alphnumeric sort+ configs.sort(key=lambda x: x.model, reverse=True)+return configsdef list_embedding_models(self) -> List[EmbeddingConfig]: