storage

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// MemoryClassName is the Weaviate class name for memories
	MemoryClassName = "Memory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphTraverser added in v0.2.0

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

GraphTraverser handles memory relationship traversal

func NewGraphTraverser added in v0.2.0

func NewGraphTraverser(sqlStore *SQLiteStore) *GraphTraverser

NewGraphTraverser creates a new graph traverser

func (*GraphTraverser) ExpandMemories added in v0.2.0

func (g *GraphTraverser) ExpandMemories(seedIDs []string, depth int) ([]string, error)

ExpandMemories performs BFS traversal of memory relationships Returns additional memory IDs to include, up to the specified depth

type Memory

type Memory struct {
	ID                string
	ProjectID         string
	SessionID         *string
	Content           string
	Importance        float64
	ContextType       *string
	TemporalRelevance *string
	ActionRequired    bool
	Tags              []string
	TriggerPhrases    []string
	CreatedAt         time.Time
	UpdatedAt         time.Time
}

Memory represents memory metadata in the database

type MemoryRelationship

type MemoryRelationship struct {
	FromMemoryID     string
	ToMemoryID       string
	RelationshipType string
	CreatedAt        time.Time
}

MemoryRelationship represents a relationship between memories

type Project

type Project struct {
	ID        string
	Name      string
	Path      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

Project represents a project in the database

type SQLiteStore

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

SQLiteStore handles SQLite operations for metadata storage

func NewSQLiteStore

func NewSQLiteStore(dbPath string) (*SQLiteStore, error)

NewSQLiteStore creates a new SQLite store

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

Close closes the database connection

func (*SQLiteStore) CreateMemory

func (s *SQLiteStore) CreateMemory(memory *Memory) error

CreateMemory creates a new memory with tags and trigger phrases

func (*SQLiteStore) CreateProject

func (s *SQLiteStore) CreateProject(project *Project) error

CreateProject creates a new project

func (*SQLiteStore) CreateRelationship

func (s *SQLiteStore) CreateRelationship(rel *MemoryRelationship) error

CreateRelationship creates a relationship between two memories

func (*SQLiteStore) CreateSession

func (s *SQLiteStore) CreateSession(session *Session) error

CreateSession creates a new session

func (*SQLiteStore) GetLastSession

func (s *SQLiteStore) GetLastSession(projectID string) (*Session, error)

GetLastSession retrieves the most recent session for a project

func (*SQLiteStore) GetMemory

func (s *SQLiteStore) GetMemory(id string) (*Memory, error)

GetMemory retrieves a memory by ID with its tags and trigger phrases

func (*SQLiteStore) GetProject

func (s *SQLiteStore) GetProject(id string) (*Project, error)

GetProject retrieves a project by ID

func (*SQLiteStore) GetProjectByPath

func (s *SQLiteStore) GetProjectByPath(path string) (*Project, error)

GetProjectByPath retrieves a project by path

func (*SQLiteStore) GetRelationships

func (s *SQLiteStore) GetRelationships(memoryID string) ([]MemoryRelationship, error)

GetRelationships retrieves all relationships for a memory

func (*SQLiteStore) GetSession

func (s *SQLiteStore) GetSession(id string) (*Session, error)

GetSession retrieves a session by ID

func (*SQLiteStore) UpdateSession

func (s *SQLiteStore) UpdateSession(session *Session) error

UpdateSession updates a session

type Session

type Session struct {
	ID              string
	ProjectID       string
	StartedAt       time.Time
	EndedAt         *time.Time
	DurationSeconds *int
}

Session represents a session in the database

type VectorSearchResult

type VectorSearchResult struct {
	ID       string
	Distance float64
	Metadata map[string]interface{}
}

VectorSearchResult represents a result from vector search

type WeaviateStore

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

WeaviateStore handles vector storage operations

func NewWeaviateStore

func NewWeaviateStore(host string, scheme string) (*WeaviateStore, error)

NewWeaviateStore creates a new Weaviate store

func NewWeaviateStoreWithAuth

func NewWeaviateStoreWithAuth(host string, scheme string, apiKey string) (*WeaviateStore, error)

NewWeaviateStoreWithAuth creates a new Weaviate store with authentication

func (*WeaviateStore) Close

func (w *WeaviateStore) Close() error

Close closes the Weaviate connection

func (*WeaviateStore) Delete

func (w *WeaviateStore) Delete(id string) error

Delete deletes a memory by ID

func (*WeaviateStore) Search

func (w *WeaviateStore) Search(embedding []float32, limit int, filterMap map[string]interface{}) ([]VectorSearchResult, error)

Search performs vector similarity search

func (*WeaviateStore) Store

func (w *WeaviateStore) Store(id string, content string, embedding []float32, metadata map[string]interface{}) error

Store stores a memory with its embedding

Jump to

Keyboard shortcuts

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