Skip to content

Commit

Permalink
enh: langfuse filter
Browse files Browse the repository at this point in the history
  • Loading branch information
tjbck committed Jun 2, 2024
1 parent 179c66d commit 5478b92
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/filters/langfuse_filter_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,18 @@ async def inlet(self, body: dict, user: Optional[dict] = None) -> dict:
print(trace.get_trace_url())

return body

async def outlet(self, body: dict, user: Optional[dict] = None) -> dict:
print(f"outlet:{__name__}")

trace = self.langfuse.trace(
name=f"filter:{__name__}",
input=body,
user_id=user["id"],
metadata={"name": user["name"]},
session_id=body["chat_id"],
)

print(trace.get_trace_url())

return body

0 comments on commit 5478b92

Please sign in to comment.