From 797e9df926ca9b65191892872def285e0a6c4c84 Mon Sep 17 00:00:00 2001 From: Sparrow He Date: Sat, 18 Apr 2026 21:50:35 +0800 Subject: [PATCH] perf(router): remove redundant .items() for dictionary length check --- litellm/router_strategy/lowest_cost.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/litellm/router_strategy/lowest_cost.py b/litellm/router_strategy/lowest_cost.py index 0f1149d7e1e..ca71cab52fa 100644 --- a/litellm/router_strategy/lowest_cost.py +++ b/litellm/router_strategy/lowest_cost.py @@ -233,9 +233,7 @@ class LowestCostLoggingHandler(CustomLogger): input_tokens = 0 # randomly sample from all_deployments, incase all deployments have latency=0.0 - _items = random.sample( - list(all_deployments.items()), len(all_deployments.items()) - ) + _items = random.sample(list(all_deployments.items()), len(all_deployments)) ### GET AVAILABLE DEPLOYMENTS ### filter out any deployments > tpm/rpm limits potential_deployments = []