diff --git a/litellm/llms/custom_httpx/http_handler.py b/litellm/llms/custom_httpx/http_handler.py index c008b059330..67e6c80da6f 100644 --- a/litellm/llms/custom_httpx/http_handler.py +++ b/litellm/llms/custom_httpx/http_handler.py @@ -22,6 +22,13 @@ class AsyncHTTPHandler: # Close the client when you're done with it await self.client.aclose() + async def __aenter__(self): + return self.client + + async def __aexit__(self): + # close the client when exiting + await self.client.aclose() + async def get( self, url: str, params: Optional[dict] = None, headers: Optional[dict] = None ):