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 = cached_result.get("response")
|
||||
try:
|
||||
cached_response = json.loads(
|
||||
cached_response
|
||||
) # Convert string to dictionary
|
||||
if isinstance(cached_response, dict):
|
||||
pass
|
||||
else:
|
||||
cached_response = json.loads(
|
||||
cached_response
|
||||
) # Convert string to dictionary
|
||||
except:
|
||||
cached_response = ast.literal_eval(cached_response)
|
||||
return cached_response
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue