feat: change default value for legacy put_inner_thoughts_in_kwargs (#6395)

* feat: change default value for legacy put_inner_thoughts_in_kwargs

* update default in validation layer
This commit is contained in:
cthomas
2025-11-25 15:04:03 -08:00
committed by Caren Thomas
parent 4c24b4b104
commit a101b6c4e9
3 changed files with 6 additions and 8 deletions

View File

@@ -28873,7 +28873,7 @@
], ],
"title": "Put Inner Thoughts In Kwargs", "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.", "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": { "handle": {
"anyOf": [ "anyOf": [

View File

@@ -55,7 +55,7 @@ class LLMConfig(BaseModel):
model_wrapper: Optional[str] = Field(None, description="The wrapper for the model.") model_wrapper: Optional[str] = Field(None, description="The wrapper for the model.")
context_window: int = Field(..., description="The context window size for the model.") context_window: int = Field(..., description="The context window size for the model.")
put_inner_thoughts_in_kwargs: Optional[bool] = Field( 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.", 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.") 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: if model is None:
return values return values
# Define models where we want put_inner_thoughts_in_kwargs to be False # Default put_inner_thoughts_in_kwargs to False for all models
avoid_put_inner_thoughts_in_kwargs = ["gpt-4"] # 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: 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 # 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" # We can set this flag to `true` if desired, which will enable "double-think"

View File

@@ -2391,11 +2391,9 @@ def test_inner_thoughts_false_non_reasoner_models(
pytest.skip(f"Skipping test for reasoning model {model_handle}") 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 # 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_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 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) agent_state = client.agents.update(agent_id=agent_state.id, model=model_handle, model_settings=model_settings)
response = client.agents.messages.create( response = client.agents.messages.create(
agent_id=agent_state.id, agent_id=agent_state.id,