fix: update max context window on base provider sync (#8803)

This commit is contained in:
Ari Webb
2026-01-16 09:54:02 -08:00
committed by Sarah Wooders
parent 637e320b11
commit 5136a8eaed

View File

@@ -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}")