fix(caching.py): handle cached_response being a dict not json string

This commit is contained in:
Krrish Dholakia 2024-01-03 17:29:27 +05:30
parent f2210787cd
commit f2da345173

View file

@ -498,6 +498,9 @@ class Cache:
# cached_response is in `b{} convert it to ModelResponse # cached_response is in `b{} convert it to ModelResponse
cached_response = cached_result.get("response") cached_response = cached_result.get("response")
try: try:
if isinstance(cached_response, dict):
pass
else:
cached_response = json.loads( cached_response = json.loads(
cached_response cached_response
) # Convert string to dictionary ) # Convert string to dictionary