memory

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 3 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 {
	URL                string
	AuthToken          string
	ProjectsDir        string
	MultiProjectMode   bool
	EmbeddingDims      int
	MaxOpenConns       int
	MaxIdleConns       int
	ConnMaxIdleSec     int
	ConnMaxLifeSec     int
	EmbeddingsProvider string
}

Config exposes a stable wrapper for database configuration in package mode. Most fields map directly to internal/database.Config.

type Service

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

Service provides a library-first API for memory operations without MCP transport.

func NewService

func NewService(cfg *Config) (*Service, error)

NewService constructs a Service with the provided config.

func (*Service) AddObservations

func (s *Service) AddObservations(ctx context.Context, project, entityName string, observations []string) error

AddObservations appends observations to an entity.

func (*Service) Close

func (s *Service) Close() error

Close releases resources.

func (*Service) CreateEntities

func (s *Service) CreateEntities(ctx context.Context, project string, ents []apptype.Entity) error

CreateEntities inserts entities.

func (*Service) CreateRelations

func (s *Service) CreateRelations(ctx context.Context, project string, rels []apptype.Relation) error

CreateRelations inserts relations.

func (*Service) DeleteEntities

func (s *Service) DeleteEntities(ctx context.Context, project string, names []string) error

func (*Service) DeleteEntity

func (s *Service) DeleteEntity(ctx context.Context, project, name string) error

Deletes / Updates

func (*Service) DeleteObservations

func (s *Service) DeleteObservations(ctx context.Context, project, entity string, ids []int64, contents []string) (int64, error)

func (*Service) DeleteRelation

func (s *Service) DeleteRelation(ctx context.Context, project, source, target, relationType string) error

func (*Service) DeleteRelations

func (s *Service) DeleteRelations(ctx context.Context, project string, rels []apptype.Relation) error

func (*Service) DisableHybridSearch

func (s *Service) DisableHybridSearch()

func (*Service) EnableHybridSearch

func (s *Service) EnableHybridSearch(textWeight, vectorWeight, rrfK float64)

Hybrid search toggles

func (*Service) Neighbors

func (s *Service) Neighbors(ctx context.Context, project string, names []string, direction string, limit int) ([]apptype.Entity, []apptype.Relation, error)

Graph helpers

func (*Service) OpenNodes

func (s *Service) OpenNodes(ctx context.Context, project string, names []string, includeRelations bool) ([]apptype.Entity, []apptype.Relation, error)

OpenNodes fetches entities (and optionally relations) by names.

func (*Service) ReadGraph

func (s *Service) ReadGraph(ctx context.Context, project string, limit int) ([]apptype.Entity, []apptype.Relation, error)

ReadGraph returns recent entities + relations with limit.

func (*Service) SearchText

func (s *Service) SearchText(ctx context.Context, project string, query string, limit, offset int) ([]apptype.Entity, []apptype.Relation, error)

SearchText performs text search via underlying DB.

func (*Service) SearchVector

func (s *Service) SearchVector(ctx context.Context, project string, vector []float32, limit, offset int) ([]apptype.Entity, []apptype.Relation, error)

SearchVector performs vector search.

func (*Service) ShortestPath

func (s *Service) ShortestPath(ctx context.Context, project, from, to, direction string) ([]apptype.Entity, []apptype.Relation, error)

func (*Service) UpdateEntities

func (s *Service) UpdateEntities(ctx context.Context, project string, updates []apptype.UpdateEntitySpec) error

func (*Service) UpdateRelations

func (s *Service) UpdateRelations(ctx context.Context, project string, updates []apptype.UpdateRelationChange) error

func (*Service) Walk

func (s *Service) Walk(ctx context.Context, project string, names []string, maxDepth int, direction string, limit int) ([]apptype.Entity, []apptype.Relation, error)

Jump to

Keyboard shortcuts

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