From 2e62dfa31944d6797bc656474718835a55ee792c Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 17 Dec 2025 12:46:09 +0530 Subject: [PATCH] fix: get_call_types_for_route should return None instead of empty list --- litellm/litellm_core_utils/api_route_to_call_types.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litellm/litellm_core_utils/api_route_to_call_types.py b/litellm/litellm_core_utils/api_route_to_call_types.py index 35f83de1dd7..4146ff6d6a6 100644 --- a/litellm/litellm_core_utils/api_route_to_call_types.py +++ b/litellm/litellm_core_utils/api_route_to_call_types.py @@ -5,10 +5,12 @@ This dictionary maps each API endpoint to the CallTypes that can be used for tha Each route can have both async (prefixed with 'a') and sync call types. """ +from typing import List, Optional + from litellm.types.utils import API_ROUTE_TO_CALL_TYPES, CallTypes -def get_call_types_for_route(route: str) -> list: +def get_call_types_for_route(route: str) -> Optional[List[CallTypes]]: """ Get the list of CallTypes for a given API route. @@ -16,9 +18,9 @@ def get_call_types_for_route(route: str) -> list: route: API route path (e.g., "/chat/completions") Returns: - List of CallTypes for that route, or empty list if route not found + List of CallTypes for that route, or None if route not found """ - return API_ROUTE_TO_CALL_TYPES.get(route, []) + return API_ROUTE_TO_CALL_TYPES.get(route, None) def get_routes_for_call_type(call_type: CallTypes) -> list: