fix(langfuse.py): log litellm response cost as part of langfuse metadata

This commit is contained in:
Krrish Dholakia 2024-06-03 12:57:50 -07:00
parent 3ef3a7ba5f
commit 872cd2d8a0
3 changed files with 9 additions and 1 deletions

View file

@ -396,6 +396,8 @@ class LangFuseLogger:
cost = kwargs.get("response_cost", None)
print_verbose(f"trace: {cost}")
clean_metadata["litellm_response_cost"] = cost
if (
litellm._langfuse_default_tags is not None
and isinstance(litellm._langfuse_default_tags, list)