diff --git a/litellm/llms/anthropic.py b/litellm/llms/anthropic.py index 8cce80826..85dfa8dff 100644 --- a/litellm/llms/anthropic.py +++ b/litellm/llms/anthropic.py @@ -7,6 +7,7 @@ from typing import Callable, Optional from litellm.utils import ModelResponse import litellm from .prompt_templates.factory import prompt_factory, custom_prompt +import httpx class AnthropicConstants(Enum): HUMAN_PROMPT = "\n\nHuman: " @@ -16,6 +17,8 @@ class AnthropicError(Exception): def __init__(self, status_code, message): self.status_code = status_code self.message = message + self.request = httpx.Request(method="POST", url="https://api.anthropic.com/v1/complete") + self.response = httpx.Response(status_code=status_code, request=self.request) super().__init__( self.message ) # Call the base class constructor with the parameters it needs diff --git a/litellm/llms/huggingface_restapi.py b/litellm/llms/huggingface_restapi.py index 8f7d57055..029e6a637 100644 --- a/litellm/llms/huggingface_restapi.py +++ b/litellm/llms/huggingface_restapi.py @@ -14,8 +14,8 @@ class HuggingfaceError(Exception): def __init__(self, status_code, message): self.status_code = status_code self.message = message - self.response = httpx.Response(status_code=status_code) - self.request = self.response.request + self.request = httpx.Request(method="POST", url="https://api-inference.huggingface.co/models") + self.response = httpx.Response(status_code=status_code, request=self.request) super().__init__( self.message ) # Call the base class constructor with the parameters it needs diff --git a/litellm/llms/replicate.py b/litellm/llms/replicate.py index 4fe233c61..b45d6119f 100644 --- a/litellm/llms/replicate.py +++ b/litellm/llms/replicate.py @@ -5,11 +5,14 @@ import time from typing import Callable, Optional from litellm.utils import ModelResponse import litellm +import httpx class ReplicateError(Exception): def __init__(self, status_code, message): self.status_code = status_code self.message = message + self.request = httpx.Request(method="POST", url="https://api.replicate.com/v1/deployments") + self.response = httpx.Response(status_code=status_code, request=self.request) super().__init__( self.message ) # Call the base class constructor with the parameters it needs diff --git a/litellm/llms/sagemaker.py b/litellm/llms/sagemaker.py index 8c999af63..8f07378b3 100644 --- a/litellm/llms/sagemaker.py +++ b/litellm/llms/sagemaker.py @@ -8,11 +8,14 @@ import litellm from litellm.utils import ModelResponse, get_secret import sys from copy import deepcopy +import httpx class SagemakerError(Exception): def __init__(self, status_code, message): self.status_code = status_code self.message = message + self.request = httpx.Request(method="POST", url="https://us-west-2.console.aws.amazon.com/sagemaker") + self.response = httpx.Response(status_code=status_code, request=self.request) super().__init__( self.message ) # Call the base class constructor with the parameters it needs