memories
Models for Memory-related operations.
Memories are durable per-user notes the backend recalls to give a model
context across chats. Since Open WebUI 0.10.0 the memory system distinguishes
two types of memory (user vs context), optionally scopes each under a
hierarchical path, and tracks provenance in a backend-managed meta dict.
Classes
MemoryModel
Bases: BaseModel
Represents a memory item stored for a user.
Memories are split by type into durable personal facts (user) versus
reusable conversation context, and optionally scoped under a
slash-delimited path. The meta dict is populated by the backend to
record provenance (creator, source chat/message/model) and is merged
additively on updates; it is never set by client request forms.
- Code Reference routers memories Classes MemoriesClient Functions
Attributes
type
Memory category. user = long-lived personal facts/preferences/instructions; context = other durable context that may help future chats. Defaults to context.
path
Optional slash-delimited scope path (e.g. projects/alpha) used to group and hierarchically navigate memories. None means unscoped/global; normalized server-side (leading/trailing slashes stripped, consecutive slashes collapsed, empty segments / . / .. / control chars rejected).
meta
Backend-managed provenance metadata; never set by client forms and merged additively on update.
Dict Fields
created_by(str, optional): Origin of the memory. One ofmanual,tool, orbackground_review.chat_id(str, optional): ID of the chat that produced the memory (set fortool/background_reviewsources).message_id(str, optional): ID of the message that produced the memory (set fortool/background_reviewsources).model(str, optional): Model ID that produced the memory (set fortool/background_reviewsources).
AddMemoryForm
Bases: BaseModel
Form for adding a new memory.
The backend model defaults type to context, but the Open WebUI
frontend (addNewMemory) sends type='user' by default, so manually
added memories are usually user typed in practice.
- Code Reference routers memories Classes MemoriesClient Functions add_memory
Attributes
type
Memory category to create. user = long-lived personal fact/preference/instruction; context = durable conversation context. Defaults to context.
MemoryUpdateModel
Bases: BaseModel
Form for updating an existing memory.
All fields are optional. Because the client serializes with
exclude_none=True, path/type only reach the server when given a
non-None value. Omitting all of content, type, and path is
rejected by the server with HTTP 400.
- Code Reference routers memories Classes MemoriesClient Functions update_memory_by_id
Attributes
content
New text content for the memory. If provided, replaces the existing content (must be non-empty after trimming).
type
New memory category. None leaves the type unchanged.
QueryMemoryForm
Bases: BaseModel
Form for querying memories using vector search.
- Code Reference routers memories Classes MemoriesClient Functions query_memory
ListMemoryPathsForm
Bases: BaseModel
Form for POST /memories/paths — list memory paths grouped into a tree.
Groups memories by (path, type) and returns one entry per group with a
member count, most-recent updated_at, and immediate child paths.
- Code Reference routers memories Classes MemoriesClient Functions list_memory_paths
Attributes
query
Optional case-insensitive substring filtered against each memory's content and path. None/empty matches all.
type
Restrict grouping to a memory category, or all (default) to include both.
ReadMemoryPathForm
Bases: BaseModel
Form for POST /memories/path — read the memories at a specific path.
Returns the memories located exactly at path plus, optionally, those in
descendant paths, along with the ancestor (parents) and immediate child
paths for navigation.
- Code Reference routers memories Classes MemoriesClient Functions read_memory_path
Attributes
path
Required slash-delimited scope path to read (e.g. projects/alpha). Normalized server-side; an empty/invalid path yields HTTP 400.
type
Restrict results to a memory category, or all (default) to include both.
include_children
When True (default), also include memories in descendant paths of path.