From 26070ebcee6cc1d05c05ddc9c26cb4273144d2de Mon Sep 17 00:00:00 2001 From: Ansh Rohilla Date: Sun, 20 Sep 2026 23:34:15 +0530 Subject: [PATCH] fix(router): preserve return type inference in async_function_with_fallbacks --- litellm/router.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 563316d3e1c..60e1004dc1c 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -7738,7 +7738,8 @@ class Router: if len(args) > 0 and isinstance(args[0], list) else [] # mutable-ok: empty message list for kwargs fallback ) - return await self._prompt_management_factory( + prompt_factory: Final = getattr(self, "_prompt_management_factory") # noqa: B009 # dynamic dispatch preserves async_function_with_fallbacks return type + return await prompt_factory( model=model_group, messages=input_messages, kwargs=kwargs,