diff --git a/docs/pipelines/filters.md b/docs/pipelines/filters.md index d1be572..e1b8a26 100644 --- a/docs/pipelines/filters.md +++ b/docs/pipelines/filters.md @@ -1,9 +1,9 @@ --- -sidebar_position: 3 -title: "Filter Pipelines" +sidebar_position: 1 +title: "Filters" --- -# Filter Pipelines +# Filters Filters are used to perform actions against incoming user messages and outgoing assistant (LLM) messages. Potential actions that can be taken in a filter include sending messages to monitoring platforms (such as Langfuse or DataDog), modifying message contents, blocking toxic messages, translating messages to another language, or rate limiting messages from certain users. A list of examples is maintained in the [Pipelines repo](https://github.com/open-webui/pipelines/tree/main/examples/filters). The general workflow can be seen in the image below.
diff --git a/docs/pipelines/valves.md b/docs/pipelines/valves.md
new file mode 100644
index 0000000..f591b9e
--- /dev/null
+++ b/docs/pipelines/valves.md
@@ -0,0 +1,29 @@
+---
+sidebar_position: 3
+title: "Valves"
+---
+
+# Valves
+Valves are input variables that are set per pipeline. Valves are set as a subclass of the `Pipeline` class, and initialized as part of the `__init__` method of the `Pipeline` class.
+
+When adding valves to your pipeline, include a way to ensure that valves can be reconfigured by admins in the web UI. There are a few options for this:
+- Use `os.getenv()` to set an environment variable to use for the pipeline, and a default value to use if the environment variable isn't set. An example can be seen below:
+```
+self.valves = self.Valves(
+ **{
+ "LLAMAINDEX_OLLAMA_BASE_URL": os.getenv("LLAMAINDEX_OLLAMA_BASE_URL", "http://localhost:11434"),
+ "LLAMAINDEX_MODEL_NAME": os.getenv("LLAMAINDEX_MODEL_NAME", "llama3"),
+ "LLAMAINDEX_EMBEDDING_MODEL_NAME": os.getenv("LLAMAINDEX_EMBEDDING_MODEL_NAME", "nomic-embed-text"),
+ }
+)
+```
+- Set the valve to the `Optional` type, which will allow the pipeline to load even if no value is set for the valve.
+```
+class Pipeline:
+ class Valves(BaseModel):
+ target_user_roles: List[str] = ["user"]
+ max_turns: Optional[int] = None
+```
+
+If you don't leave a way for valves to be updated in the web UI, you'll see the following error in the Pipelines server log after trying to add a pipeline to the web UI:
+`WARNING:root:No Pipeline class found in