diff --git a/litellm/router_strategy/complexity_router/complexity_router.py b/litellm/router_strategy/complexity_router/complexity_router.py index c8de22e91fb..d20abefbb2a 100644 --- a/litellm/router_strategy/complexity_router/complexity_router.py +++ b/litellm/router_strategy/complexity_router/complexity_router.py @@ -2218,7 +2218,9 @@ class ComplexityRouter(CustomLogger): opening_task: Final = ( "The delegated task in the following agent_message." if encrypted_task is not None - else asks_newest_first[-1] if asks_newest_first else prompt + else asks_newest_first[-1] + if asks_newest_first + else prompt ) latest_follow_up: Final = asks_newest_first[0] if len(asks_newest_first) > 1 else None task_messages: list[AllMessageValues] = [ # mutable-ok: the latest message gains optional image parts below