feat: bring back model_settings and remove validation again (#6104)

This commit is contained in:
Sarah Wooders
2025-11-11 14:49:15 -08:00
committed by Caren Thomas
parent bd5f684346
commit 6eeb3c90bb
9 changed files with 298 additions and 270 deletions

View File

@@ -6,5 +6,5 @@
"model_wrapper": null,
"put_inner_thoughts_in_kwargs": true,
"enable_reasoner": true,
"max_reasoning_tokens": 20000
"max_reasoning_tokens": 1000
}

View File

@@ -1250,7 +1250,7 @@ async def test_agent_state_schema_unchanged(server: SyncServer):
from letta.schemas.group import Group
from letta.schemas.llm_config import LLMConfig
from letta.schemas.memory import Memory
from letta.schemas.model import EmbeddingModelSettings, ModelSettings
from letta.schemas.model import ModelSettingsUnion
from letta.schemas.response_format import ResponseFormatUnion
from letta.schemas.source import Source
from letta.schemas.tool import Tool
@@ -1271,9 +1271,10 @@ async def test_agent_state_schema_unchanged(server: SyncServer):
"agent_type": AgentType,
# LLM information
"llm_config": LLMConfig,
"model": ModelSettings,
"embedding": EmbeddingModelSettings,
"model": str,
"embedding": str,
"embedding_config": EmbeddingConfig,
"model_settings": (ModelSettingsUnion, type(None)),
"response_format": (ResponseFormatUnion, type(None)),
# State fields
"description": (str, type(None)),
@@ -1378,6 +1379,14 @@ async def test_agent_state_schema_unchanged(server: SyncServer):
for arg in args:
if typing.get_origin(arg) is dict:
return True
# Handle Annotated types within Union (e.g., Union[Annotated[...], None])
# This checks if any of the union args is an Annotated type that matches expected
for arg in args:
if typing.get_origin(arg) is typing.Annotated:
# For Annotated types, compare the first argument (the actual type)
annotated_args = typing.get_args(arg)
if annotated_args and annotated_args[0] == expected:
return True
return False

View File

@@ -5,11 +5,16 @@ AGENTS_CREATE_PARAMS = [
"caren_agent",
{"name": "caren", "model": "openai/gpt-4o-mini", "embedding": "openai/text-embedding-3-small"},
{
# Verify model field contains the model name and settings
# Note: we override 'model' here since the input is a string but the output is a ModelSettings object
"model": {"model": "gpt-4o-mini", "max_output_tokens": 4096, "parallel_tool_calls": False},
# Note: we override 'embedding' here since it's currently not populated in AgentState (remains None)
"embedding": None,
# Verify model_settings is populated with config values
# Note: The 'model' field itself is separate from model_settings
"model_settings": {
"max_output_tokens": 4096,
"parallel_tool_calls": False,
"provider_type": "openai",
"temperature": 0.7,
"reasoning": {"reasoning_effort": "minimal"},
"response_format": None,
}
},
None,
),
@@ -20,8 +25,15 @@ AGENTS_MODIFY_PARAMS = [
"caren_agent",
{"name": "caren_updated"},
{
# After modifying just the name, model field should still be present and unchanged
"model": {"model": "gpt-4o-mini", "max_output_tokens": 4096, "parallel_tool_calls": False}
# After modifying just the name, model_settings should still be present
"model_settings": {
"max_output_tokens": 4096,
"parallel_tool_calls": False,
"provider_type": "openai",
"temperature": 0.7,
"reasoning": {"reasoning_effort": "minimal"},
"response_format": None,
}
},
None,
),