test(test_caching.py): cleaning up tests

This commit is contained in:
Krrish Dholakia 2023-11-22 13:43:48 -08:00
parent 78582e158a
commit b0801f61e6
4 changed files with 51 additions and 39 deletions

View file

@ -1232,11 +1232,15 @@ def client(original_function):
cached_result = litellm.cache.get_cache(*args, **kwargs)
if cached_result != None:
print_verbose(f"Cache Hit!")
call_type = original_function.__name__
if call_type == CallTypes.completion.value and isinstance(cached_result, dict):
return convert_to_model_response_object(response_object=cached_result, model_response_object=ModelResponse())
else:
return cached_result
if "detail" in cached_result:
# implies an error occurred
pass
else:
call_type = original_function.__name__
if call_type == CallTypes.completion.value and isinstance(cached_result, dict):
return convert_to_model_response_object(response_object=cached_result, model_response_object=ModelResponse())
else:
return cached_result
# MODEL CALL
result = original_function(*args, **kwargs)
end_time = datetime.datetime.now()