pipelines icon indicating copy to clipboard operation
pipelines copied to clipboard

Outlet Langfuse Logging with chat_id Retention

Open resqnet opened this issue 1 year ago • 2 comments

According to Issue #415, in the latest version, the pipe function is executed before the inlet function, resulting in the following problems:

  • Problems: The inlet is expected to extract the chat_id from the request body and add or modify it in the body. However, since the pipe executes first, this process is not completed, leaving the chat_id absent. The pipe function attempts to extract the chat_id from the body for processing, but without the correct chat_id, inconsistencies occur in log retrieval and various processes. Additionally, there is an issue where the inlet is not being called properly in the first place.

  • Proposal: To address the problem where the pipe function initiates before the chat_id extraction process in the inlet, we propose changing the log generation method to the outlet side. With this change, the chat_id will be correctly preserved on the outlet side, ensuring that Langfuse logs are reliably retrieved. Although future adjustments to the execution order and configurations should be considered, this approach of retrieving logs on the outlet side is proposed as a way to bypass the current issue.

  • Change Details: Changed the implementation to generate Langfuse logs on the outlet side, removing dependency on the chat_id extraction process in the inlet. Added processing to reliably obtain the chat_id from request information during log generation on the outlet and attach it to the log.

  • Verification: Verified that the changes do not affect existing pipeline processing and that logs are retrieved correctly.

resqnet avatar Feb 19 '25 07:02 resqnet

Thank you, this is working for me. However, even after enabling "Usage" int the model, the usage information won't show in the outlet, but I guess that is another issue and not related to the pipeline.

JTHesse avatar Feb 19 '25 09:02 JTHesse

@JTHesse @ADD-Carlos-Zamora Thank you for the feedback.

I’m glad to hear that it's working for you. Regarding the usage information not showing up, it seems to be a separate issue unrelated to this pipeline. I believe this is a simple implementation example that aligns with the recent changes in openwebui specifications. If there are no issues, I’d appreciate it if you could merge it

resqnet avatar Feb 20 '25 04:02 resqnet