mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
InfinityError.__init__ defaulted headers to a mutable {} dict, created
once at function-definition time and shared by every InfinityError
raised without an explicit headers= argument (both real call sites in
litellm/llms/infinity/embedding/transformation.py and
litellm/llms/infinity/rerank/transformation.py omit it). Mutating one
instance's .headers would silently leak into every other
default-constructed InfinityError.
Default to None instead, matching the same pattern already used by
BaseLLMException.
Fixes #38909
18 lines
747 B
Python
18 lines
747 B
Python
import httpx
|
|
|
|
from litellm.llms.base_llm.chat.transformation import BaseLLMException
|
|
|
|
|
|
class InfinityError(BaseLLMException):
|
|
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.response = httpx.Response(status_code=status_code, request=self.request)
|
|
super().__init__(
|
|
status_code=status_code,
|
|
message=message,
|
|
request=self.request,
|
|
response=self.response,
|
|
headers=headers,
|
|
) # Call the base class constructor with the parameters it needs
|