mirror of
https://github.com/open-webui/pipelines.git
synced 2026-07-21 10:05:26 -04:00
Modifying body in langfuse_filter_pipeline Causes 400 Bad Request Errors in Open-WebUI #137
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mcdorians on GitHub (Oct 6, 2024).
Issue Summary
When using the
langfuse_filter_pipelinein Open-WebUI, modifying the part where thebodydictionary gets extended withchat_idwithin theinletoroutletmethods causes a400 Bad Requesterror from the downstream API (https://<openai_api_url>/chat/completions). As a result, non-streamed completions like tool requests fail and are ignored because the completions fails..Steps to Reproduce
langfuse_filter_pipeline.pyin Open-WebUI.400 Bad Requesterror occurs in the Open-WebUI logs.Code Causing the Issue
The following code in
langfuse_filter_pipeline.pyappears to cause the error:Even adding any arbitrary key to
bodyevery time, such as:leads to the same
400 Bad Requesterror.Observed Behavior
chat_idis not set (which is common with non-streamed completions like tool requests), modifying thebodyin the filter results in a400 Bad Requesterror from the downstream API.bodyavoids the error but may not be ideal for logging purposes.Expected Behavior
bodywithin the filter should not cause a400 Bad Requesterror.bodyis modified for logging or tracking purposes.Question
bodyin the filter pipeline not allowed?Logs
Additional Information
bodyis modified in the filter.chat_idis not present) prevents the error but also skips necessary logging.Request
Please investigate this issue. It seems that modifying the
bodyin thelangfuse_filter_pipelinecauses downstream API requests to fail with a400 Bad Requesterror.@cspengler-plexxis commented on GitHub (Oct 16, 2024):
This happens in a custom pipeline I've written as well. It would be super useful to be able to add keys to the body dict within the filter (in my case, I want to append context retrieved by the RAG process in the inlet, and then access that context in the outlet so I can log it in a database along with all the other details of the user-assistant exchange).