@basenative/evals

中文文档
3.0.0发布于 2026/10/31Apache-2.0TypeScriptES Module构建来源已验证

Eval harness measuring whether models actually produce correct BaseNative

原始使用文档
文档目录5 节
  1. The corpus is hand-authored
  2. Pipeline
  3. The headline number
  4. Multi-provider by design
  5. License

@basenative/evals

Measures whether models actually produce correct BaseNative — converting the AI-legibility claim from marketing into a number anyone can check.

bn-evals --models anthropic:claude-opus-5,openai:gpt-5,google:gemini-2.5-pro --out results.md

The corpus is hand-authored

prompts/ and fixtures/ are written by hand by the repo owner. No skill, no subagent, and no model at any tier may generate them.

If a model writes the prompt, the reference implementation, and the assertion, the eval measures that model's self-consistency and nothing else — a beautiful, high, meaningless number. The harness therefore refuses to run against an empty corpus rather than falling back to anything generated.

Assertion types are infrastructure and live in src/assertions.js. Assertion values — what correct looks like — are yours.

Pipeline

prompts/ (hand-authored) → model runner → generated template
    → @basenative/validate   does it parse?
    → @basenative/server     does it render?
    → @basenative/runtime    (stateful cases only) does it hydrate and react?
    → behavioural assertions does it do the thing?
    → score

The hydrate stage only runs for a case that declares state or a hydrate-family assertion (hydrated_contains/hydrated_excludes/after_set — see prompts/README.md) — most cases are fully scored by SSR output alone. When it does run, it mounts the generated template — directives intact — into the same DOM shim @basenative/runtime's own tests use, and runs the real client hydrate() against a context of real signals, which is the only way to score a signal, computed, or effect rather than just a template's static shape.

Stages short-circuit: a template that does not parse cannot be meaningfully rendered, so failedAt tells you where a model went wrong, not just that it did.

The headline number

The suite runs twice per model — once with the BaseNative MCP tools offered, once without. The delta is the product claim: does giving a model a validator actually make it write correct BaseNative?

The two prompts differ only by one sentence naming the tools. Anything more would confound "has tools" with "was told more about the language".

Alongside pass rate, the report tracks drift rate — how often a model reached for another framework's syntax rather than merely getting the logic wrong. That is the number that tests the thesis, and it is reported even when it embarrasses it.

Multi-provider by design

A leaderboard that only tests Claude is marketing, not evidence. resolveCredentials lists every provider whose key is missing and refuses to start, rather than quietly producing a table with three models silently absent.

Providers: anthropic, openai, google, openaiCompatible (any OpenAI-shaped endpoint, for open-weight models), ollama (local models via Ollama, no API key required).

Local models are the intended path for the non-Anthropic side of the leaderboard. Cloud model APIs are separately billed, and this project runs on hardware the owner already has rather than buying keys. Run open-weight models locally with Ollama:

ollama pull llama3.2
ollama pull qwen2.5-coder
bn-evals --models anthropic:claude-opus-5,ollama:llama3.2,ollama:qwen2.5-coder

ollama models default to http://localhost:11434; override with --ollama-url if Ollama runs elsewhere. Before running, bn-evals checks /api/tags on that endpoint and fails loudly — printing the exact ollama pull <model> command — for any requested model that hasn't been pulled yet, rather than burning a run on a typo.

resolveCredentials never treats a local model as a missing credential: ollama needs no key at all, and pointing openaiCompatible at a localhost baseUrl (Ollama's OpenAI-compatible /v1 endpoint, LM Studio, etc.) waives the key requirement too. Cloud providers are unaffected — a missing cloud key still refuses the run.

Note: running the suite against a cloud provider requires an API key for it. A Claude Max/Pro subscription does not include API access — these are separately billed.

License

Apache-2.0

版本与发布记录

@basenative/evals 共发布 11 个版本,首次发布于 2026/10/18;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.0.0latest2026/10/312 天前
2.4.02026/10/268 天前
2.3.22026/10/2212 天前
2.3.12026/10/2212 天前
2.3.02026/10/2212 天前
2.2.02026/10/2113 天前

关于 @basenative/evals 的常见问题

@basenative/evals 是什么?

Eval线束测量模型是否实际产生正确的基线

如何安装 @basenative/evals?

在项目目录运行 npm install @basenative/evals,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 bn-evals,可以用 npx bn-evals 直接运行。

@basenative/evals 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@basenative/evals 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@basenative/evals 可以商用吗?

@basenative/evals 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@basenative/evals 还在维护吗?

最新版本 3.0.0 发布于 2026/10/31(2 天前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2026/10/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。