mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-28 18:21:38 +00:00
fix(langfuse.py): don't set default trace_name if trace_id given
This commit is contained in:
@@ -265,15 +265,17 @@ class LangFuseLogger:
|
||||
tags = metadata_tags
|
||||
|
||||
trace_name = metadata.get("trace_name", None)
|
||||
if trace_name is None:
|
||||
trace_id = metadata.get("trace_id", None)
|
||||
if trace_name is None and trace_id is None:
|
||||
# just log `litellm-{call_type}` as the trace name
|
||||
## DO NOT SET TRACE_NAME if trace-id set. this can lead to overwriting of past traces.
|
||||
trace_name = f"litellm-{kwargs.get('call_type', 'completion')}"
|
||||
|
||||
trace_params = {
|
||||
"name": trace_name,
|
||||
"input": input,
|
||||
"user_id": metadata.get("trace_user_id", user_id),
|
||||
"id": metadata.get("trace_id", None),
|
||||
"id": trace_id,
|
||||
"session_id": metadata.get("session_id", None),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user