recall

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine handles memory recall operations

func NewEngine

func NewEngine(memoryService *memory.Service, evidenceService *evidence.Service, cfg *config.Config, logger *zap.Logger, db *sql.DB) *Engine

NewEngine creates a new recall engine

func (*Engine) Close

func (e *Engine) Close()

Close gracefully shuts down the engine and its resources.

func (*Engine) Recall

func (e *Engine) Recall(options RecallOptions) ([]RecallResult, error)

Recall performs memory recall based on the query

type MetricsWriter

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

MetricsWriter handles async writing of recall metrics to the database.

func NewMetricsWriter

func NewMetricsWriter(db *sql.DB, logger *zap.Logger) *MetricsWriter

NewMetricsWriter creates a new async metrics writer. Pass nil for db to disable metrics writing.

func (*MetricsWriter) Close

func (mw *MetricsWriter) Close()

Close gracefully shuts down the metrics writer, flushing pending writes.

func (*MetricsWriter) Write

func (mw *MetricsWriter) Write(metric RecallMetric)

Write queues a metric for async writing. Non-blocking; drops if buffer full.

type RecallMetric

type RecallMetric struct {
	ProjectID     string
	Query         string
	QueryType     string // "empty" or "search"
	MemoryIDs     []int64
	MemoryCount   int
	TotalTokens   int
	TierBreakdown TierStats
	DurationMs    int64
	CreatedAt     time.Time
}

RecallMetric represents a single recall operation's metrics.

type RecallOptions

type RecallOptions struct {
	ProjectID         string
	Query             string
	MaxItems          int
	MaxTokens         int
	Types             []memory.Type
	ExcludeSuperseded bool
}

RecallOptions specifies options for the recall operation

type RecallResult

type RecallResult struct {
	Memory *memory.Memory
	Score  float64
	Tokens int
}

RecallResult represents a recalled memory with relevance score

type Recaller

type Recaller interface {
	Recall(options RecallOptions) ([]RecallResult, error)
	Close()
}

Recaller defines the interface for memory recall engines.

type TierStats

type TierStats struct {
	Always        int `json:"always"`
	Contextual    int `json:"contextual"`
	Opportunistic int `json:"opportunistic"`
}

TierStats holds the breakdown of memories by recall tier.

Jump to

Keyboard shortcuts

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