pipelines icon indicating copy to clipboard operation
pipelines copied to clipboard

"No valves to update"

Open rcontesti opened this issue 1 year ago • 8 comments

I'm trying to upload any of examples in the repo to the pipelines settings tab. But when I try to save I get the error: No valves to update.

Can somebody point to what might be going on? Thank you.

Allow me show my code for context:

from typing import List, Union, Generator, Iterator
import os 
from pydantic import BaseModel
import requests


class Pipeline:
    class Valves(BaseModel):
        AGENT_HOST: str
        AGENT_PORT: int
        AGENT_ENDPOINT:str
        pipelines: List[str] = []
        priority: int = 0

    # Update valves/ environment variables based on your selected database 
    def __init__(self):
        self.name = "Xerket Chat"

        # Initialize
        self.valves = self.Valves(
            **{
                # "pipelines": ["*"],                                                           # Connect to all pipelines
                "AGENT_HOST": os.getenv("AGENT_HOST", "0.0.0.0"),
                "AGENT_PORT": os.getenv("AGENT_PORT", 5006),
                "AGENT_ENDPOINT": os.getenv("AGENT_ENDPOINT", "/message"),     
            }
        )

    async def on_startup(self):
        # # This function is called when the server is started.
        pass

    async def on_shutdown(self):
        pass

    def pipe(
        self, user_message: str, model_id: str, messages: List[dict], body: dict
    ) -> Union[str, Generator, Iterator]:
        
        AGENT_ENDPOINT = self.valves.AGENT_ENDPOINT
        AGENT_PORT = self.valves.AGENT_PORT
        AGENT_HOST = self.valves.AGENT_HOST

        url = f"http://{AGENT_HOST}:{AGENT_PORT}{AGENT_ENDPOINT}"
        data = {"content": user_message}

        response = requests.post(url, json=data)

        agent_response = ""
        
        if response.status_code == 200:
            agent_response = response.json['response']
        else:
            agent_response =  "Agent not available"
            
        return agent_response

rcontesti avatar Nov 15 '24 19:11 rcontesti

My guess is you need to have this function defined?

async def on_valves_updated(self):
        # This function is called when the valves are updated.
        pass

willdady avatar Nov 16 '24 01:11 willdady

I have (kinda) the same problem. The tool is still in the workbench but there are no valves for either the tool itself or any user. I temporarily fixed this by editing the tool and saving as it is. Hoping for a fix soon

freund-masasana avatar Nov 26 '24 15:11 freund-masasana

I am also facing the same problem. I tried to directly add it from github url.

https://github.com/open-webui/pipelines/blob/main/examples/pipelines/integrations/python_code_pipeline.py

image

ghrahul avatar Dec 04 '24 10:12 ghrahul

Tried during one hour and the solution is very simple !! You need to click on the button to validate your script :) Capture d’écran 2024-12-09 à 15 42 40

Paulhb7 avatar Dec 09 '24 14:12 Paulhb7

Yes, the upload button helps to validate the pipeline file, but the save button still throws the same error

pianistprogrammer avatar Dec 10 '24 12:12 pianistprogrammer

Yes, the upload button helps to validate the pipeline file, but the save button still throws the same error

Not sure what the save button does but @Paulhb7 answer works

MasiGit avatar Dec 31 '24 14:12 MasiGit

Most of the examples here don't show any explicitly defined Valves: https://github.com/open-webui/pipelines/tree/main/examples

And according to this, to me it seems like Valves are an optional configuration: https://docs.openwebui.com/pipelines/valves

So, could this be a validation bug when saving? What if I don't want to add any Valves?

altaiiiir avatar Feb 24 '25 01:02 altaiiiir

I get it now.

The "upload button" actually uploads the pipeline file. This SAVES the pipeline allowing it to be used. The "save" button saves the Valves. If no Valves are defined, then you'll get "No Valves to Update" error.

This is very unintuitive but basically, you don't need to actually press "Save" to use the pipeline. Simply pressing the "upload" button is sufficient. So as long as you press the "upload" button, and you see the pipeline successfully added in the UI, you're good to use it without defining any Valves.

Example screenshot of "seeing the pipeline successfully added in the UI":

Image

If pressing the "upload button" doesn't show the pipeline added in the UI then you have some other error in your pipeline.

After successfully adding the pipeline, you can select the pipeline from the model dropdown and use it.

altaiiiir avatar Feb 24 '25 01:02 altaiiiir