mirror of
https://github.com/open-webui/docs
synced 2025-05-20 03:08:56 +00:00
new: mention Literal to give choice to the user
Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>
This commit is contained in:
parent
a5877409c2
commit
7253830b10
@ -11,6 +11,7 @@ Valves are configurable by admins alone via the Tools or Functions menus. On the
|
||||
|
||||
```
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Literal
|
||||
|
||||
# Define and Valves
|
||||
class Filter:
|
||||
@ -27,6 +28,11 @@ class Filter:
|
||||
description="A valve controlling a numberical value"
|
||||
# required=False, # you can enforce fields using True
|
||||
)
|
||||
# To give the user the choice between multiple strings, you can use Literal from typing:
|
||||
choice_option: Literal["choiceA", "choiceB"] = Field(
|
||||
default="choiceA",
|
||||
description="An example of a multi choice valve",
|
||||
)
|
||||
priority: int = Field(
|
||||
default=0,
|
||||
description="Priority level for the filter operations. Lower values are passed through first"
|
||||
|
Loading…
Reference in New Issue
Block a user