From a285a390c12e27e614d1ba9ffb92d1a0e49e7dfa Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 29 Jun 2026 06:01:05 -0500 Subject: [PATCH] refac --- backend/open_webui/tools/builtin.py | 7 ++++--- backend/open_webui/utils/memory.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/tools/builtin.py b/backend/open_webui/tools/builtin.py index 04ea94026d..81fb7fc811 100644 --- a/backend/open_webui/tools/builtin.py +++ b/backend/open_webui/tools/builtin.py @@ -606,7 +606,7 @@ async def search_memories( :param query: Optional query to search memory content and path :param count: Number of memories to return (default 5) :param type: "user", "context", or "all" - :param path: Optional logical memory path prefix + :param path: Optional memory path prefix :param memory_id: Optional exact memory ID to read :return: JSON with matching memories and their dates """ @@ -661,7 +661,7 @@ async def add_memory( :param content: The memory content to store :param type: Use "user" for facts/preferences about the user, or "context" for other durable context - :param path: Optional logical memory path + :param path: Optional memory path :return: Confirmation that the memory was stored """ if __request__ is None: @@ -695,6 +695,7 @@ async def update_memory( Use type "user" for facts, preferences, or instructions about the user. Use type "context" for other durable context that may help future chats. + Use path when there is a clear path for the memory. Leave path empty when unsure. Operation shapes: - {"action": "add", "content": "...", "type": "user"|"context", "path": "..."} @@ -735,7 +736,7 @@ async def replace_memory_content( :param memory_id: The ID of the memory to update :param content: The new content for the memory :param type: Optional "user" or "context" type for the updated memory - :param path: Optional logical memory path + :param path: Optional memory path :return: Confirmation that the memory was updated """ if __request__ is None: diff --git a/backend/open_webui/utils/memory.py b/backend/open_webui/utils/memory.py index bfefea2f3a..a7a249701f 100644 --- a/backend/open_webui/utils/memory.py +++ b/backend/open_webui/utils/memory.py @@ -313,6 +313,8 @@ Memory types: Rules: - Save only information likely to matter in future chats. - Do not save secrets, credentials, transient task steps, or unsupported guesses. +- Use path when there is a clear path for the memory. +- Leave path empty when there is no clear place for the memory. - Prefer replace/move/remove over duplicate add when an existing memory should change. - Do not invent type, status, trait, score, importance, or stability schemas. - Return only JSON in this shape: