From 4765f8e7f5f823de617aef3c0a2fcd578ef836bd Mon Sep 17 00:00:00 2001 From: cthomas Date: Mon, 18 Aug 2025 14:20:16 -0700 Subject: [PATCH] feat: set frequency penalty to 1 for gpt-4o (#3962) --- letta/agents/helpers.py | 1 + letta/schemas/providers/openai.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/letta/agents/helpers.py b/letta/agents/helpers.py index 42257436..7f001176 100644 --- a/letta/agents/helpers.py +++ b/letta/agents/helpers.py @@ -222,6 +222,7 @@ def _safe_load_tool_call_str(tool_call_args_str: str) -> dict: # Load it again - this is due to sometimes Anthropic returning weird json @caren tool_args = json.loads(tool_args) except json.JSONDecodeError: + logger.error("Failed to JSON decode tool call argument string: %s", tool_call_args_str) tool_args = {} return tool_args diff --git a/letta/schemas/providers/openai.py b/letta/schemas/providers/openai.py index c01a9542..c3810255 100644 --- a/letta/schemas/providers/openai.py +++ b/letta/schemas/providers/openai.py @@ -142,7 +142,7 @@ class OpenAIProvider(Provider): """This function is used to tune LLMConfig parameters to improve model performance.""" # gpt-4o-mini has started to regress with pretty bad emoji spam loops (2025-07) - if "gpt-4o-mini" in model_name or "gpt-4.1-mini" in model_name: + if "gpt-4o" in model_name or "gpt-4.1-mini" in model_name: llm_config.frequency_penalty = 1.0 return llm_config