engine

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 13 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MatrixEngine

type MatrixEngine struct {
	// contains filtered or unexported fields
}

MatrixEngine handles all matrix operations

func NewMatrixEngine

func NewMatrixEngine(matrix *core.Matrix) *MatrixEngine

NewMatrixEngine creates a new engine for a matrix

func (*MatrixEngine) AddNeuron

func (e *MatrixEngine) AddNeuron(content string, parentID *core.NeuronID, metadata map[string]string) (*core.Neuron, error)

AddNeuron creates a new neuron and positions it organically. metadata is optional key-value pairs (e.g. thread_id, role, source).

func (*MatrixEngine) DeleteNeuron

func (e *MatrixEngine) DeleteNeuron(id core.NeuronID) error

DeleteNeuron removes a neuron and its synapses

func (*MatrixEngine) GetNeuron

func (e *MatrixEngine) GetNeuron(id core.NeuronID) (*core.Neuron, error)

GetNeuron retrieves a neuron by ID and fires it

func (*MatrixEngine) GetStats

func (e *MatrixEngine) GetStats() map[string]any

GetStats returns matrix statistics

func (*MatrixEngine) ListNeurons

func (e *MatrixEngine) ListNeurons(offset, limit int, depthFilter *int) []*core.Neuron

ListNeurons returns all neurons sorted by energy

func (*MatrixEngine) Search

func (e *MatrixEngine) Search(query string, depth int, limit int, metadata map[string]string, strict bool) []*core.Neuron

Search finds neurons matching a pattern with activation spread. metadata is an optional filter/boost map (e.g. {"thread_id": "conv-xyz"}). strict=false (default): metadata keys boost matching neurons; all neurons remain eligible. strict=true: only neurons whose metadata contains ALL specified key-value pairs are returned.

func (*MatrixEngine) SetAlpha

func (e *MatrixEngine) SetAlpha(alpha float64)

SetAlpha sets the vector score weight for hybrid search.

func (*MatrixEngine) SetQueryRepeat

func (e *MatrixEngine) SetQueryRepeat(n int)

SetQueryRepeat sets the query repetition count for embedding.

func (*MatrixEngine) SetSentimentAnalyzer

func (e *MatrixEngine) SetSentimentAnalyzer(a *sentiment.Analyzer)

SetSentimentAnalyzer attaches a sentiment analyzer for auto-labeling on write.

func (*MatrixEngine) SetVectorizer

func (e *MatrixEngine) SetVectorizer(v *vector.Vectorizer)

SetVectorizer attaches a vectorizer to the engine for auto-embedding.

func (*MatrixEngine) UpdateNeuron

func (e *MatrixEngine) UpdateNeuron(id core.NeuronID, newContent string) error

UpdateNeuron modifies a neuron's content

type SearchResult

type SearchResult struct {
	Neuron *core.Neuron
	Score  float64
}

SearchResult holds a neuron with its relevance score

type Searcher

type Searcher struct {
	// contains filtered or unexported fields
}

Searcher provides advanced search capabilities

func NewSearcher

func NewSearcher(matrix *core.Matrix) *Searcher

NewSearcher creates a new searcher

func (*Searcher) Search

func (s *Searcher) Search(query string, depth int, limit int) []*core.Neuron

Search performs an intelligent search with multiple scoring factors

func (*Searcher) SetMetadata

func (s *Searcher) SetMetadata(metadata map[string]string, strict bool)

SetMetadata configures optional metadata filtering/boosting. strict=false: matching neurons get a score boost (1.3x per matching key). strict=true: only neurons that match ALL key-value pairs are returned.

func (*Searcher) SetSentimentAnalyzer

func (s *Searcher) SetSentimentAnalyzer(a *sentiment.Analyzer)

SetSentimentAnalyzer attaches a sentiment analyzer to the searcher.

func (*Searcher) SetVectorizer

func (s *Searcher) SetVectorizer(v *vector.Vectorizer, alpha float64, queryRepeat int)

SetVectorizer attaches a vectorizer, alpha weight, and query repeat count to the searcher.

Jump to

Keyboard shortcuts

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