From 25ff25d1efec311219f3fa29239f577fc2b2b394 Mon Sep 17 00:00:00 2001 From: Chesars Date: Mon, 26 Jan 2026 13:43:17 -0300 Subject: [PATCH] fix(containers): Fix Python 3.10 compatibility for OpenAIContainerConfig LiteLLM's pyproject.toml specifies `python = ">=3.9,<4.0"`, supporting Python 3.9 and above. However, the OpenAIContainerConfig class was failing to load on Python 3.10 with: TypeError: Cannot subclass typing.Any This occurred because `BaseContainerConfig = Any` was used as a runtime placeholder, and the class then inherited from it. In Python 3.11+, subclassing `typing.Any` is allowed (added to support dynamic classes like unittest.Mock where type checkers should skip verification). However, in Python 3.10 and earlier, this raises a TypeError. The fix imports the actual BaseContainerConfig class at runtime instead of using Any as a placeholder. Fixes #19727 --- litellm/llms/openai/containers/transformation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/openai/containers/transformation.py b/litellm/llms/openai/containers/transformation.py index e67bfbe0c62..e8ab6190c74 100644 --- a/litellm/llms/openai/containers/transformation.py +++ b/litellm/llms/openai/containers/transformation.py @@ -29,7 +29,7 @@ if TYPE_CHECKING: BaseLLMException = _BaseLLMException else: LiteLLMLoggingObj = Any - BaseContainerConfig = Any + from ...base_llm.containers.transformation import BaseContainerConfig BaseLLMException = Any