Open rcontesti opened 1 week ago
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
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
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: