mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(fix) use litellm.cache for getting key
This commit is contained in:
parent
2130a61b6e
commit
bf851ef19a
2 changed files with 4 additions and 7 deletions
|
@ -995,15 +995,14 @@ def get_logging_payload(kwargs, response_obj, start_time, end_time):
|
|||
if api_key is not None and isinstance(api_key, str) and api_key.startswith("sk-"):
|
||||
# hash the api_key
|
||||
api_key = hash_token(api_key)
|
||||
from litellm.caching import Cache
|
||||
|
||||
c = Cache()
|
||||
cache_key = c.get_cache_key(**kwargs)
|
||||
|
||||
if "headers" in metadata and "authorization" in metadata["headers"]:
|
||||
metadata["headers"].pop(
|
||||
"authorization"
|
||||
) # do not store the original `sk-..` api key in the db
|
||||
if litellm.cache is not None:
|
||||
cache_key = litellm.cache.get_cache_key(**kwargs)
|
||||
else:
|
||||
cache_key = "Cache OFF"
|
||||
|
||||
payload = {
|
||||
"request_id": id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue