memory

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxMemories         int     // Maximum number of memories to retain
	SimilarityThreshold float64 // Minimum similarity score for retrieval
}

Config holds configuration for semantic memory

type Memory

type Memory struct {
	ID        string
	Content   string
	Embedding []float64
	Metadata  map[string]interface{}
	Timestamp time.Time
}

Memory represents a stored piece of information

type SemanticMemory

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

SemanticMemory provides semantic storage and retrieval of information

func NewSemanticMemory

func NewSemanticMemory(cfg Config) *SemanticMemory

NewSemanticMemory creates a new semantic memory instance

func (*SemanticMemory) Clear

func (sm *SemanticMemory) Clear()

Clear removes all memories

func (*SemanticMemory) Count

func (sm *SemanticMemory) Count() int

Count returns the number of stored memories

func (*SemanticMemory) Retrieve

func (sm *SemanticMemory) Retrieve(embedding []float64, limit int) ([]Memory, error)

Retrieve finds memories similar to the given embedding

func (*SemanticMemory) Store

func (sm *SemanticMemory) Store(content string, embedding []float64, metadata map[string]interface{}) error

Store adds a memory to the semantic memory

Jump to

Keyboard shortcuts

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