eval

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package eval provides a small evaluation harness for the memory service: a dataset of queries with expected answers and a runner that measures recall@k. See PRD §11 and M1 milestone.

Index

Constants

This section is empty.

Variables

View Source
var DefaultDataset = []Case{
	{Query: "what framework is the backend built on", Expected: "FastAPI", Project: "demo"},
	{Query: "which database postgres version", Expected: "Postgres", Project: "demo"},
	{Query: "how do tests run with pytest", Expected: "pytest", Project: "demo"},
	{Query: "api container base image python", Expected: "python:3.12-slim", Project: "demo"},
	{Query: "who owns the mobile app alex", Expected: "Alex", Project: "demo"},
	{Query: "is the mobile app flutter", Expected: "Flutter", Project: "demo"},
	{Query: "where do api secrets live environment variables", Expected: "environment variables", Project: "demo"},
	{Query: "which tool deploys github actions", Expected: "GitHub Actions", Project: "demo"},
	{Query: "redis cache layer", Expected: "Redis", Project: "demo"},
	{Query: "staging environment url example.com", Expected: "staging.example.com", Project: "demo"},
	{Query: "python linter ruff", Expected: "ruff", Project: "demo"},
	{Query: "database migrations alembic", Expected: "alembic", Project: "demo"},
	{Query: "background jobs celery queue", Expected: "Celery", Project: "demo"},
	{Query: "frontend react typescript", Expected: "React", Project: "demo"},
	{Query: "design system owner maria", Expected: "Maria", Project: "demo"},
	{Query: "api versioning semantic versioning", Expected: "semantic versioning", Project: "demo"},
	{Query: "bugs tracked github issues", Expected: "GitHub Issues", Project: "demo"},
	{Query: "default branch main", Expected: "main", Project: "demo"},
	{Query: "node package manager pnpm", Expected: "pnpm", Project: "demo"},
	{Query: "logs collected opentelemetry", Expected: "OpenTelemetry", Project: "demo"},
}

DefaultDataset is a small, self-contained set of 20 queries about a fictional project, used by `forgetmenot eval` and tests. Queries share keyword overlap with the seeded facts so that a decent embedder (including the deterministic bag-of-words one used in tests) can retrieve them.

Functions

func SeedDataset

func SeedDataset(ctx context.Context, svc *memory.Service) (int, error)

SeedDataset populates a store with the facts the DefaultDataset queries reference. Idempotent per project: if the demo project already has memories, seeding is skipped. Returns the number of inserted memories.

Types

type Case

type Case struct {
	Query    string
	Project  string
	Expected string // substring expected to appear in the top-k results
	K        int    // top-k considered; 0 defaults to 3
}

Case is one evaluation question: recall(query) should surface the memory whose content contains Expected.

type Failure

type Failure struct {
	Query    string
	Expected string
	Got      []string
}

Failure records a single missed case.

type Result

type Result struct {
	Total     int
	Passed    int
	RecallAtK float64 // passed/total
	Failures  []Failure
	Errors    []string // recall errors encountered during the run
}

Result aggregates a run over the dataset.

func Run

func Run(ctx context.Context, svc *memory.Service, cases []Case) Result

Run evaluates the service against the dataset. It does not mutate state beyond what recall does (access bumps).

func (Result) String

func (r Result) String() string

String renders the result as a human-readable summary.

Jump to

Keyboard shortcuts

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