mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(infinity): avoid shared default error headers
This commit is contained in:
parent
4ba8517134
commit
d724636365
2 changed files with 18 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
9
tests/test_litellm/llms/infinity/test_common_utils.py
Normal file
9
tests/test_litellm/llms/infinity/test_common_utils.py
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue