Skip to content

Commit ae682df

Browse files
committed
pass user
1 parent df637bf commit ae682df

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

eval_protocol/proxy/proxy_core/litellm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ async def handle_chat_completion(
8383
]
8484
)
8585

86-
# Build Langfuse metadata (tags)
86+
# Build Langfuse metadata (tags + user if present)
87+
# Convert user_id (from preprocess hook) to trace_user_id for Langfuse
88+
user_id = metadata.pop("user_id", None) or data.get("user")
8789
litellm_metadata = {"tags": tags, **metadata}
90+
if user_id:
91+
litellm_metadata["trace_user_id"] = user_id
8892

8993
langfuse_keys = config.langfuse_keys[project_id]
9094

0 commit comments

Comments
 (0)