From 4cf0197728ae97d055591ca682ede4004f88fd1a Mon Sep 17 00:00:00 2001 From: krrish-berri-2 Date: Wed, 13 May 2026 16:54:04 +0000 Subject: [PATCH] refactor(_redis): return set from _get_redis_kwargs for O(1) lookup Align _get_redis_kwargs() with the cluster helper by returning a set instead of a list, so the sentinel connection-kwargs filter uses O(1) membership tests. Addresses Greptile review feedback on PR #26302. --- litellm/_redis.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/litellm/_redis.py b/litellm/_redis.py index 006bf0af1be..ccf01f01902 100644 --- a/litellm/_redis.py +++ b/litellm/_redis.py @@ -41,7 +41,7 @@ def _get_redis_kwargs(): "retry", } - include_args = [ + include_args = { "url", "redis_connect_func", "gcp_service_account", @@ -50,9 +50,9 @@ def _get_redis_kwargs(): "azure_client_id", "azure_tenant_id", "azure_client_secret", - ] + } - available_args = [x for x in arg_spec.args if x not in exclude_args] + include_args + available_args = {x for x in arg_spec.args if x not in exclude_args} | include_args return available_args