Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No valves to update" #328

Open
rcontesti opened this issue Nov 15, 2024 · 5 comments
Open

"No valves to update" #328

rcontesti opened this issue Nov 15, 2024 · 5 comments

Comments

@rcontesti
Copy link

rcontesti commented Nov 15, 2024

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
@willdady
Copy link

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

@freund-masasana
Copy link

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

@ghrahul
Copy link

ghrahul commented Dec 4, 2024

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

@Paulhb7
Copy link

Paulhb7 commented Dec 9, 2024

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

@pianistprogrammer
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants