test: cover Anthropic provider override across all text-complexity evaluators - #151
test: cover Anthropic provider override across all text-complexity evaluators#151adnanrhussain wants to merge 1 commit into
Conversation
b74f135 to
868604a
Compare
There was a problem hiding this comment.
Pull request overview
Adds verification coverage to ensure all TypeScript text-complexity evaluators correctly route a modelOverride to Anthropic (using only anthropicApiKey), plus a gated live integration suite to smoke-test structured-output round trips against Anthropic’s API. This supports upcoming CLI provider/model selection by preventing regressions where evaluators would accidentally require non-Anthropic keys or fail when forced onto Anthropic.
Changes:
- Add unit tests asserting all six text-complexity evaluators accept an Anthropic
modelOverrideand route provider construction to Anthropic with the override model. - Add gated live integration tests that run all six evaluators against Anthropic when
RUN_INTEGRATION_TESTS=trueandANTHROPIC_API_KEYis set (and fail loudly when misconfigured). - Document key override caveats directly on
ModelOverride(vocabulary multi-model collapse; purpose model sourced from shared config).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
sdks/typescript/tests/unit/evaluators/anthropic-override.test.ts |
Unit coverage for Anthropic override plumbing across all six text-complexity evaluators, plus explicit tests for known override caveats. |
sdks/typescript/tests/integration/anthropic-provider.integration.test.ts |
Gated live Anthropic integration suite validating that each evaluator completes and returns a structured result under override. |
sdks/typescript/src/evaluators/base.ts |
Documentation updates to ModelOverride warning about evaluator-wide overrides and specific evaluator caveats. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
868604a to
8ff585a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
8ff585a to
7ddb62a
Compare
|
Live verification done: all six evaluators passed against the real Anthropic API (2026-08-07, That run also exposed the inverse gating bug in The other failures in that run were pre-existing suites needing |
Fourth of four foundational SDK PRs. Independent — based on
main.Why: the batch CLI is about to offer user-selectable providers. Today Anthropic is only reachable via
--model-override anthropic:<model>, becauserequiredProvidersnever returns it otherwise. Once the CLI advertises provider choice, users will run every evaluator on Anthropic assuming it's supported.What: unit tests that all six text-complexity evaluators accept an Anthropic override with only an
anthropicApiKeyand route every provider construction to Anthropic. This path matters becausevalidateApiKeysshort-circuits onmodelOverrideand checks only that provider's key — untested per evaluator until now. Plus a gated live-API test and caveats documented onModelOverride.Two pre-existing surprises, now test-covered so the CLI can warn:
vocabularydeliberately uses three models (Gemini 2.5 Pro for grades 3-4, GPT-4.1 for 5-12, GPT-4o for background knowledge); a run-level override collapses all three.purposetakes its model from the shared cross-language eval config, so overriding diverges from that rather than from a hardcoded default.Verified against the live API
Unit plumbing: 333 passing, lint 0 errors, typecheck clean.
Live Anthropic: all six evaluators passed against the real API on 2026-08-07 with
claude-haiku-4-5-20251001, in an ~80s run. The risk this PR existed to check — Anthropic's tool-call structured output against the larger nested schemas (vocabulary,sentence-structure,purpose) — did not materialise; every schema round-tripped.What this does not establish: evaluation quality on Anthropic. Scores were asserted for shape, not correctness, and evaluators remain validated against their recommended models. The
vocabularythree-model collapse and thepurposeconfig divergence still apply to anyone setting an override.On the gating: this suite fails loudly rather than skipping when
RUN_INTEGRATION_TESTS=truewithout a key, matchingbatch.integration.test.ts— a silent skip would have left the gap above permanently unchecked while reporting success.The same run exposed the inverse bug in
model-override.integration.test.ts, fixed here: its gate used&&, so it ran wheneverRUN_INTEGRATION_TESTSwas set and then failed on its own missingOPENAI_API_KEYinstead of skipping. All three integration files now agree on the convention.