mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-10 01:31:31 -06:00
[GH-ISSUE #15572] feat: ExternalReranker must honor ENABLE_FORWARD_USER_INFO_HEADERS parameter #17606
Reference in New Issue
Block a user
Originally created by @athoik on GitHub (Jul 7, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/15572
Check Existing Issues
Problem Description
External reranker currently doesn't honor the variable
ENABLE_FORWARD_USER_INFO_HEADERShttps://github.com/open-webui/open-webui/blob/5eca495d3e3b3066e7831141ed2adffbd6d179b4/backend/open_webui/retrieval/models/external.py#L39-L46
Desired Solution you'd like
It would be great if we could add the handling of
ENABLE_FORWARD_USER_INFO_HEADERSWe need more or less the following:
Getting the
ENABLE_FORWARD_USER_INFO_HEADERSis straight forward.But getting the
user: UserModel = Noneis not very clear.We are calling ExternaReranker from here: https://github.com/open-webui/open-webui/blob/5eca495d3e3b3066e7831141ed2adffbd6d179b4/backend/open_webui/routers/retrieval.py#L819
and get_rf is called from here: https://github.com/open-webui/open-webui/blob/5eca495d3e3b3066e7831141ed2adffbd6d179b4/backend/open_webui/routers/retrieval.py#L617-L618
Is it enough to use the user variable?
Can you please assist to add that missing feature? @tjbck
Alternatives Considered
None, there is no alternative.
Additional Context
Having that feature it's possible now to track spending on LiteLLM: https://docs.litellm.ai/docs/tutorials/openweb_ui#add-custom-headers-to-spend-tracking
Currently requests using external reranker do not contain information about user, because we do not honor the
ENABLE_FORWARD_USER_INFO_HEADERS.@tjbck commented on GitHub (Jul 8, 2025):
PR Welcome!
@rgaricano commented on GitHub (Jul 8, 2025):
PR: https://github.com/open-webui/open-webui/pull/15586
(sorry for the two wrong closed pulls)
@athoik commented on GitHub (Jul 8, 2025):
I think now i've got it how we are getting user variable :)
I was missing that part in my original qustion. @rgaricano thanks for taking over the PR.
@rgaricano commented on GitHub (Jul 8, 2025):
I just assignate it directly in function def, but as it's now probably is more clear.
But I having problems to test it, when I switch on hybrid mode & save it allways switch off again!
@athoik commented on GitHub (Jul 9, 2025):
@rgaricano it was tricky to fix it, but figure out how to do it... thanks for your efford. I added you as co-author on the commit.
A new PR created https://github.com/open-webui/open-webui/pull/15615
@rgaricano commented on GitHub (Jul 9, 2025):
Yes, similar solution as I did, but I used Users instead UserModel. By the way I found some other functions that might also need to add user.
@athoik commented on GitHub (Jul 11, 2025):
@tjbck PR created in collaboration with @rgaricano
https://github.com/open-webui/open-webui/pull/15615
@tjbck commented on GitHub (Jul 14, 2025):
Thanks everyone!
@athoik commented on GitHub (Jul 14, 2025):
You did it much beter @tjbck ! Thank you! You Rock! 🥇