Memvid::Memory
A single-file AI memory store.
Memory provides a high-level interface for storing and searching content in a memvid .mv2 file.
Constructors
Creates a new memory file at the specified path.
Raises Error if the file cannot be created.
Class methods
Creates a new memory file and yields it to the block. The memory is automatically closed when the block returns.
Instance methods
Ask a question using RAG (Retrieval-Augmented Generation).
This is a convenience method that creates an AskRequest with defaults. Returns retrieved context; answer synthesis requires an external LLM.
Closes the memory handle.
After calling this method, the Memory instance is no longer usable.
This is called automatically when using the block forms of create or open.
Commits pending changes to disk.
This should be called after adding content to ensure it is persisted.
Soft-deletes a frame.
The frame data is not immediately removed; a tombstone entry is created. Returns the WAL sequence number.
Raises FrameNotFoundError if the frame does not exist.
Gets frame metadata by ID.
Raises FrameNotFoundError if the frame does not exist.
Gets frame metadata by URI.
Raises FrameNotFoundError if no frame with the given URI exists.
Gets the text content of a frame by ID.
Raises FrameNotFoundError if the frame does not exist.
Adds string content to the memory.
Returns the frame ID of the newly created frame.
Adds binary content to the memory.
Returns the frame ID of the newly created frame.
Searches the memory with the given query string.
This is a convenience method that creates a SearchRequest with defaults.
Queries the timeline (chronological frame list).
Returns frames in chronological order (or reverse if specified).