From a1af7688cee504d0c08c9b9f954b5d7db1cdf079 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Thu, 11 Jan 2024 19:30:28 +0530 Subject: [PATCH] fix(utils.py): use preset cache key for async calls as well --- litellm/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/litellm/utils.py b/litellm/utils.py index 45889835eee..f6eab167dc7 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2241,6 +2241,10 @@ def client(original_function): ) cached_result = await asyncio.gather(*tasks) else: + preset_cache_key = litellm.cache.get_cache_key(*args, **kwargs) + kwargs[ + "preset_cache_key" + ] = preset_cache_key # for streaming calls, we need to pass the preset_cache_key cached_result = litellm.cache.get_cache(*args, **kwargs) if cached_result is not None and not isinstance( cached_result, list