From 9be250c0f0852c4a9851ed2612b97f97b06d54e4 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 6 Apr 2024 19:27:26 -0700 Subject: [PATCH] add exit and aenter --- litellm/llms/custom_httpx/http_handler.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 ):