mirror of
https://github.com/open-webui/docs
synced 2025-06-13 18:09:49 +00:00
ran prettier write
Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>
This commit is contained in:
parent
90badfc708
commit
88e11a49bf
@ -5,7 +5,6 @@ title: "🔄 Valves & UserValves"
|
||||
|
||||
## Valves & UserValves
|
||||
|
||||
|
||||
Valves and UserValves are used to allow users to provide dynamic details such as an API key or a configuration option. These will create a fillable field or a bool switch in the GUI menu for the given function. They are always optional, but HIGHLY encouraged.
|
||||
|
||||
Hence, Valves and UserValves class can be defined in either a `Pipe`, `Pipeline`, `Filter` or `Tools` class.
|
||||
@ -15,7 +14,7 @@ Valves are configurable by admins alone via the Tools or Functions menus. On the
|
||||
<details>
|
||||
<summary>Commented example</summary>
|
||||
|
||||
```
|
||||
```
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Literal
|
||||
|
||||
@ -73,14 +72,17 @@ class Filter:
|
||||
# But this will return the default value instead of the actual value:
|
||||
# test_user_valve = __user__["valves"]["test_user_valve"] # Do not do that!
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Event Emitters
|
||||
|
||||
Event Emitters are used to add additional information to the chat interface. Similarly to Filter Outlets, Event Emitters are capable of appending content to the chat. Unlike Filter Outlets, they are not capable of stripping information. Additionally, emitters can be activated at any stage during the function.
|
||||
|
||||
There are two different types of Event Emitters:
|
||||
|
||||
#### Status
|
||||
|
||||
This is used to add statuses to a message while it is performing steps. These can be done at any stage during the Function. These statuses appear right above the message content. These are very useful for Functions that delay the LLM response or process large amounts of information. This allows you to inform users what is being processed in real-time.
|
||||
|
||||
```
|
||||
@ -133,9 +135,11 @@ async def test_function(
|
||||
|
||||
return f"Tell the user: {e}"
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
#### Message
|
||||
|
||||
This type is used to append a message to the LLM at any stage in the Function. This means that you can append messages, embed images, and even render web pages before, or after, or during the LLM response.
|
||||
|
||||
```
|
||||
@ -179,4 +183,5 @@ async def test_function(
|
||||
|
||||
return f"Tell the user: {e}"
|
||||
```
|
||||
|
||||
</details>
|
||||
|
Loading…
Reference in New Issue
Block a user