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.

fix: add null check for llm config update [LET-6340] (#6407)

cthomas776564fc8a9d
diff --git a/letta/server/server.py b/letta/server/server.py
index c439a29f0..8083199c7 100644
--- a/letta/server/server.py
+++ b/letta/server/server.py
@@ -541,6 +541,10 @@ class SyncServer(object):
# update with model_settings
if request.model_settings is not None:
+ if request.llm_config is None:
+ # Get the current agent's llm_config if not already set
+ agent = await self.agent_manager.get_agent_by_id_async(agent_id=agent_id, actor=actor)
+ request.llm_config = agent.llm_config.model_copy()
update_llm_config_params = request.model_settings._to_legacy_config_params()
request.llm_config = request.llm_config.model_copy(update=update_llm_config_params)