Documentation
¶
Index ¶
- type CandidateMemory
- type CandidateResult
- type LLMClient
- type RecallFilterRequest
- type RecallFilterResult
- type RecallMemory
- type SQLiteStatsStore
- type Stats
- type StatsStore
- type StatsTracker
- type VerificationRequest
- type Verifier
- func (v *Verifier) FilterRecall(ctx context.Context, memories []RecallMemory, query string) ([]RecallMemory, error)
- func (v *Verifier) GetStats() Stats
- func (v *Verifier) ResetStats()
- func (v *Verifier) SetStatsStore(store StatsStore, projectID string)
- func (v *Verifier) VerifyCandidates(candidates []CandidateMemory) ([]CandidateMemory, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CandidateMemory ¶
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 ¶
RecallFilterResult represents the CoVe relevance check result for recall
type RecallMemory ¶
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.
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
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 ¶
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) 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