Open mcdorians opened 1 month ago
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).
Issue Summary
When using the
langfuse_filter_pipeline
in Open-WebUI, modifying the part where thebody
dictionary gets extended withchat_id
within theinlet
oroutlet
methods causes a400 Bad Request
error 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.py
in Open-WebUI.400 Bad Request
error occurs in the Open-WebUI logs.Code Causing the Issue
The following code in
langfuse_filter_pipeline.py
appears to cause the error:Even adding any arbitrary key to
body
every time, such as:leads to the same
400 Bad Request
error.Observed Behavior
chat_id
is not set (which is common with non-streamed completions like tool requests), modifying thebody
in the filter results in a400 Bad Request
error from the downstream API.body
avoids the error but may not be ideal for logging purposes.Expected Behavior
body
within the filter should not cause a400 Bad Request
error.body
is modified for logging or tracking purposes.Question
body
in the filter pipeline not allowed?Logs
Additional Information
body
is modified in the filter.chat_id
is not present) prevents the error but also skips necessary logging.Request
Please investigate this issue. It seems that modifying the
body
in thelangfuse_filter_pipeline
causes downstream API requests to fail with a400 Bad Request
error.