Pipe Function Executes Before Inlet in Latest OWUI Version #191

Open
opened 2026-02-15 19:16:41 -05:00 by yindo · 19 comments
Owner

Originally created by @NTTLuke on GitHub (Feb 6, 2025).

Hi all,
with the latest version of OWUI, it seems that the pipe function is called before the inlet, and I can no longer handle this situation.

async def inlet(self, body: dict, user: Optional[dict] = None) -> dict:
       chat_id = body.get("chat_id")
       # openwebui > 5.1 compatibility
       if chat_id is None:
           chat_id = body.get("metadata") ["chat_id"]             
       body["chat_id"] = chat_id
       return body  
 def pipe(
        self, user_message: str, model_id: str, messages: List[dict], body: dict
    ) -> Union[str, Generator, Iterator]:
        
    chat_id = body.get('chat_id', 'no chat id')
    ... omitted code ...

any suggestions ?

Originally created by @NTTLuke on GitHub (Feb 6, 2025). Hi all, with the latest version of OWUI, it seems that the pipe function is called before the inlet, and I can no longer handle this situation. ``` async def inlet(self, body: dict, user: Optional[dict] = None) -> dict: chat_id = body.get("chat_id") # openwebui > 5.1 compatibility if chat_id is None: chat_id = body.get("metadata") ["chat_id"] body["chat_id"] = chat_id return body ``` ``` def pipe( self, user_message: str, model_id: str, messages: List[dict], body: dict ) -> Union[str, Generator, Iterator]: chat_id = body.get('chat_id', 'no chat id') ... omitted code ... ``` any suggestions ?
Author
Owner

@pfedasullivan commented on GitHub (Feb 14, 2025):

I'm seeing the same issue and it is causing all sorts of problems.

@pfedasullivan commented on GitHub (Feb 14, 2025): I'm seeing the same issue and it is causing all sorts of problems.
Author
Owner

@NTTLuke commented on GitHub (Feb 14, 2025):

Yes!
Especially if you have based your agents on that for retrieving information about the chat_id, as we do.
I have also opened an issue here:
https://github.com/open-webui/open-webui/issues/9515, but it has been closed.
I need to find time to document the scenario because the response doesn’t seem related to the behavior observed.

I understand that the pipe function is not asynchronous, but the issue originates from the invocation of the FastAPI endpoint of the pipeline service, which is asynchronous.
If you run version 0.5.7, the flow works correctly: the inlet endpoint (FastAPI route) is invoked, followed by the completion endpoint (FastAPI route).
However, starting from version 0.5.8, the inlet endpoint is not invoked properly.

@NTTLuke commented on GitHub (Feb 14, 2025): Yes! Especially if you have based your agents on that for retrieving information about the chat_id, as we do. I have also opened an issue here: https://github.com/open-webui/open-webui/issues/9515, but it has been closed. I need to find time to document the scenario because the response doesn’t seem related to the behavior observed. I understand that the pipe function is not asynchronous, but the issue originates from the invocation of the FastAPI endpoint of the pipeline service, which is asynchronous. If you run version 0.5.7, the flow works correctly: the inlet endpoint (FastAPI route) is invoked, followed by the completion endpoint (FastAPI route). However, starting from version 0.5.8, the inlet endpoint is not invoked properly.
Author
Owner

@NTTLuke commented on GitHub (Feb 14, 2025):

I try to mention @tjbck to have more info about that maybe he can give us feedback how to manage the scenario.
We cannot migrate beyond version 0.5.7 due to this issue, which I believe is caused by some inversion of the invocation on the OpenWebUI side but correct me if I'm wrong.
Thanks a lot!

@NTTLuke commented on GitHub (Feb 14, 2025): I try to mention @tjbck to have more info about that maybe he can give us feedback how to manage the scenario. We cannot migrate beyond version 0.5.7 due to this issue, which I believe is caused by some inversion of the invocation on the OpenWebUI side but correct me if I'm wrong. Thanks a lot!
Author
Owner

@pfedasullivan commented on GitHub (Feb 14, 2025):

