Documentation
¶
Overview ¶
Package memembed is memory's search by meaning: paraphrase-multilingual-MiniLM-L12-v2 (sentence-transformers, Apache 2.0; Xenova's int8 ONNX of it), run in magpie's own process by internal/pii/guard, gives each memory a place in a space where texts that say the same are near, in any of 50 languages and across them, and memory.Search fuses how near each is to what was searched with its word ranking (memory.Semantic).
It is off until switched on, since the model is a 135 MB download. Switched on, the files are fetched from Hugging Face at the revision their sha256 were pinned at; switched off, they are deleted. Memories are read in the background (Keep) and their vectors kept in the model's folder, keyed by the text read, so an edited memory is read again and a new revision starts afresh. The model is loaded when first needed and let go after idleAfter with none.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Root = func() string { return filepath.Join(appdir.Cache(), "paraphrase-multilingual-MiniLM-L12-v2") }
Root is where the model is kept, in magpie's cache: a folder per revision. A variable for tests.
var StatePath = func() string { return appdir.Join(appdir.Config(), "memory-semantic.json") }
StatePath is the switch's file; a variable for tests.
Functions ¶
func Index ¶
Index reads every memory a search can return that has no vector for its text yet, keeps the vectors (dropping those of texts gone) and says how many it read. One goes at a time, in this magpie and across them.
func Keep ¶
Keep reads memories not read yet while ctx lasts: every tick and when poked, while switched on with the model on disk.
func On ¶
func On() bool
On says search by meaning is switched on. A switch file that can't be read is off: the model isn't loaded on a guess.
Types ¶
type Status ¶
type Status struct {
On bool `json:"on"`
Installed bool `json:"installed"`
Size int64 `json:"size"`
Downloading bool `json:"downloading"`
Done int64 `json:"done"`
Error string `json:"error,omitempty"`
// Read of Of are the memories read (with a vector), of all there are
Read int `json:"read"`
Of int `json:"of"`
// Reading is a background read going
Reading bool `json:"reading"`
// Failed is why the last read failed, "" when it worked
Failed string `json:"failed,omitempty"`
}
Status is what the Memory tab shows of it.