Skip to content

Receitas

Uma suite de extração de JSON

{
  "name": "Extraction",
  "cases": [
    {
      "name": "invoice-json",
      "prompt": "Extract {\"total\": number} from: Total due: 42.50 EUR. Only JSON.",
      "checks": [{ "type": "jsonValid" }, { "type": "regex", "value": "\"total\"\\s*:\\s*42\\.5" }]
    }
  ]
}

Comparar modelos e guardar um relatório

ollama pull llama3.2 && ollama pull qwen2.5
npx ollabench extraction.suite.json --models llama3.2,qwen2.5 --out report.md

Falhar o CI se a qualidade descer

import { loadSuite, runSuite, OllamaModelClient } from 'ollabench';

const report = await runSuite(loadSuite('smoke.suite.json'), ['llama3.2'], new OllamaModelClient());
const model = report.models[0];
if (model.passRate < 0.9) {
  console.error(`Pass rate ${(model.passRate * 100).toFixed(0)}% abaixo do limite`);
  process.exit(1);
}

Suite focada em latência (para um Pi)

{
  "name": "Latency",
  "cases": [
    { "name": "short-answer", "prompt": "Capital of France? One word.",
      "checks": [{ "type": "contains", "value": "Paris" }, { "type": "maxLatencyMs", "value": 4000 }] }
  ]
}

Inspecionar outputs em bruto para scoring próprio

const report = await runSuite(suite, ['llama3.2'], new OllamaModelClient());
for (const r of report.results) meuScorer(r.output); // r.output é o texto em bruto