forked from phoenix/litellm-mirror
fix(caching.py): handle cached_response being a dict not json string
This commit is contained in:
parent
f2210787cd
commit
f2da345173
1 changed files with 6 additions and 3 deletions
|
@ -498,9 +498,12 @@ 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:
|
||||||
cached_response = json.loads(
|
if isinstance(cached_response, dict):
|
||||||
cached_response
|
pass
|
||||||
) # Convert string to dictionary
|
else:
|
||||||
|
cached_response = json.loads(
|
||||||
|
cached_response
|
||||||
|
) # Convert string to dictionary
|
||||||
except:
|
except:
|
||||||
cached_response = ast.literal_eval(cached_response)
|
cached_response = ast.literal_eval(cached_response)
|
||||||
return cached_response
|
return cached_response
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue