npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fabricorg/experiments-evals

v1.3.1

Published

LLM and code evaluators for Fabric Experiments: judge library, ModelClient contract, run aggregation.

Readme

@fabricorg/experiments-evals

Provider-neutral TypeScript evaluation contracts, built-in LLM judges, code evaluators, bounded-concurrency execution, hard judge-token reservations, and score aggregation for Fabric Experiments.

import { executeEvalRun, relevanceJudge } from '@fabricorg/experiments-evals';
import { DatabricksModelClient } from '@fabricorg/experiments-evals/databricks';

Databricks is an explicit adapter subpath; it is not exported from the portable package root. DatabricksModelClient accepts both string message.content and content-part arrays (concatenating type: "text" parts in order, ignoring reasoning and other non-text parts, rejecting malformed parts, and reporting when finish_reason: "length" exhausts maxOutputTokens before any answer text is produced). For endpoints that reject the temperature parameter (such as Anthropic Claude from Opus 4.7 onward, including Claude 5), set omitTemperature: true on DatabricksModelClient: callers still pass options.temperature and the client still validates it, but it is omitted from the request body so repeatability is left to the endpoint; record separately (for example by endpoint) if you need to know it was not applied. The subpath also exports a read-only DatabricksMlflowClient for linking native managed-MLflow run metrics into Fabric release policy. MLflow artifacts, datasets, traces, scorers, feedback, and lineage remain in Databricks.

See Databricks-native AI quality.

Compare candidate variants

Use executePairwiseRun with pairwiseQualityJudge or your own PairwiseJudge. This is a library API. The CLI, local gate, and MLflow export have no pairwise integration.

import { executePairwiseRun, pairwiseQualityJudge } from '@fabricorg/experiments-evals';

const result = await executePairwiseRun({
  judge: pairwiseQualityJudge,
  ctx: { model, nowMs: () => performance.now() },
  items: [
    {
      itemId: 'reset-mfa',
      input: 'Where do I reset MFA?',
      expectedOutput: 'Use the security settings page.',
      outputs: {
        baseline: 'Open your account settings.',
        candidate: 'Open the security settings page and select MFA.',
      },
    },
  ],
  concurrency: 2,
  timeoutMs: 10_000,
  maxJudgeTokens: 5_000,
});

console.table(result.aggregates);

Provide unique item IDs and at least two nonempty variant names per item. A pair uses only items that carry both variants. The judge sees the input, optional reference, and candidates as first and second. Keep variant labels out of the supplied content too. The built-in judge uses JSON-serializable content and accepts a single PREFERENCE: first, PREFERENCE: second, or PREFERENCE: tie reply after trimming surrounding whitespace.

The runner submits both presentation orders. A candidate wins if both verdicts prefer it after mapping the positions back to variants. Other verdict combinations tie. The order disagreement count tracks items whose two mapped verdicts differ. For example, preferring the first position in both calls produces a tie and an order disagreement. A missing verdict, failed call, timeout, or budget skip makes the item-pair unscored and records the affected call in failures.

The run reserves tokens per call, charges the full reservation on timeout, and counts valid reported usage even when a reply has no verdict. Budgeted runs admit canonical batches of up to concurrency calls and settle each batch before admitting the next. A reservation that does not fit at admission is skipped. onBudgetSkip and onFailure receive call-level records in canonical order after judging.

Variants A and B are ordered by name using JavaScript string order. For each pair, netPreference.point averages +1 for a win by A, 0 for a tie, and −1 for a win by B. netPreference also carries a 95% percentile bootstrap interval using seed 0 and 2,000 resamples. The item is the sampling unit. The interval assumes independent, identically distributed scored items and may give poor coverage with small or unrepresentative samples. Unscored items are excluded. If none are scored, netPreference is null. The seed fixes resampling; provider verdicts can vary across runs. Record the dataset version, output-generation configuration, judge name and version, model endpoint, and run options when retaining comparison results.

Judge token accounting

When using executeEvalRun, LLM judges must return non-negative integer input and output counts. Zero counts are valid. Missing or invalid judge usage is recorded in failures, releases the reservation, and contributes no score or tokens to the run. Code and heuristic evaluators may omit usage.

Set ExecuteOptions.timeoutMs to a positive integer to bound the wait for each evaluation trial in milliseconds. Omit it to run without a timer. A timeout records a failure for that trial while remaining evaluations continue. Calls can continue spending tokens after timeout, so the runner charges the full reservation to tokensSpent and discards any late result.

Generate outputs for evaluation

executeGenerationPhase defaults to one completion at a time for durable executors. Set GenerationPhaseOptions.concurrency to a positive integer to opt into more concurrent waits. In-flight reservations count toward maxTokens. The phase returns successes and failures in their respective input orders. A true shouldStop result blocks new starts and lets active workers record their outcomes.

The phase also accepts a positive integer timeoutMs per completion. A timed-out completion is excluded from judging and charged its full reservation to tokensSpent. The provider call can still be running after the worker stops waiting. Input and output token totals reflect reported usage from successful completions.

Repeat trials and summarize uncertainty

Set trials to a positive integer in executeEvalRun to judge each item with each selected evaluator repeatedly. The default is 1. Each trial reserves judge tokens independently against the shared run budget. Score rows and failures include a zero-based trial, also passed as the third argument to onBudgetSkip. Progress still counts items. Reservation errors reject the run by default. Set captureReservationFailures: true to record them per trial.

