From 68f245c96482c94d9c6d384b291a2eb2f8602b07 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 5 Aug 2024 10:12:34 -0700 Subject: [PATCH] add get_request_route --- litellm/proxy/auth/auth_utils.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/litellm/proxy/auth/auth_utils.py b/litellm/proxy/auth/auth_utils.py index d1e1b1709..aa48a6396 100644 --- a/litellm/proxy/auth/auth_utils.py +++ b/litellm/proxy/auth/auth_utils.py @@ -86,16 +86,10 @@ def get_request_route(request: Request) -> str: remove base url from path if set e.g. `/genai/chat/completions` -> `/chat/completions """ - try: - if request.url.path.startswith(request.base_url.path): - # remove base_url from path - return request.url.path[len(request.base_url.path) - 1 :] - else: - return request.url.path - except Exception as e: - verbose_proxy_logger.warning( - f"error on get_request_route: {str(e)}, defaulting to request.url.path" - ) + if request.url.path.startswith(request.base_url.path): + # remove base_url from path + return request.url.path[len(request.base_url.path) - 1 :] + else: return request.url.path