I'm seeing the same thing. For me, I don't see inlet running at all, but that has the same effect as inlet running after pipe. It really shouldn't do that according to the documentation, and didn't do that throughout all the previous versions. We are stuck on prior versions as well.

@pfedasullivan commented on GitHub (Feb 14, 2025): I'm seeing the same thing. For me, I don't see inlet running at all, but that has the same effect as inlet running after pipe. It really shouldn't do that according to the documentation, and didn't do that throughout all the previous versions. We are stuck on prior versions as well.
Author
Owner

@tjbck commented on GitHub (Feb 14, 2025):

Could we get backend logs for this issue? Issue templates exist for a reason 😅

@tjbck commented on GitHub (Feb 14, 2025): Could we get backend logs for this issue? Issue templates exist for a reason 😅
Author
Owner

@tjbck commented on GitHub (Feb 16, 2025):

@NTTLuke Latest Open WebUI dev might've addressed the issue. Testing wanted here!

@tjbck commented on GitHub (Feb 16, 2025): @NTTLuke Latest Open WebUI dev might've addressed the issue. Testing wanted here!
Author
Owner

@NTTLuke commented on GitHub (Feb 16, 2025):

Love you, man!
I see now since I’m in a different tz than yours
I’ll do it when I’m back home … even before I take shower 😜
I’ll keep u posted !

@NTTLuke commented on GitHub (Feb 16, 2025): Love you, man! I see now since I’m in a different tz than yours I’ll do it when I’m back home … even before I take shower 😜 I’ll keep u posted !
Author
Owner

@NTTLuke commented on GitHub (Feb 16, 2025):

Hi @tjbck,
I have tested the dev.

Here are my thoughts:

Test 1: Using my actual pipeline (aka PipelineA) doesn't work.
Test 2: I created a new pipeline from scratch (PipelineB) with just a print, and it works fine.
Test 3: I copied the exact same code (identical) from my PipelineA into PipelineB, and it works.

However, PipelineA continues to not work.
Strange behavior but in conclusion, if I need to copy the old code into new pipelines, it's ok.

Let's just say that starting from scratch with a new pipeline the dev branch resolves the issue.

Thanks a lot !!!

@pfedasullivan any feedback on your side ?

@NTTLuke commented on GitHub (Feb 16, 2025): Hi @tjbck, I have tested the dev. Here are my thoughts: **Test 1:** Using my actual pipeline (aka PipelineA) doesn't work. **Test 2:** I created a new pipeline from scratch (PipelineB) with just a print, and it works fine. **Test 3:** I copied the exact same code (identical) from my PipelineA into PipelineB, and it works. However, PipelineA continues to not work. Strange behavior but in conclusion, if I need to copy the old code into new pipelines, it's ok. Let's just say that starting from scratch with a new pipeline the dev branch resolves the issue. Thanks a lot !!! @pfedasullivan any feedback on your side ?
Author
Owner

@pfedasullivan commented on GitHub (Feb 17, 2025):

I've confirmed that I had to delete the original pipeline, and create a new pipeline with the same code for it to start working.

@pfedasullivan commented on GitHub (Feb 17, 2025): I've confirmed that I had to delete the original pipeline, and create a new pipeline with the same code for it to start working.
Author
Owner

@arneschreuder commented on GitHub (Feb 17, 2025):

Unfortunately recreating the pipeline did not work for us. (Using v0.5.12).
More detail:

@arneschreuder commented on GitHub (Feb 17, 2025): Unfortunately recreating the pipeline did not work for us. (Using v0.5.12). More detail: - We are trying to integrate langfuse using these instructions: https://langfuse.com/docs/integrations/openwebui - We are currently aware of issues/PRs: https://github.com/open-webui/pipelines/pull/403
Author
Owner

@NTTLuke commented on GitHub (Feb 17, 2025):

Let’s try changing the pipeline name , the id and the file name (your_pipeline.py ) in order to have different values compared to the actual one you are using .
With this trick my old pipelines work fine with the 0.5.12 and the dev branch .

@NTTLuke commented on GitHub (Feb 17, 2025): Let’s try changing the pipeline name , the id and the file name (your_pipeline.py ) in order to have different values compared to the actual one you are using . With this trick my old pipelines work fine with the 0.5.12 and the dev branch .
Author
Owner