Pass the runner's scores to aggregateScoredItems with their item IDs and trial indices intact. itemMeanInterval is a 95% percentile bootstrap interval over item means for binary and graded evaluators. It draws items with replacement using a fixed seed of 0 and 2,000 resamples. Duplicate rows for the same item, evaluator name and version, and trial throw, including null scores. The interval assumes independent, representative items. A single scored item gives a point interval, and a group with no numeric scores gives null.

trialDisagreementShare is the fraction of items with different numeric scores among items with at least two scored trials. If no item qualifies, the share is null. Null scores count as unscored. Null, skipped, and failed trials contribute no value to the item mean or disagreement share. The original aggregateScores accepts bare scores and keeps its original fields. meanScore and the binary passRate.rate still summarize numeric trial rows. Use itemMeanInterval for uncertainty with repeated trials. The legacy passRate bounds apply Wilson to trial rows and assume independent observations.

Export precomputed MLflow records

buildMlflowEvaluationRecords(items, options) accepts RunItem[] from any provider. Pass the dataset ID and positive integer version, with optional datasetVersionHash and modelEndpoint. Supply prompt ID, prompt version, and model through provenance and override those fields per item through itemProvenance. Prompt versions become strings. The exporter uses explicit options so callers control which metadata leaves their application.

The v1 format preserves a plain-object input and wraps other JSON inputs in { input: value }. Outputs retain their JSON shape. Defined expected outputs map to expectations.expected_response. Use mapInputs, mapOutputs, and mapExpectations for scorer-specific shapes. The latter can return undefined to omit expectations. To export runner output, pass execution: { result: execution, evaluators } with the evaluator list used by executeEvalRun with trials: 1. The v1 exporter rejects scores and failures with a later trial index. The builder fills absent evaluator results with null scores, including failures and budget skips. For independent score data, pass scores to join by item ID. The template expects each observed evaluator on each record and treats an absent entry as missing. A passThreshold adds the boolean result of a greater-than-or-equal comparison. Null scores receive pass: false when a threshold is set.

Builder options tags and metadata accept per-item callbacks. Pass the returned record objects directly to the serializer so it can recognize the managed tags and score metadata. To export existing RAG-style records, pass the plain records to serializeMlflowEvaluationRecords(ragRecords). The serializer adds the format tag and preserves custom tags and metadata. The builder and serializer reject caller-provided fabric.* tags and metadata.itemId or metadata.scores keys.

serializeMlflowEvaluationRecords(records) writes compact JSONL in record order, with stable object-key ordering and one LF after each record, including the last. The builder rejects duplicate IDs, scores with unknown IDs and empty inputs. The builder and serializer reject values outside their supported JSON data model, including BigInt, cycles and non-finite numbers.

Keep credentials out of inputs, outputs, expectations, tags, and metadata. Store the records where the application data is permitted. The published package includes the Python Job template. The template requires MLflow 3.18.0 and fails the run when native or caller scoring coverage is incomplete. The Databricks-native guide lists the tags, metrics and gates.

Local evaluation gates

Call runEvalGate with items, evaluators, a judge ModelClient, a gate policy such as accuracy/mean>=0.9, and optional generation and judge budget controls. Use result.passed in a script or a Vitest assertion. A run on precomputed outputs with pure code evaluators makes no network call. An LLM judge requires its configured model client. Set timeoutMs to bound each evaluation trial in milliseconds. The gate records a timeout as an evaluator-failure with the trial's sampleIndex in the existing evidence schema.

runEvalGate accepts the same trials option and rejects duplicate item IDs before generation or judging. For an item without a precomputed output, produce(item) runs sequentially once per trial and shares that output across the selected evaluators. A producer may also return plain-object metadata alongside output; the gate shallow-merges it over the item's metadata (producer keys win) for that trial's evaluators without mutating the item, and does not write per-trial metadata to the evidence. Non-plain-object producer metadata, a generation refusal, or a thrown error records a generation-error, fails the gate, and skips judging for that trial. The judge budget covers evaluation calls.

LocalEvalResult is the versioned Zod schema for the JSON evidence. The result contains descriptive metadata (including optional string-valued labels), evaluator identities, aggregates, case scores, unevaluable cases, individual comparisons, and the gate verdict with reasons. runEvalGate rejects unrecognized top-level metadata keys, symbol or non-enumerable keys on metadata or labels, and a label key named __proto__ before generation or judging, while LocalEvalResult ignores unknown top-level metadata keys when reading evidence. samplesPerCase records the requested count, and sampleIndex is the zero-based trial index on case and failure records. Version 1 baseline files can omit itemMeanInterval and trialDisagreementShare. Omit an item’s evaluatorNames to use all evaluators. An empty list fails with empty-evaluator-selection and the item ID; unknown names produce unknown-evaluator reasons, including when known evaluators also run. An empty dataset fails. Use compareEvalBaseline with evidence from the same dataset hash, schema version, and baseline evaluator identities to detect a drop in mean score beyond your tolerance. Valid run labels and unrecognized metadata keys in baseline evidence do not affect compareEvalBaseline. A baseline whose labels are not string-valued, or that has a label key named __proto__, is invalid evidence and is refused.