open-webui / pipelines

Pipelines: Versatile, UI-Agnostic OpenAI-Compatible Plugin Framework
MIT License
996 stars 316 forks source link

How to clear pipeline data? #264

Open Panicum opened 2 months ago

Panicum commented 2 months ago

I created the RAG pipeline in which I am saving data in the variable "self.campaign_data":

def __init__(self):
        # Optionally, you can set the id and name of the pipeline.
        self.name = "Pipeline XYZ"
        self.campaign_data = {
            "company_name": None,
            "product_name": None,
            "date_from": None,
            "date_to": None
        }
        pass

I would like to have it reset on every new "Pipeline XYZ" chat window, but for now, it is taking data entered in different chats and using it in the new conversations.

jedwards1230 commented 6 days ago

I think the server holds that self.campaign_data in-memory across all your chats while the pipelines server is running. You would need to add code to your pipeline to grab and store an ID for each thread and do the lookup in your pipe.