From 5136a8eaede9100f54b455002054913f6395452b Mon Sep 17 00:00:00 2001 From: Ari Webb Date: Fri, 16 Jan 2026 09:54:02 -0800 Subject: [PATCH] fix: update max context window on base provider sync (#8803) --- letta/services/provider_manager.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/letta/services/provider_manager.py b/letta/services/provider_manager.py index bdf5e0e2..8fdcfe26 100644 --- a/letta/services/provider_manager.py +++ b/letta/services/provider_manager.py @@ -737,7 +737,17 @@ class ProviderManager: # Roll back the session to clear the failed transaction await session.rollback() else: - logger.info(f" LLM model {llm_config.handle} already exists (ID: {existing[0].id}), skipping") + # Check if max_context_window needs to be updated + existing_model = existing[0] + if existing_model.max_context_window != llm_config.context_window: + logger.info( + f" Updating LLM model {llm_config.handle} max_context_window: " + f"{existing_model.max_context_window} -> {llm_config.context_window}" + ) + existing_model.max_context_window = llm_config.context_window + await existing_model.update_async(session) + else: + logger.info(f" LLM model {llm_config.handle} already exists (ID: {existing[0].id}), skipping") # Process embedding models - add new ones logger.info(f"Processing {len(embedding_models)} embedding models for provider {provider.name}")