From 8571cb45e80cc561dc34bc6aa89611eb96b9fe3e Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 28 Jun 2024 22:35:26 -0700 Subject: [PATCH] fix(http_handler.py): add retry logic for httpx.ConnectError --- litellm/llms/custom_httpx/http_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/custom_httpx/http_handler.py b/litellm/llms/custom_httpx/http_handler.py index dfb11f191..9b01c96b1 100644 --- a/litellm/llms/custom_httpx/http_handler.py +++ b/litellm/llms/custom_httpx/http_handler.py @@ -98,7 +98,7 @@ class AsyncHTTPHandler: response = await self.client.send(req, stream=stream) response.raise_for_status() return response - except httpx.RemoteProtocolError: + except (httpx.RemoteProtocolError, httpx.ConnectError): # Retry the request with a new session if there is a connection error new_client = self.create_client(timeout=self.timeout, concurrent_limit=1) try: