fix(utils.py): async add to cache - for streaming

This commit is contained in:
Krrish Dholakia 2024-03-15 18:25:40 -07:00
parent 4912ad5cf4
commit 909341c4f2

View file

@ -1795,6 +1795,11 @@ class Logging:
)
result = kwargs["async_complete_streaming_response"]
# only add to cache once we have a complete streaming response
if litellm.cache is not None and not isinstance(
litellm.cache.cache, S3Cache
):
await litellm.cache.async_add_cache(result, **kwargs)
else:
litellm.cache.add_cache(result, **kwargs)
if isinstance(callback, CustomLogger): # custom logger class
print_verbose(