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: change default value for legacy put_inner_thoughts_in_kwargs (#6395)

cthomasa101b6c4e9bb
diff --git a/fern/openapi.json b/fern/openapi.json
index b8cc7e7c7..f00151833 100644
--- a/fern/openapi.json
+++ b/fern/openapi.json
@@ -28873,7 +28873,7 @@
],
"title": "Put Inner Thoughts In Kwargs",
"description": "Puts 'inner_thoughts' as a kwarg in the function call if this is set to True. This helps with function calling performance and also the generation of inner thoughts.",
- "default": true
+ "default": false
},
"handle": {
"anyOf": [
diff --git a/letta/schemas/llm_config.py b/letta/schemas/llm_config.py
index 33892ebb8..48afe3b35 100644
--- a/letta/schemas/llm_config.py
+++ b/letta/schemas/llm_config.py
@@ -55,7 +55,7 @@ class LLMConfig(BaseModel):
model_wrapper: Optional[str] = Field(None, description="The wrapper for the model.")
context_window: int = Field(..., description="The context window size for the model.")
put_inner_thoughts_in_kwargs: Optional[bool] = Field(
- True,
+ False,
description="Puts 'inner_thoughts' as a kwarg in the function call if this is set to True. This helps with function calling performance and also the generation of inner thoughts.",
)
handle: Optional[str] = Field(None, description="The handle for this config, in the format provider/model-name.")
@@ -163,11 +163,11 @@ class LLMConfig(BaseModel):
if model is None:
return values
- # Define models where we want put_inner_thoughts_in_kwargs to be False
- avoid_put_inner_thoughts_in_kwargs = ["gpt-4"]
-
+ # Default put_inner_thoughts_in_kwargs to False for all models
+ # Reasoning models (o1, o3, o4, claude-sonnet-4, etc.) will have this set to False below
+ # Non-reasoner models should also default to False to avoid unwanted reasoning token generation
if values.get("put_inner_thoughts_in_kwargs") is None:
- values["put_inner_thoughts_in_kwargs"] = False if model in avoid_put_inner_thoughts_in_kwargs else True
+ values["put_inner_thoughts_in_kwargs"] = False
# For the o1/o3 series from OpenAI, set to False by default
# We can set this flag to `true` if desired, which will enable "double-think"
diff --git a/tests/integration_test_send_message.py b/tests/integration_test_send_message.py
index cd3359a3e..5f0b3e1f9 100644
--- a/tests/integration_test_send_message.py
+++ b/tests/integration_test_send_message.py
@@ -2391,11 +2391,9 @@ def test_inner_thoughts_false_non_reasoner_models(
pytest.skip(f"Skipping test for reasoning model {model_handle}")
# Note: This test is for models without reasoning, so model_settings should already have reasoning disabled
- # We don't need to modify anything
last_message_page = client.agents.messages.list(agent_id=agent_state.id, limit=1)
last_message = last_message_page.items[0] if last_message_page.items else None
- model_settings["put_inner_thoughts_in_kwargs"] = False
agent_state = client.agents.update(agent_id=agent_state.id, model=model_handle, model_settings=model_settings)
response = client.agents.messages.create(
agent_id=agent_state.id,