@arneschreuder commented on GitHub (Feb 17, 2025):

I will give that a go! @NTTLuke thanks! Will revert back

@arneschreuder commented on GitHub (Feb 17, 2025): I will give that a go! @NTTLuke thanks! Will revert back
Author
Owner

@arneschreuder commented on GitHub (Feb 17, 2025):

@NTTLuke unfortunately, still doesn't work. I tried readding the pipeline using different names and config, still same problem. Inlet is not being called. I tried using the original langfuse pipeline as mentioned above and the updated/fixed langfuse pipeline in the PR mentioned above. Neither worked. Interestingly, I do get the autocompletion task traces in langfuse, which does hit the inlet. I will investigate more and get back on this as the actual chat does not get logged, as a result of the inlet not firing.

@arneschreuder commented on GitHub (Feb 17, 2025): @NTTLuke unfortunately, still doesn't work. I tried readding the pipeline using different names and config, still same problem. Inlet is not being called. I tried using the original langfuse pipeline as mentioned above and the updated/fixed langfuse pipeline in the PR mentioned above. Neither worked. Interestingly, I do get the autocompletion task traces in langfuse, which does hit the inlet. I will investigate more and get back on this as the actual chat does not get logged, as a result of the inlet not firing.
Author
Owner

@NTTLuke commented on GitHub (Feb 17, 2025):

OMG ! Very strange
Last try : use the “dev” branch

@NTTLuke commented on GitHub (Feb 17, 2025): OMG ! Very strange Last try : use the “dev” branch
Author
Owner

@alejandrods commented on GitHub (Feb 18, 2025):

Same thing happens to me. I tried to create a new filter from scratch but I couldn't make it work.

@alejandrods commented on GitHub (Feb 18, 2025): Same thing happens to me. I tried to create a new filter from scratch but I couldn't make it work.
Author
Owner

@bhdresh commented on GitHub (Feb 18, 2025):

Initial testing shows that issue is not fixed in dev branch.

Test cases tried so far on dev branch,

  1. Delete old filter and create new filter from scratch with same code : Not working
  2. Remove pipeline configuration and reconfigure pipeline and create filter again : Not working
  3. Removed pipeline docker, started new pipeline docker, reconfigure on on opern webui with new filter with same code : Not working
  4. Run OWUI:v0.5.7 with same same pipeline and filter : Working fine as expected

NOTE: I have kept docker persistant volume using "-v open-webui:/app/backend/data" for all of the above test cases.

@bhdresh commented on GitHub (Feb 18, 2025): Initial testing shows that issue is not fixed in dev branch. Test cases tried so far on dev branch, 1) Delete old filter and create new filter from scratch with same code : Not working 2) Remove pipeline configuration and reconfigure pipeline and create filter again : Not working 3) Removed pipeline docker, started new pipeline docker, reconfigure on on opern webui with new filter with same code : Not working 4) Run OWUI:v0.5.7 with same same pipeline and filter : Working fine as expected NOTE: I have kept docker persistant volume using "-v open-webui:/app/backend/data" for all of the above test cases.
Author
Owner

@ivanfioravanti commented on GitHub (Feb 24, 2025):

I confirm same issue, everything was working properly till 0.5.7. @tjbck any news?

@ivanfioravanti commented on GitHub (Feb 24, 2025): I confirm same issue, everything was working properly till 0.5.7. @tjbck any news?
Author
Owner

@thiswillbeyourgithub commented on GitHub (Feb 24, 2025):

Hi, i opened that issue yesterday: https://github.com/open-webui/open-webui/issues/10632

It's an issue related to filter functions (not pipelines) where I noticed that modifying the body in inlet and outputting it resulted in no changes (the body seemed reset somehow to its original state).

I reproduced it, found other non working turn limiting filters and still had the issue. It somehow was not here anymore after restarting the docker compose.

So, i don't know if this is related to the issue here but encourage everyone to restart the app every time before actually testing anything because I suspect there are stateful issues in open-webui.

