diff --git a/litellm/router.py b/litellm/router.py index ad95a0a9e..ee635b69c 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -2869,7 +2869,7 @@ class Router: api_version = litellm.get_secret(api_version_env_name) litellm_params["api_version"] = api_version - timeout = litellm_params.pop("timeout", None) + timeout = litellm_params.pop("timeout", None) or litellm.request_timeout if isinstance(timeout, str) and timeout.startswith("os.environ/"): timeout_env_name = timeout.replace("os.environ/", "") timeout = litellm.get_secret(timeout_env_name) diff --git a/litellm/utils.py b/litellm/utils.py index ffcbd46ad..48ba32faf 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -11941,11 +11941,23 @@ class CustomStreamWrapper: ) ) return processed_chunk + except httpx.TimeoutException as e: # if httpx read timeout error occues + traceback_exception = traceback.format_exc() + ## ADD DEBUG INFORMATION - E.G. LITELLM REQUEST TIMEOUT + traceback_exception += "\nLiteLLM Default Request Timeout - {}".format( + litellm.request_timeout + ) + if self.logging_obj is not None: + # Handle any exceptions that might occur during streaming + asyncio.create_task( + self.logging_obj.async_failure_handler(e, traceback_exception) + ) + raise e except Exception as e: traceback_exception = traceback.format_exc() # Handle any exceptions that might occur during streaming asyncio.create_task( - self.logging_obj.async_failure_handler(e, traceback_exception) + self.logging_obj.async_failure_handler(e, traceback_exception) # type: ignore ) raise e