mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
Add more prompt template variable for USER_ROLE #1831
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 @rndmcnlly on GitHub (Aug 20, 2024).
Is your feature request related to a problem? Please describe.
I want to make my assistants sensitive to the user's role (e.g. whether they are an admin) without writing Python code.
Describe the solution you'd like
Support
{{USER_ROLE}}as a prompt template variable, parallel to how{{USER_NAME}}Describe alternatives you've considered
I know how to write a custom Filter to do this replacement myself, but it feels like it should be built into OWUI because the concept of roles is build into OWUI.
Additional context
It might be tempting for people writing system prompts to use the new
{{USER_ROLE}}variable as a kind of LLM-powered access control mechanism (where the assistant can make subjective judgements that consider the user's role along with other information in making choices). This is probably a pretty dangerous thing to do. However, there are save and benign uses too. One might be an instruction like...admin, warn them that they are logged in as an administrator, so any testing they do might not be representative of the normal user experience."admin." Strict access controls should be guarding any powerful admin-only tools, but a quick sentence like this can make features discoverable only to admins. Anyone can attempt to run activity "C" by name if they knew the name, and it will fail the strict check later if they are not allowed.Related prompt template variables that might be useful (and also fit the pattern of being OWUI builtins):