@aidex/evaluation
v1.2.0
Published
Aidex Evaluation Framework — benchmark engines for output quality, token usage, cost, latency, and success rate, and compare providers.
Maintainers
Readme
@aidex/evaluation
Installation
pnpm add @aidex/evaluationnpm install @aidex/evaluationBenchmarks engines (or anything expressible as () => Promise<TResult>):
output quality, token usage, cost, latency, and success rate — and allows
comparing providers by running several named cases side by side.
Contents
types/BenchmarkCase—{ name, execute(): Promise<TResult>, scoreOutput?(result), estimateTokens?(result) }.execute()is deliberately generic — the Evaluator never imports@aidex/engines,@aidex/providers, or@aidex/strategies. A caller's closure is whatever it needs to be (anEngine.execute(context)call, anAI.text()call, a rawProvider.generate()call).evaluator/Evaluator—run(case, options?)executes a caseoptions.runstimes (default 1), catching failures rather than throwing out ofrun(), and returns aBenchmarkSummary.compare(cases, options?)runs several cases with the same options and returns one summary per case — this is how you compare providers: define oneBenchmarkCaseper provider/engine/strategy variant, each wrapping a call through that variant.- Tracked per run:
durationMs(via an injectable clock —options.now, defaulting toDate.now, for deterministic tests),qualityScore(via the case's ownscoreOutput()— there is no automatic quality judge),inputTokens/outputTokensandcost(via the case'sestimateTokens()plusoptions.pricing, reusing@aidex/observability'sestimateCost()rather than duplicating its math), andsuccess/error. - Aggregated per case (
BenchmarkSummary):successRate(fraction of runs that didn't throw),averageDurationMs,averageQualityScore,averageCost— eachundefinedif no run produced that value (e.g. noscoreOutput()supplied, or every run failed).
Dependency direction
@aidex/evaluation depends on @aidex/observability only (estimateCost,
CostEstimate, reused rather than reimplemented). No dependency on
@aidex/core, @aidex/providers, @aidex/engines, @aidex/strategies, or any
application code — a BenchmarkCase's execute() closure is where any of
those would actually be used, entirely outside this package.
