📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Open WebUI Pipe Functions

Professor Patterns13:20

Transcription

Hello everyone, this is Professor Patterns. And in this video, we're going to be covering Open Web UI functions.

Now, there are three main types of functions that are available on Open Web UI, and each of them have a specific function. There is the pipe function, the filter function, and the action function. They're all slightly different from each other, and in this video, we're going to be specifically focusing on the pipe function. I'm also going to have future videos on both filter as well as action, and I'll link those in the description as soon as I'm done with them.

Now, let's start with pipe. First, we'll go over to the Open Web UI website. Here we can see that, uh, if you select new functions and see all, we can get either of these three options: either the action, the pipe, or the filter functions.

Now, what are some of the pipe options that are available? So, there is this one for Anthropic. There is the pipe for DeepSeek R1. There's a pipe function for Artifact, one for Google Gen. And if you wanted to get any of these functions, all you can do is click on that, select get, and then import it to Open Web UI. Then you can select save and confirm. So, we can see that it shows up over here.

Now, right now, on my Open Web UI interface, I can't select any models. And the reason for that is I've disabled AMA. I've stopped all my connections to everything. I just wanted to to show you right now what this would look like. If I go over to my functions tab and I enable a function, say that the Google Gen function, I select enable. Well, what that's going to do is now within my Open Web UI interface, I will be able to see this Google.

Basically, the pipe function creates a new model for us, and just like how we can select any model, we can also select the model that is the pipe function. So, right now, this function says Google API key is not set. So, what we would need to do is go to the admin panel, select functions, and then here on the model that was enabled, I would select valves and then paste in my Google API key.

Another function is the DeepSeek R1. This is also a pipe function. However, for this one, I have set up my API key in the valve. So, if I select enable now, I will be able to go back here and create a new chat with DeepSeek chat model. I could say something like, "Who are you?" and it's going to be able to get me a response from the DeepSeek API that I have enabled.

So, we just learned something really important, and it's the fact that a pipe function appears here like some sort of a drop-down. So, when we go over to the pipe function documentation, we can see here that it says that a pipe function allows us to create custom agents, models, or integrations, which appear in the interface as if they were standalone models. So, it allows us to create complex workflows, and it doesn't even need to use AI, right? So, we can have it for all kinds of different setups.

Now, how does this actually work behind the scenes? Imagine that you're on the Open Web UI interface and you ask a question like, "Who are you?" What's going to happen is that first, it goes to the Open Web UI formatter. Now, this basically formats it into some sort of a JSON-like format, and then it sends that over to the pipe function. The goal of the pipe function is to create some sort of a header, right? So, it takes in from the valves all of the different information, right? So, it takes in, uh, the authentication token that we would have provided, it looks at what model it is, and then any other additional parameter like temperature, max tokens, all of those different things.

Now, the pipe function then sends all of that information over to the DeepSeek to the API. The DeepSeek model then gives a response back to the pipe function. Now, in this case, the function response might be something like, um, over here we can see that the chat completion and the content is something like, "Hey, I'm DeepSeek Chat, your AI assistant created by DeepSeek." It also provides some more information on usage parameters like prompt tokens, completion tokens, etc.

Now, the goal of the pipe function then is to send that over to the Open Web UI formatter. It understands that it needs to actually be providing the content to the formatter, so it provides that information, and then we can use that to display to the end user. "I'm DeepSeek Chat, your AI assistant created by DeepSeek."

So, this is the typical workflow, but we can now also create some more advanced workflows with the pipe functions. What I mean by that is when we sent over the pipe function information to DeepSeek, and DeepSeek gave us this sort of a response, what if I wanted to maybe have this response go through a couple of different models? Maybe I, uh, the question is something a little bit more complex than just "Who are you?" Maybe it's something like, "I wanted to give me some important piece of information or some important advice," and it gives me a response, but maybe I want to have another model or another two or three models verify that information. Well, within my pipe function, I can hardcode some more logic in. And for example, what I could do is once I get a response from the DeepSeek model, maybe I can then provide the response that was provided by DeepSeek to OpenAI and to Claude. And the goal of these two models is to basically tell me whether or not this response is correct. And if it is, then I would display that to my end user and I would say that this is a verified response.

Now, there is a different type of task that we could have as well, and this could be completely non-AI related. Because in all of these different workflows, well, this information is going to the AI model, and the goal is to provide some sort of a generated text response. But we could use pipe functions even for non-AI use cases. So, in this example, the question that I'm asking is, "Is my front door open now?" Now, I'm sending that to my Open Web UI formatter, and then the pipe function, it, it actually uses something known as Home Assistant, which is like the smart home assistant device that a lot of people have in their homes. So, what it does is that it takes in the query from the user, it sends that API, or it, uh, sends that information to the Home Assistant API, and Home Assistant looks at all of the different, uh, things. So, if the door is open, or if the lamp's on, all of that, um, information, and then provides a response to the pipe function that the front door is actually not open, it's closed. And then based on that, we would provide a response, um, to the user directly within the chat and say something like, "No, the front door is not open."

