From 6a33859224cdcbaaf464caa4d27e635a54b9ae80 Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Fri, 9 May 2025 17:46:35 -0700 Subject: [PATCH] fix: use auto function calling for together models (#2097) --- letta/llm_api/openai_client.py | 2 ++ letta/schemas/providers.py | 11 ----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/letta/llm_api/openai_client.py b/letta/llm_api/openai_client.py index dc6804d1..61089bbf 100644 --- a/letta/llm_api/openai_client.py +++ b/letta/llm_api/openai_client.py @@ -93,6 +93,8 @@ def requires_auto_tool_choice(llm_config: LLMConfig) -> bool: if "nebius.com" in llm_config.model_endpoint: return True + if "together.ai" in llm_config.model_endpoint or "together.xyz" in llm_config.model_endpoint: + return True # proxy also has this issue (FIXME check) elif llm_config.model_endpoint == LETTA_MODEL_ENDPOINT: return True diff --git a/letta/schemas/providers.py b/letta/schemas/providers.py index 822b291a..b55d9267 100644 --- a/letta/schemas/providers.py +++ b/letta/schemas/providers.py @@ -222,17 +222,6 @@ class OpenAIProvider(Provider): # } if "config" not in model: continue - if "chat_template" not in model["config"]: - continue - if model["config"]["chat_template"] is None: - continue - if model["config"]["chat_template"] is not None and "tools" not in model["config"]["chat_template"]: - # NOTE: this is a hack to filter out models that don't support tool calling - continue - if "tools" not in model["config"]["chat_template"]: - continue - # if "config" in data and "chat_template" in data["config"] and "tools" not in data["config"]["chat_template"]: - # continue if "nebius.com" in self.base_url: # Nebius includes the type, which we can use to filter for text models