From d724636365b9ceaa85aee7a8bd4b2265beb4dbb6 Mon Sep 17 00:00:00 2001 From: Ricky-7-Yan <2314530442@qq.com> Date: Mon, 31 Aug 2026 02:19:35 +0800 Subject: [PATCH 1/4] fix(infinity): avoid shared default error headers --- litellm/llms/infinity/common_utils.py | 11 +++++++++-- tests/test_litellm/llms/infinity/test_common_utils.py | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tests/test_litellm/llms/infinity/test_common_utils.py diff --git a/litellm/llms/infinity/common_utils.py b/litellm/llms/infinity/common_utils.py index e23fe4a0d37..211d430847d 100644 --- a/litellm/llms/infinity/common_utils.py +++ b/litellm/llms/infinity/common_utils.py @@ -4,10 +4,17 @@ from litellm.llms.base_llm.chat.transformation import BaseLLMException class InfinityError(BaseLLMException): - def __init__(self, status_code: int, message: str, headers: dict | httpx.Headers = {}): + def __init__( + self, + status_code: int, + message: str, + headers: dict | httpx.Headers | None = None, + ): self.status_code = status_code self.message = message - self.request = httpx.Request(method="POST", url="https://github.com/michaelfeil/infinity") + self.request = httpx.Request( + method="POST", url="https://github.com/michaelfeil/infinity" + ) self.response = httpx.Response(status_code=status_code, request=self.request) super().__init__( status_code=status_code, diff --git a/tests/test_litellm/llms/infinity/test_common_utils.py b/tests/test_litellm/llms/infinity/test_common_utils.py new file mode 100644 index 00000000000..895c8d3182c --- /dev/null +++ b/tests/test_litellm/llms/infinity/test_common_utils.py @@ -0,0 +1,9 @@ +from litellm.llms.infinity.common_utils import InfinityError + + +def test_infinity_error_default_headers_are_not_shared() -> None: + first_error = InfinityError(status_code=500, message="first") + second_error = InfinityError(status_code=500, message="second") + + assert first_error.headers is None + assert second_error.headers is None From 4fd17756fdb1618b6924a5ba3144f6e08e0ed4fa Mon Sep 17 00:00:00 2001 From: Ricky-7-Yan <2314530442@qq.com> Date: Mon, 31 Aug 2026 05:31:06 +0800 Subject: [PATCH 2/4] style(infinity): apply ruff formatting --- litellm/llms/infinity/common_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/litellm/llms/infinity/common_utils.py b/litellm/llms/infinity/common_utils.py index 211d430847d..89bb0077768 100644 --- a/litellm/llms/infinity/common_utils.py +++ b/litellm/llms/infinity/common_utils.py @@ -12,9 +12,7 @@ class InfinityError(BaseLLMException): ): self.status_code = status_code self.message = message - self.request = httpx.Request( - method="POST", url="https://github.com/michaelfeil/infinity" - ) + self.request = httpx.Request(method="POST", url="https://github.com/michaelfeil/infinity") self.response = httpx.Response(status_code=status_code, request=self.request) super().__init__( status_code=status_code, From d3c58cc991b45a0c7de7c97247f976d2361bd97a Mon Sep 17 00:00:00 2001 From: Ricky-7-Yan <2314530442@qq.com> Date: Mon, 31 Aug 2026 22:45:24 +0800 Subject: [PATCH 3/4] test(infinity): colocate error regression coverage --- tests/llm_translation/test_infinity.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/llm_translation/test_infinity.py b/tests/llm_translation/test_infinity.py index 1829113e045..199b75485a1 100644 --- a/tests/llm_translation/test_infinity.py +++ b/tests/llm_translation/test_infinity.py @@ -5,6 +5,7 @@ from unittest.mock import AsyncMock import litellm +from litellm.llms.infinity.common_utils import InfinityError from unittest.mock import patch, MagicMock @@ -17,6 +18,14 @@ from litellm.llms.custom_httpx.http_handler import HTTPHandler, AsyncHTTPHandler from litellm.types.utils import EmbeddingResponse, Usage +def test_infinity_error_default_headers_are_not_shared() -> None: + first_error = InfinityError(status_code=500, message="first") + second_error = InfinityError(status_code=500, message="second") + + assert first_error.headers is None + assert second_error.headers is None + + @pytest.mark.asyncio() async def test_infinity_rerank(): mock_response = AsyncMock() From f7a76bdc64176f4a29ee734eef3691380f64bfa0 Mon Sep 17 00:00:00 2001 From: Ricky-7-Yan <2314530442@qq.com> Date: Mon, 31 Aug 2026 22:45:40 +0800 Subject: [PATCH 4/4] test(infinity): remove fragmented test module --- tests/test_litellm/llms/infinity/test_common_utils.py | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 tests/test_litellm/llms/infinity/test_common_utils.py diff --git a/tests/test_litellm/llms/infinity/test_common_utils.py b/tests/test_litellm/llms/infinity/test_common_utils.py deleted file mode 100644 index 895c8d3182c..00000000000 --- a/tests/test_litellm/llms/infinity/test_common_utils.py +++ /dev/null @@ -1,9 +0,0 @@ -from litellm.llms.infinity.common_utils import InfinityError - - -def test_infinity_error_default_headers_are_not_shared() -> None: - first_error = InfinityError(status_code=500, message="first") - second_error = InfinityError(status_code=500, message="second") - - assert first_error.headers is None - assert second_error.headers is None