From 8fb18524442ba3065960b6e9ca771461d213cd6d Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 28 May 2026 06:18:37 +0000 Subject: [PATCH] fix(compact_20260112): type object_type as Literal for mypy --- .../context_management/editors/compact.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py b/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py index 63b685fb4e5..51f841da603 100644 --- a/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py +++ b/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py @@ -13,7 +13,7 @@ Mirrors Anthropic's native ``compact_20260112`` for non-Anthropic providers: """ import re -from typing import Any, Dict, List, Optional, Tuple, Union, cast +from typing import Any, Dict, List, Literal, Optional, Tuple, Union, cast import litellm from litellm._logging import verbose_logger @@ -98,7 +98,11 @@ def _check_summary_model_access( team_model_aliases = getattr(user_api_key_auth, "team_model_aliases", None) team_models = list(getattr(user_api_key_auth, "team_models", None) or []) - for object_type, models in (("key", key_models), ("team", team_models)): + checks: Tuple[Tuple[Literal["key", "team"], List[str]], ...] = ( + ("key", key_models), + ("team", team_models), + ) + for object_type, models in checks: if not models: continue try: