memembed

package
v0.1.4347 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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

func Index(ctx context.Context) (int, error)

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 Installed

func Installed() bool

Installed says every file is on disk at its size.

func Keep

func Keep(ctx context.Context, tick time.Duration)

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.

func Poke

func Poke()

Poke asks Keep to read what is new now, not on its next tick.

func Set

func Set(on bool) error

Set switches it on, fetching the model when it isn't on disk, or off, stopping a download and deleting the model and what it read.

func Size

func Size() int64

Size is the bytes the model downloads.

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.

func Now

func Now() Status

Now is its status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL