Merge pull request #249 from marcklingen/feat-user-email-in-langfuse-filter-pipeline

feat: track user.email in langfuse filter pipeline and remove wrong token count
This commit is contained in:
Timothy Jaeryang Baek 2024-09-09 23:13:16 +01:00 committed by GitHub
commit a235f3dc95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,7 @@
title: Langfuse Filter Pipeline title: Langfuse Filter Pipeline
author: open-webui author: open-webui
date: 2024-05-30 date: 2024-05-30
version: 1.1 version: 1.2
license: MIT license: MIT
description: A filter pipeline that uses Langfuse. description: A filter pipeline that uses Langfuse.
requirements: langfuse requirements: langfuse
@ -90,8 +90,8 @@ class Pipeline:
trace = self.langfuse.trace( trace = self.langfuse.trace(
name=f"filter:{__name__}", name=f"filter:{__name__}",
input=body, input=body,
user_id=user["id"], user_id=user["email"],
metadata={"name": user["name"]}, metadata={"user_name": user["name"], "user_id": user["id"]},
session_id=body["chat_id"], session_id=body["chat_id"],
) )
@ -119,10 +119,6 @@ class Pipeline:
generation.end( generation.end(
output=generated_message, output=generated_message,
usage={
"totalCost": (len(user_message) + len(generated_message)) / 1000,
"unit": "CHARACTERS",
},
metadata={"interface": "open-webui"}, metadata={"interface": "open-webui"},
) )