feat: override Valves per-model #4348

Closed
opened 2025-11-11 15:52:02 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @kaytwo on GitHub (Mar 9, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

Current function configuration has two modalities:

  • Set valves that are global to the entire open-webui instance
  • Set user valves that are specific to an individual user's preferences

Thus, if you want to create a filter that is customized per model, you need to copy-paste the underlying function code to a new copy of that function, give it a new name, and set the system level valves to a different configuration, and then instruct your users on which one they should be picking for a given configuration. This makes it hard to allow a large number of users to maintain and customize their own model configurations with various valves.

Desired Solution you'd like

Open-webui should allow system level valves to be overridden on a per-model level. This would require adding a user interface to enumerate and configure valves to the model edit page, a place to store them in model configuration, and back-end logic to expose the proper valve to the function on use.

Alternatives Considered

  • Create multiple copies of the same function - lots of sharp edges, confusing user interactions, and duplicated code.
  • Add custom metadata to models that can be accessed in function code to manually override system level valves - this is my current hack, but would be far more usable if it duplicates the DX (for function authors - no change is needed) and UX (just add the valve config UI to the edit model page) of valves.
  • Add a new "model Valve" data type to functions: not backwards compatible with current valve code, unclear what benefit would be provided by explicitly exposing both instance-wide and per-model valves as different configuration options.

Additional Context

I would be willing to work on a PR to implement this.

Originally created by @kaytwo on GitHub (Mar 9, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Problem Description Current function configuration has two modalities: * Set valves that are global to the entire open-webui instance * Set _user_ valves that are specific to an individual user's preferences Thus, if you want to create a filter that is customized per model, you need to copy-paste the underlying function code to a new copy of that function, give it a new name, and set the system level valves to a different configuration, and then instruct your users on which one they should be picking for a given configuration. This makes it hard to allow a large number of users to maintain and customize their own model configurations with various valves. ### Desired Solution you'd like Open-webui should allow system level valves to be overridden on a per-model level. This would require adding a user interface to enumerate and configure valves to the model edit page, a place to store them in model configuration, and back-end logic to expose the proper valve to the function on use. ### Alternatives Considered * Create multiple copies of the same function - lots of sharp edges, confusing user interactions, and duplicated code. * Add custom metadata to models that can be accessed in function code to manually override system level valves - this is my current hack, but would be far more usable if it duplicates the DX (for function authors - no change is needed) and UX (just add the valve config UI to the edit model page) of valves. * Add a new "model Valve" data type to functions: not backwards compatible with current valve code, unclear what benefit would be provided by explicitly exposing both instance-wide and per-model valves as different configuration options. ### Additional Context I would be willing to work on a PR to implement this.
Author
Owner

@tjbck commented on GitHub (Mar 9, 2025):

You should be using Pipe function here.

@tjbck commented on GitHub (Mar 9, 2025): You should be using Pipe function here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#4348