[GH-ISSUE #24462] feat: Dynamic Variable for User Groups #123619

Closed
opened 2026-05-21 02:57:10 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @taylorwilsdon on GitHub (May 8, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24462

Check Existing Issues

  • I have searched for all existing open AND closed issues and discussions for similar requests. I have found none that is comparable to my request.

Verify Feature Scope

  • I have read through and understood the scope definition for feature requests in the Issues section. I believe my feature request meets the definition and belongs in the Issues section instead of the Discussions.

Problem Description

We currently have dynamic Jinja2-style variables like {{USER_NAME}} and {{CURRENT_DATE}} so the system prompt adapts to each user and session automatically, which can be very useful. However, we don't have a {{USER_GROUPS}} option, which would make a model or session aware of things a user might have access to or inherent knowledge about their role in an organization. I'd like to have that.

Desired Solution you'd like

Create a new dynamic variable {{USER_GROUPS}} that expands to a comma separated list of Open-WebUI groups they're listed in.

Alternatives Considered

No response

Additional Context

I will happily build if you are game to merge @tjbck / @Classic298

Originally created by @taylorwilsdon on GitHub (May 8, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/24462 ### Check Existing Issues - [x] I have searched for all existing **open AND closed** issues and discussions for similar requests. I have found none that is comparable to my request. ### Verify Feature Scope - [x] I have read through and understood the scope definition for feature requests in the Issues section. I believe my feature request meets the definition and belongs in the Issues section instead of the Discussions. ### Problem Description We currently have dynamic Jinja2-style variables like {{USER_NAME}} and {{CURRENT_DATE}} so the system prompt adapts to each user and session automatically, which can be very useful. However, we don't have a {{USER_GROUPS}} option, which would make a model or session aware of things a user might have access to or inherent knowledge about their role in an organization. I'd like to have that. ### Desired Solution you'd like Create a new dynamic variable {{USER_GROUPS}} that expands to a comma separated list of Open-WebUI groups they're listed in. ### Alternatives Considered _No response_ ### Additional Context I will happily build if you are game to merge @tjbck / @Classic298
Author
Owner

@owui-terminator[bot] commented on GitHub (May 8, 2026):

🔍 Related Issues Found

I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:

  1. 🟣 #15589 feat: user prompt variables
    This is the core precursor feature for dynamic user prompt variables, which introduced the same Jinja2-style variable mechanism that {{USER_GROUPS}} would extend. It is the closest direct match to a request for adding a new user-specific prompt variable.
    by tjbck

  2. 🟣 #16990 feat: Group level system prompts
    This request is about applying system prompts at the group level, so it is conceptually related to making prompts aware of a user's group membership. While it does not ask for a variable, it targets the same group-aware prompt customization area.
    by Phizicks

  3. 🟣 #22527 bug: Group membership is not updated for admin users
    This bug concerns how group membership is synced and represented in Open WebUI. Since {{USER_GROUPS}} would depend on accurate group membership data, this issue is relevant to the underlying group-membership functionality.
    by tomekpz · bug

  4. 🟣 #24401 issue: KV cache invalidation with dynamic variables in system prompt
    This issue is about dynamic variables in system prompts and how they are recalculated. It is relevant because {{USER_GROUPS}} would use the same dynamic-variable system and could be subject to the same prompt-processing behavior.
    by FrederikDeVree · bug


💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.

This comment was generated automatically. React with 👍 if helpful, 👎 if not.

<!-- gh-comment-id:4408967393 --> @owui-terminator[bot] commented on GitHub (May 8, 2026): <!-- terminator-bot:related-issues-reply --> 🔍 **Related Issues Found** I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions: 1. 🟣 [#15589](https://github.com/open-webui/open-webui/issues/15589) **feat: user prompt variables** *This is the core precursor feature for dynamic user prompt variables, which introduced the same Jinja2-style variable mechanism that {{USER_GROUPS}} would extend. It is the closest direct match to a request for adding a new user-specific prompt variable.* *by tjbck* 2. 🟣 [#16990](https://github.com/open-webui/open-webui/issues/16990) **feat: Group level system prompts** *This request is about applying system prompts at the group level, so it is conceptually related to making prompts aware of a user's group membership. While it does not ask for a variable, it targets the same group-aware prompt customization area.* *by Phizicks* 3. 🟣 [#22527](https://github.com/open-webui/open-webui/issues/22527) **bug: Group membership is not updated for admin users** *This bug concerns how group membership is synced and represented in Open WebUI. Since {{USER_GROUPS}} would depend on accurate group membership data, this issue is relevant to the underlying group-membership functionality.* *by tomekpz · `bug`* 4. 🟣 [#24401](https://github.com/open-webui/open-webui/issues/24401) **issue: KV cache invalidation with dynamic variables in system prompt** *This issue is about dynamic variables in system prompts and how they are recalculated. It is relevant because {{USER_GROUPS}} would use the same dynamic-variable system and could be subject to the same prompt-processing behavior.* *by FrederikDeVree · `bug`* --- 💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead. *This comment was generated automatically.* React with 👍 if helpful, 👎 if not.
Author
Owner

@tjbck commented on GitHub (May 8, 2026):

Added as a backend only prompt variable in dev!

<!-- gh-comment-id:4409189896 --> @tjbck commented on GitHub (May 8, 2026): Added as a backend only prompt variable in dev!
Author
Owner

@taylorwilsdon commented on GitHub (May 8, 2026):

Hell yeah, amazing thanks!

<!-- gh-comment-id:4409692444 --> @taylorwilsdon commented on GitHub (May 8, 2026): Hell yeah, amazing thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#123619