memory

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryManager

type MemoryManager interface {
	AddSessionMemory(ctx context.Context, sessionID, text string) error
	GetSessionContext(ctx context.Context, sessionID string) ([]string, error)

	AddPersistentMemory(ctx context.Context, userID, text string, embedding []float32) error
	SemanticSearch(ctx context.Context, userID string, queryEmbedding []float32, limit int) ([]string, error)
}

MemoryManager provides methods for session tracking and long-term semantic retrieval.

type PostgresMemoryManager

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

PostgresMemoryManager implements MemoryManager using PostgreSQL and pgvector.

func NewPostgresMemoryManager

func NewPostgresMemoryManager(pool *pgxpool.Pool) *PostgresMemoryManager

NewPostgresMemoryManager creates a new Postgres-based vector store.

func (*PostgresMemoryManager) AddPersistentMemory

func (m *PostgresMemoryManager) AddPersistentMemory(ctx context.Context, userID, text string, embedding []float32) error

AddPersistentMemory stores data with an embedding for semantic search.

func (*PostgresMemoryManager) AddSessionMemory

func (m *PostgresMemoryManager) AddSessionMemory(ctx context.Context, sessionID, text string) error

AddSessionMemory saves a piece of conversation to the short-term session.

func (*PostgresMemoryManager) GetSessionContext

func (m *PostgresMemoryManager) GetSessionContext(ctx context.Context, sessionID string) ([]string, error)

GetSessionContext retrieves recent conversation context for a session.

func (*PostgresMemoryManager) SemanticSearch

func (m *PostgresMemoryManager) SemanticSearch(ctx context.Context, userID string, queryEmbedding []float32, limit int) ([]string, error)

SemanticSearch performs a nearest-neighbor search using pgvector.

Jump to

Keyboard shortcuts

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