And btw: i made a debug filter that simply prints what goes through it, it's pretty useful! With priorities you can even sandwich another filter with it. Here's the link: https://github.com/thiswillbeyourgithub/openwebui_custom_pipes_filters/blob/main/filters/debug_filter.py

Hope it helps.

@thiswillbeyourgithub commented on GitHub (Feb 24, 2025): Hi, i opened that issue yesterday: https://github.com/open-webui/open-webui/issues/10632 It's an issue related to filter functions (not pipelines) where I noticed that modifying the body in inlet and outputting it resulted in no changes (the body seemed reset somehow to its original state). I reproduced it, found other non working turn limiting filters and still had the issue. It somehow was not here anymore after restarting the docker compose. So, i don't know if this is related to the issue here but encourage everyone to restart the app every time before actually testing anything because I suspect there are stateful issues in open-webui. And btw: i made a debug filter that simply prints what goes through it, it's pretty useful! With priorities you can even sandwich another filter with it. Here's the link: https://github.com/thiswillbeyourgithub/openwebui_custom_pipes_filters/blob/main/filters/debug_filter.py Hope it helps.
Author
Owner

@savvaki commented on GitHub (Mar 20, 2025):

On the latest OWUI v0.5.20 this is how to reproduce (the inlet and outlet is not working at all for me):

Note this is a Function, which is added in the OWUI interface:

"""
title: Example Pipe
version: 0.1
"""
from pydantic import BaseModel, Field
from typing import Optional

class Pipe:
    class Valves(BaseModel):
        pass

    def __init__(self):
        self.valves = self.Valves()

    def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
        print(f"\n REACHED THE INLET")
        print(f"inlet:{__name__}")
        print(f"inlet:body:{body}")
        print(f"inlet:user:{__user__}")
        return body

    def pipe(self, body: dict):
        print(f"\n REACHED THE PIPE")
        print(f"pipe:body:{body}")
        return "Hello World!"

    def outlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
        print(f"\n REACHED THE OUTLET")
        print(f"outlet:{__name__}")
        print(f"outlet:body:{body}")
        print(f"outlet:user:{__user__}")
        return body

If I type a message to the function, this is the output of the container logs:

Image

The environment used for OWUI:

    environment:
      - DATABASE_URL=postgresql://myusername:mypassword@postgres-db:5432/open-webui-db
      - ENABLE_WEBSOCKET_SUPPORT=true
      - WEBSOCKET_MANAGER=redis
      - WEBSOCKET_REDIS_URL=redis://redis:6379/1 
      - GLOBAL_LOG_LEVEL=DEBUG

@savvaki commented on GitHub (Mar 20, 2025): On the latest OWUI v0.5.20 this is how to reproduce (the inlet and outlet is not working at all for me): Note this is a **Function**, which is added in the OWUI interface: ```python """ title: Example Pipe version: 0.1 """ from pydantic import BaseModel, Field from typing import Optional class Pipe: class Valves(BaseModel): pass def __init__(self): self.valves = self.Valves() def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict: print(f"\n REACHED THE INLET") print(f"inlet:{__name__}") print(f"inlet:body:{body}") print(f"inlet:user:{__user__}") return body def pipe(self, body: dict): print(f"\n REACHED THE PIPE") print(f"pipe:body:{body}") return "Hello World!" def outlet(self, body: dict, __user__: Optional[dict] = None) -> dict: print(f"\n REACHED THE OUTLET") print(f"outlet:{__name__}") print(f"outlet:body:{body}") print(f"outlet:user:{__user__}") return body ``` If I type a message to the function, this is the output of the container logs: <img width="1404" alt="Image" src="https://github.com/user-attachments/assets/b96b00a6-844f-419b-8f4c-59c1366664ca" /> The environment used for OWUI: ```yaml environment: - DATABASE_URL=postgresql://myusername:mypassword@postgres-db:5432/open-webui-db - ENABLE_WEBSOCKET_SUPPORT=true - WEBSOCKET_MANAGER=redis - WEBSOCKET_REDIS_URL=redis://redis:6379/1 - GLOBAL_LOG_LEVEL=DEBUG ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/pipelines#191