Merge pull request #1857 from BerriAI/litellm_improve_logging_langfuse_cache_hits

[FEAT] show langfuse logging / cache tags better through proxy
This commit is contained in:
Ishaan Jaff 2024-02-06 13:15:09 -08:00 committed by GitHub
commit 8119f547ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -252,8 +252,14 @@ class LangFuseLogger:
print_verbose(f"trace: {cost}")
if supports_tags:
for key, value in metadata.items():
tags.append(f"{key}:{value}")
if key in [
"user_api_key",
"user_api_key_user_id",
]:
tags.append(f"{key}:{value}")
if "cache_hit" in kwargs:
if kwargs["cache_hit"] is None:
kwargs["cache_hit"] = False
tags.append(f"cache_hit:{kwargs['cache_hit']}")
trace_params.update({"tags": tags})