Whitepaper
Docs
Sign In
Function
Function
filter
v0.1
Context Remover
Function ID
context_remover
Creator
@deseven
Downloads
45+
Removes all context from the request to the model, leaving only the last user message (useful for cases where previous messages are not needed).
Get
README
No README available
Function Code
Show
""" title: Context Remover author: deseven author_url: https://d7.wtf/ version: 0.1 """ from pydantic import BaseModel, Field from typing import Optional class Filter: class Valves(BaseModel): pass def __init__(self): self.valves = self.Valves() pass def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict: if body["messages"]: body["messages"] = [body["messages"][-1]] return body def outlet(self, body: dict, __user__: Optional[dict] = None) -> dict: return body