Recipe Scraper

This filter scrapes a recipe from a URL and adds it to the chat history.

v1.0.0
recipe_scraper.py
Python · 90 lines
26    class Valves(BaseModel):27        pass28 29    def __init__(self):30        # Initialize valves (optional configuration for the Filter)31        self.valves = self.Valves()32 33    def inlet(self, body: dict) -> dict:34        # This is where you manipulate user inputs.35        last_message = body["messages"][-1]["content"]36 37        # if the last message is a standalone URL, then replace it with the recipe

This filter scrapes a recipe from a URL and adds it to the chat history.

0
0