← All writing

Evaluation

Writing

export async function compare(variants, cases, check) {
  const results = {};
  for (const [name, run] of Object.entries(variants)) {
    const rows = [];
    for (const c of cases) {
      let output;

A small test harness for prompts: same cases, every change

About forty lines of code that run the same cases against several variants and count passes, failures and missing results separately. Tried on our semantic search and on a small local model, where it caught a problem nobody was looking for.

AI applicationsTestingEvaluation
const cosine = (a, b) => a.reduce((sum, x, i) => sum + x * b[i], 0);

const hits = index
  .map((chunk) => ({...chunk, score: cosine(queryVector, chunk.vector)}))
  .sort((a, b) => b.score - a.score)
  .slice(0, 3);

Semantic search over our own articles, with a local model

A small, runnable build: index this site’s English and Turkish articles with a multilingual embedding model on your own machine, search by meaning, and look honestly at where it works and where it does not.

AI applicationsArchitectureEvaluation
function summarize(successes, assessed, unresolved) {
  const total = assessed + unresolved;
  return {
    observed: assessed ? successes / assessed : null,
    lower: total ? successes / total : null,
    upper: total ? (successes + unresolved) / total : null,

Eight correct answers: is that really 100%?

What happens to a score when unanswered cases are left out, and how to report it honestly.

EvaluationTestingAI applications