π§° Functions
π What Are Functions?β
Functions are like plugins for OpenWebUI. They help you extend its capabilitiesβwhether itβs 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 donβt rely on external dependencies.
Think of Functions as modular building blocks that let you enhance how the WebUI works, tailored exactly to what you need. Theyβre lightweight, highly customizable, and written in pure Python, so you have the freedom to create anythingβfrom new AI-powered workflows to integrations with anything you use, like Google Search or Home Assistant.
ποΈ Types of Functionsβ
There are three types of Functions in OpenWebUI, each with a specific purpose. Letβs break them down and explain exactly what they do:
1. Pipe Function β Create Custom "Agents/Models" β
A Pipe Function is how you create custom agents/models or integrations, which then appear in the interface as if they were standalone models.
What does it do?
- Pipes let you define complex workflows. For instance, you could create a Pipe that sends data to Model A and Model B, processes their outputs, and combines the results into one finalized answer.
- Pipes donβt even have to use AI! They can be setups for search APIs, weather data, or even systems like Home Assistant. Basically, anything youβd like to interact with can become part of OpenWebUI.
Use case example:
Imagine you want to query Google Search directly from OpenWebUI. You can create a Pipe Function that:
- Takes your message as the search query.
- Sends the query to Google Searchβs API.
- Processes the response and returns it to you inside the WebUI like a normal "model" response.
When enabled, Pipe Functions show up as their own selectable model. Use Pipes whenever you need custom functionality that works like a model in the interface.
For a detailed guide, see Pipe Functions.
2. Filter Function β Modify Inputs and Outputsβ
A Filter Function is like a tool for tweaking data before it gets sent to the AI or after it comes back.
What does it do?
Filters act as "hooks" in the workflow and have two main parts:
- Inlet: Adjust the input that is sent to the model. For example, adding additional instructions, keywords, or formatting tweaks.
- Outlet: Modify the output that you receive from the model. For instance, cleaning up the response, adjusting tone, or formatting data into a specific style.
Use case example:
Suppose youβre working on a project that needs precise formatting. You can use a Filter to ensure:
- Your input is always transformed into the required format.
- The output from the model is cleaned up before being displayed.
Filters are linked to specific models or can be enabled for all models globally, depending on your needs.
Check out the full guide for more examples and instructions: Filter Functions.
3. Action Function β Add Custom Buttonsβ
An Action Function is used to add custom buttons to the chat interface.
What does it do?
Actions allow you to define interactive shortcuts that trigger specific functionality directly from the chat. These buttons appear underneath individual chat messages, giving you convenient, one-click access to the actions you define.
Use case example:
Letβs say you often need to summarize long messages or generate specific outputs like translations. You can create an Action Function to:
- Add a βSummarizeβ button under every incoming message.
- When clicked, it triggers your custom function to process that message and return the summary.
Buttons provide a clean and user-friendly way to interact with extended functionality you define.
Learn how to set them up in the Action Functions Guide.
π οΈ How to Use Functionsβ
Here's how to put Functions to work in OpenWebUI:
1. Install Functionsβ
You can install Functions via the OpenWebUI interface or by importing them manually. You can find community-created functions on the OpenWebUI Community Site.
β οΈ Be cautious. Only install Functions from trusted sources. Running unknown code poses security risks.
2. Enable Functionsβ
Functions must be explicitly enabled after installation:
- When you enable a Pipe Function, it becomes available as its own model in the interface.
- For Filter and Action Functions, enabling them isnβt enoughβyou also need to assign them to specific models or enable them globally for all models.
3. Assign Filters or Actions to Modelsβ
- Navigate to
Workspace => Models
and assign your Filter or Action to the relevant model there. - Alternatively, enable Functions for all models globally by going to
Workspace => Functions
, selecting the "..." menu, and toggling the Global switch.
Quick Summaryβ
- Pipes appear as standalone models you can interact with.
- Filters modify inputs/outputs for smoother AI interactions.
- Actions add clickable buttons to individual chat messages.
Once youβve followed the setup process, Functions will seamlessly enhance your workflows.
β Why Use Functions?β
Functions are designed for anyone who wants to unlock new possibilities with OpenWebUI:
- Extend: Add new models or integrate with non-AI tools like APIs, databases, or smart devices.
- Optimize: Tweak inputs and outputs to fit your use case perfectly.
- Simplify: Add buttons or shortcuts to make the interface intuitive and efficient.
Whether youβre customizing workflows for specific projects, integrating external data, or just making OpenWebUI easier to use, Functions are the key to taking control of your instance.
π Final Notes:β
- Always install Functions from trusted sources only.
- Make sure you understand the difference between Pipe, Filter, and Action Functions to use them effectively.
- Explore the official guides:
By leveraging Functions, youβll bring entirely new capabilities to your OpenWebUI setup. Start experimenting today! π