memory

package
v0.0.0-...-9623d27 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	VectorDimension    = 768
	MaxBatchSize       = 50
	DefaultTTLDays     = 15
	DefaultSearchLimit = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	AgentName string
	UserID    string
	Content   string
	Vector    []float32
	Metadata  json.RawMessage
	TTLDays   int
}

type Option

type Option func(*Service)

func WithClock

func WithClock(now func() time.Time) Option

type SearchRequest

type SearchRequest struct {
	AgentName string
	UserID    string
	Vector    []float32
	Limit     int
	MinScore  float64
}

type SearchResult

type SearchResult struct {
	ID        string
	Content   string
	Score     float64
	Metadata  json.RawMessage
	CreatedAt time.Time
}

type Service

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

func NewService

func NewService(store Store, options ...Option) *Service

func (*Service) Add

func (s *Service) Add(ctx context.Context, input Input) (string, error)

func (*Service) AddBatch

func (s *Service) AddBatch(ctx context.Context, inputs []Input) (int, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, agentName, userID string) error

func (*Service) List

func (s *Service) List(ctx context.Context, agentName, userID string) ([]database.Memory, error)

func (*Service) Search

func (s *Service) Search(ctx context.Context, request SearchRequest) ([]SearchResult, error)

type Store

type Store interface {
	StoreAgentMemory(context.Context, *database.Memory) error
	StoreAgentMemories(context.Context, []*database.Memory) error
	SearchAgentMemory(context.Context, string, string, pgvector.Vector, int) ([]database.AgentMemorySearchResult, error)
	ListAgentMemories(context.Context, string, string) ([]database.Memory, error)
	DeleteAgentMemory(context.Context, string, string) error
}

Jump to

Keyboard shortcuts

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