cove

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CandidateMemory

type CandidateMemory struct {
	ID      string
	Type    string
	Summary string
	Detail  string
}

CandidateMemory represents a candidate memory to be verified

type CandidateResult

type CandidateResult struct {
	ID         string  `json:"id"`
	Confidence float64 `json:"confidence"`
	Reason     string  `json:"reason"`
}

CandidateResult represents the CoVe verification result for a single candidate memory

type LLMClient

type LLMClient interface {
	ChatCompletions(ctx context.Context, req llm.ChatCompletionRequest) (*llm.ChatCompletionResponse, error)
}

LLMClient is an interface for LLM clients (for testing)

type RecallFilterRequest

type RecallFilterRequest struct {
	Memories []RecallMemory
	Query    string
	Timeout  time.Duration
	Model    string
}

RecallFilterRequest is the internal request structure for recall filtering

type RecallFilterResult

type RecallFilterResult struct {
	ID      string `json:"id"`
	Include bool   `json:"include"`
}

RecallFilterResult represents the CoVe relevance check result for recall

type RecallMemory

type RecallMemory struct {
	ID      string
	Type    string
	Summary string
	Detail  string
}

RecallMemory represents a memory to be filtered for recall

type SQLiteStatsStore

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

SQLiteStatsStore stores CoVe stats in SQLite.

func NewSQLiteStatsStore

func NewSQLiteStatsStore(db *sql.DB) *SQLiteStatsStore

NewSQLiteStatsStore creates a new SQLite-backed stats store.

func (*SQLiteStatsStore) Load

func (s *SQLiteStatsStore) Load(projectID string) (*Stats, error)

Load retrieves stats for a project, or nil if none exist.

func (*SQLiteStatsStore) Save

func (s *SQLiteStatsStore) Save(projectID string, stats Stats) error

Save persists the given stats for a project.

type Stats

type Stats struct {
	CandidatesEvaluated int
	CandidatesDiscarded int
	TotalConfidence     float64
	AvgConfidence       float64
	CoVeErrors          int
	LastUpdated         time.Time
}

Stats tracks CoVe operation statistics

type StatsStore

type StatsStore interface {
	Save(projectID string, stats Stats) error
	Load(projectID string) (*Stats, error)
}

StatsStore persists CoVe stats.

type StatsTracker

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

StatsTracker tracks CoVe operation statistics in memory

func NewStatsTracker

func NewStatsTracker() *StatsTracker

NewStatsTracker creates a new stats tracker

func (*StatsTracker) GetStats

func (s *StatsTracker) GetStats() Stats

GetStats returns the current statistics

func (*StatsTracker) RecordError

func (s *StatsTracker) RecordError()

RecordError records a CoVe error

func (*StatsTracker) RecordEvaluation

func (s *StatsTracker) RecordEvaluation(confidence float64, discarded bool)

RecordEvaluation records a single candidate evaluation

func (*StatsTracker) Reset

func (s *StatsTracker) Reset()

Reset clears all statistics

type VerificationRequest

type VerificationRequest struct {
	Candidates []CandidateMemory
	Timeout    time.Duration
	Model      string
}

VerificationRequest is the internal request structure for batch verification

type Verifier

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

Verifier provides CoVe (Chain-of-Verification) filtering for memory candidates

func NewVerifier

func NewVerifier(cfg *config.Config, llmClient LLMClient) *Verifier

NewVerifier creates a new CoVe verifier

func (*Verifier) FilterRecall

func (v *Verifier) FilterRecall(ctx context.Context, memories []RecallMemory, query string) ([]RecallMemory, error)

FilterRecall performs optional CoVe-based relevance filtering on recall results This is an advisory filter that can only remove items, never add

func (*Verifier) GetStats

func (v *Verifier) GetStats() Stats

GetStats returns current CoVe statistics

func (*Verifier) ResetStats

func (v *Verifier) ResetStats()

ResetStats clears all statistics

func (*Verifier) SetStatsStore

func (v *Verifier) SetStatsStore(store StatsStore, projectID string)

SetStatsStore enables persistent stats storage.

func (*Verifier) VerifyCandidates

func (v *Verifier) VerifyCandidates(candidates []CandidateMemory) ([]CandidateMemory, error)

VerifyCandidates performs CoVe verification on candidate memories Returns filtered candidates that meet the confidence threshold IMPORTANT: This NEVER changes memory types or creates facts

Jump to

Keyboard shortcuts

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