Context Remover

Removes all context from the request to the model, leaving only the last user message (useful for cases where previous messages are not needed).

v0.1
context_remover.py
Python · 29 lines
13    class Valves(BaseModel):14        pass15 16    def __init__(self):17        self.valves = self.Valves()18        pass19 20    def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict:21 22        if body["messages"]:23            body["messages"] = [body["messages"][-1]]24 

Removes all context from the request to the model, leaving only the last user message (useful for cases where previous messages are not needed).

0
0

Removes all context from the request to the model, leaving only the last user message (useful for cases where previous messages are not needed).

0
0