Merge pull request #345 from 0xThresh/enh-functions-doc

Minor updates to functions docs
This commit is contained in:
Timothy Jaeryang Baek 2024-12-29 16:14:48 -08:00 committed by GitHub
commit 57daaf3f5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 11 deletions

View File

@ -5,7 +5,7 @@ title: "🧰 Functions"
## 🚀 What Are Functions? ## 🚀 What Are Functions?
Functions are like **plugins** for OpenWebUI. They help you **extend its capabilities**—whether its adding support for new AI models like Anthropic or Vertex AI, tweaking how messages are processed, or introducing custom buttons to the interface for better usability. Functions are like **plugins** for OpenWebUI. They help you **extend its capabilities**—whether its adding support for new AI model providers like Anthropic or Vertex AI, tweaking how messages are processed, or introducing custom buttons to the interface for better usability.
Unlike external tools that may require complex integrations, **Functions are built-in and run within the OpenWebUI environment.** That means they are fast, modular, and dont rely on external dependencies. Unlike external tools that may require complex integrations, **Functions are built-in and run within the OpenWebUI environment.** That means they are fast, modular, and dont rely on external dependencies.
@ -29,7 +29,7 @@ A **Pipe Function** is how you create **custom agents/models** or integrations,
**Use case example:** **Use case example:**
Imagine you want to query Google Search directly from OpenWebUI. You can create a Pipe Function that: Imagine you want to query Google Search directly from OpenWebUI. You can create a Pipe Function that:
1. Takes your input. 1. Takes your message as the search query.
2. Sends the query to Google Searchs API. 2. Sends the query to Google Searchs API.
3. Processes the response and returns it to you inside the WebUI like a normal "model" response. 3. Processes the response and returns it to you inside the WebUI like a normal "model" response.
@ -82,7 +82,7 @@ Learn how to set them up in the [**Action Functions Guide**](./action.mdx).
Here's how to put Functions to work in OpenWebUI: Here's how to put Functions to work in OpenWebUI:
### 1. **Install Functions** ### 1. **Install Functions**
You can install Functions via the OpenWebUI interface or by importing them manually. You can install Functions via the OpenWebUI interface or by importing them manually. You can find community-created functions on the [OpenWebUI Community Site](https://openwebui.com/functions).
⚠️ **Be cautious.** Only install Functions from trusted sources. Running unknown code poses security risks. ⚠️ **Be cautious.** Only install Functions from trusted sources. Running unknown code poses security risks.

View File

@ -8,9 +8,9 @@ import Common from './tab-shared/Common.md';
#### Pipe #### Pipe
A Pipe is used to create a "Model" with custom logic and processing. A Pipe will always show up as it's own singular model in the OpenWebUI interface and will, much like a filter A Pipe is used to create a "Model" with custom logic and processing. A Pipe will always show up as its own singular model in the OpenWebUI interface.
A Pipe has a single main component called a pipe function. This component encapsulates all of the primary logic that the Pipe will perform. A Pipe has a single main component called a **pipe function**. This component encapsulates all of the primary logic that the Pipe will perform.
<details> <details>
<summary>Example</summary> <summary>Example</summary>
@ -43,12 +43,12 @@ class Pipe:
</details> </details>
#### Manifold #### Manifold
A Manifold is used to create a collection of Pipes. If a Pipe creates a singular "Model", a Manifold creates a set of "Models." Manifolds are typically used to create integrations with other providers. A Manifold is used to create a collection of Pipes. If a Pipe creates a singular "Model", a Manifold creates a set of "Models." Manifolds are typically used to create integrations with other model providers, such as Anthropic or Groq.
A Manifold has two main components: A Manifold has two main components:
##### Pipes Function ##### Pipes Function
This is used to simply initiate a dictionary to hold all of the Pipes created by the manifold This is used to simply initiate a dictionary to hold all of the Pipes created by the manifold.
##### Pipe Function ##### Pipe Function
As referenced above, this component encapsulates all of the primary logic that the Pipe will perform. As referenced above, this component encapsulates all of the primary logic that the Pipe will perform.

View File

@ -2,7 +2,7 @@
### Valves and UserValves - (optional, but HIGHLY encouraged) ### Valves and UserValves - (optional, but HIGHLY encouraged)
Valves and UserValves are used to allow users to provide dyanmic 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. 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.
Valves are configurable by admins alone and UserValves are configurable by any users. Valves are configurable by admins alone and UserValves are configurable by any users.

View File

@ -95,7 +95,7 @@ Each tool must have type hints for arguments. As of version OpenWebUI version 0.
### Valves and UserValves - (optional, but HIGHLY encouraged) ### Valves and UserValves - (optional, but HIGHLY encouraged)
Valves and UserValves are used to allow users to provide dyanmic 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 Tool. 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 Tool.
Valves are configurable by admins alone and UserValves are configurable by any users. Valves are configurable by admins alone and UserValves are configurable by any users.
@ -147,7 +147,7 @@ This is used to add statuses to a message while it is performing steps. These ca
await __event_emitter__( await __event_emitter__(
{ {
"type": "status", # We set the type here "type": "status", # We set the type here
"data": {"description": "Message that shows up in the chat", "done": False}, "data": {"description": "Message that shows up in the chat", "done": False, "hidden": False},
# Note done is False here indicating we are still emitting statuses # Note done is False here indicating we are still emitting statuses
} }
) )
@ -178,8 +178,9 @@ async def test_function(
await __event_emitter__( await __event_emitter__(
{ {
"type": "status", "type": "status",
"data": {"description": "Completed a task message", "done": True}, "data": {"description": "Completed a task message", "done": True, "hidden": False},
# Note done is True here indicating we are done emitting statuses # Note done is True here indicating we are done emitting statuses
# You can also set "hidden": True if you want to remove the status once the message is returned
} }
) )