retrieval

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ScoredResult

type ScoredResult struct {
	Memory          memory.Memory `json:"memory"`
	SimilarityScore float64       `json:"similarity_score"`
	RecencyScore    float64       `json:"recency_score"`
	FrequencyScore  float64       `json:"frequency_score"`
	FinalScore      float64       `json:"final_score"`
}

ScoredResult wraps a search result with hybrid scoring details.

type Scorer

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

Scorer applies multi-signal ranking to search results.

func NewScorer

func NewScorer(weights Weights) *Scorer

func (*Scorer) Rank

func (s *Scorer) Rank(results []memory.SearchResult, now time.Time) []ScoredResult

Rank takes vector search results and re-ranks them using multi-signal scoring.

func (*Scorer) SetHalfLife

func (s *Scorer) SetHalfLife(hours float64)

SetHalfLife configures the recency decay half-life in hours. After this many hours, recency score drops to 0.5.

type Weights

type Weights struct {
	Similarity float64 `json:"similarity" yaml:"similarity"` // vector cosine score
	Recency    float64 `json:"recency" yaml:"recency"`       // time decay
	Frequency  float64 `json:"frequency" yaml:"frequency"`   // access count boost
}

Weights controls the relative importance of each scoring signal.

func DefaultWeights

func DefaultWeights() Weights

DefaultWeights provides balanced defaults.

Jump to

Keyboard shortcuts

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