From ff632d868ce5fb46c9baccc5a80af2d745a28cd9 Mon Sep 17 00:00:00 2001 From: fenil modi Date: Sat, 3 Oct 2026 15:22:06 +0000 Subject: [PATCH] fix(aiand): stay within the basedpyright reportUnknownArgumentType ceiling - derive exception_provider as the AiandException literal at the aiand dispatch (the branch is unreachable for any other provider, so the value is unchanged) and narrow model with an isinstance Final, so the call stops feeding legacy untyped locals into the typed mapper - annotate aiand_models as Set[str] --- litellm/__init__.py | 2 +- litellm/litellm_core_utils/exception_mapping_utils.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/litellm/__init__.py b/litellm/__init__.py index 27cb7991ef7..6fb2680ec9c 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -686,7 +686,7 @@ qwencloud_models: Set = set() qwen_ai_platform_models: Set = set() moonshot_models: Set = set() publicai_models: Set = set() -aiand_models: Set = set() +aiand_models: Set[str] = set() darkbloom_models: Set = set() v0_models: Set = set() morph_models: Set = set() diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.py index a4948b3daa4..db8d4b81d40 100644 --- a/litellm/litellm_core_utils/exception_mapping_utils.py +++ b/litellm/litellm_core_utils/exception_mapping_utils.py @@ -2529,13 +2529,14 @@ def exception_type( body=getattr(original_exception, "body", None), ) if custom_llm_provider == "aiand": + _aiand_model: Final = model if isinstance(model, str) else "" _map_aiand_exception( - model=model, + model=_aiand_model, original_exception=mappable_exception, custom_llm_provider=custom_llm_provider, error_str=error_str, exception_type=exception_type, - exception_provider=exception_provider, + exception_provider="AiandException", extra_information=extra_information, ) if (