fix(utils.py): fix double hashing issue on spend logs, streaming usage metadata logging iss

ue for spend logs
This commit is contained in:
Krrish Dholakia 2024-01-23 16:14:01 -08:00
parent f8870fb48e
commit d52f5234b4
3 changed files with 23 additions and 9 deletions

View file

@ -834,7 +834,7 @@ def get_logging_payload(kwargs, response_obj, start_time, end_time):
usage = response_obj["usage"]
id = response_obj.get("id", str(uuid.uuid4()))
api_key = metadata.get("user_api_key", "")
if api_key is not None and type(api_key) == str:
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)