So, really, the idea here is that the pipe function allows us to interact with any sort of API. In this example, we are interacting with the Home Assistant API, but I could create whatever I wanted. So, if I have an API for music generation, or video content generation, or whatever it is, I can use pipe functions for that now.

And another example that I have here is for music generation, where within the Open Web UI interface, I would say something like, "Create a jazz song." The pipe function is going to look at a, whatever music generation API that I can find, and then it's going to be able to create some sort of a song for me, which I can then download or play within the Open Web UI interface.

Now, I have some sort of a demo that I've set up here, which I'd love to show you. It's not perfect by any means, but I think it's good enough to get started. So, the tool that I used is this tool called Beatoven. And I'm not sponsored by them or anything. I just found one that's like a free, uh, one that's available that I don't have to put any credit card details or anything like that. I just, uh, this is the only one that I could find which was available. Um, all I did was I had to create an account and then use it to generate an API token. And as soon as I did that, the next step was to create a pipe function.

Now, as you know, I'm not really a coder, I'm not a developer. So, basically, all I did was I went to Claude and I said that, "Hey, this is my Beatoven API," and I gave it the API key, which right now I'm just about to change. I also gave it some documentation, which I found here on its GitHub page. So, I basically copied all of this and I pasted it over here. So, Beatoven, whatever, all the information that it needs, so the description, blah, blah, blah. And then I also provided some examples of existing pipe functions. So, this is the DeepSeek R1 pipe function, this is the Gemini manifold pipe function, this is the Think Respond Chain pipe function. And I got all of these basically from, uh, the Open Web UI website, right? So, all I did was within Open Web UI, I looked at all these functions and I copy-pasted a couple of them, or I copy-pasted a couple of them. And then it gave me a response right here. So, this was the output that it provided to me.

So, all I did was I copied all of this information and I went over here to my Open Web UI interface and then selected avin panel functions and I selected this plus icon where I pasted the entire code that the model provided to me. Now, once I was done with that, because, um, uh, the only thing that I also needed to add was a function name, function ID, and a description. Um, everything else worked fine. The only other thing was within the valves, I had to add in the, this was all default. I just had to add in the API key over here. Everything else was fine. And as soon as I did that, I could go over here, create a chat with the Beatoven AI, and here I can ask it to generate a song or create a jazz song, Lo-fi beats, or something. I think the free version, um, does like a 30-second generation, um, if I'm not wrong. But you can see that it is sending this information over to the Beatoven API. It's not really using the resources of my computer, but it's sending all of this information to this API. And it does here for a second, and there we go. It says, "Music generation complete." It gave me a bunch of different download links.

So, let's say that I wanted to download the full track. Um, I know it's not going to be great, but let's hear it. [Music] Anyways, okay, well, still needs some work, but not bad overall, um, especially for a free software. And you can even download individual things. So, for example, if you like the baseline, um, you can download specifically that baseline and listen to that, which is not the thing I should have been doing, but yeah, maybe the percussions or the melody might have been a better thing to download, um, just to test it out. But anyways, the idea here is that we basically send this information over to this API, the API gave us a, uh, response, and now we can actually generate all of these, all of this music over here, um, on Open Web UI.

So, think about any API that you would like to use. Um, you're not restricted in terms of any your coding ability, right? So, for example, if you wanted to use maybe an API from, um, your mailbox or something, well, pipe functions work for that. Now, sure, we now, we can go more into like MCPS with the new Open Web UI versions, um, which I'm going to create a whole separate series on that, um, a little bit later. But hopefully, this gives you a little bit of a clear idea about the pipe functions.

The next couple of videos, um, I'm also going to be covering the filter and the action functions. But just to give you a high-level overview, the filter function, what is the goal of that? So, this actually creates a tool which we can then use to tweak the data before it gets sent to the AI or after it comes back from the AI. So, we can use it for things like, uh, maybe formatting, we want to adjust the tone, or, um, have the data be in a specific style or something like that. Um, that's where we would use filter functions.

And action functions allow us to create a custom button within the interface. So, imagine that within the Open Web UI interface, you have another button or something, and the button could be something like "Summarize." So, what the action function would do is that as soon as you get a huge response or a long message back from the AI model, you can click on that button, and it will simply summarize everything for you. So, those are those, these two other functions here, in at a high level. Again, I'm going to be making separate videos on these two things, um, once I'm done, I'll link those in the description.

But that's pretty much it for this video here today. Thank you all for tuning in. If you want me to cover similar videos like these in the future, then please let me know, and I'd love to do so. Thanks for tuning in. I'll see you in the next one. Goodbye.