Skip to content

eval: run any provider as a LangSmith experiment scored by score_one - #259

Merged
MatthewK84 merged 2 commits into
mainfrom
eval/langsmith-experiments
Nov 30, 2026
Merged

MatthewK84 merged 2 commits into
mainfrom
eval/langsmith-experiments

Conversation

@MatthewK84

Copy link
Copy Markdown
Owner

Runs any eval provider and track as a LangSmith experiment. The scores come from the repository's own scorer (mission_scoring.score_one), so nothing is scored a second way. The run is manual: CI makes no LangSmith call.

What changed

  • eval/langsmith_experiment.py (new). This is the CLI and adapter. It wraps an eval/run.py provider as the langsmith.evaluate target, and the target looks each fixture up by fixture_id in the committed pack.
    • Row evaluator: langsmith_bridge.evaluator_feedback (the four failure flags).
    • Summary evaluator: report_from_answers (the four totals plus max_abs_hover_error_w and max_abs_energy_error_wh).
    • Metadata: calculator_version, provider, track, commit_sha, dataset, fixtures.
    • After the run, every row is scored again locally. Feedback that disagrees aborts. --expect FILE fails unless all six numbers equal a committed result.
  • Dataset name is now suas-advisory-eval-<calculator version>-<12 hex of the pack sha256>, so a regenerated pack gets a new dataset.
  • Sync is idempotent. A second run writes nothing, and an example that drifted is updated in place.
  • One client_from_env replaces two copies. It reads only SUAS_LANGSMITH_API_KEY and SUAS_LANGSMITH_ENDPOINT, and the SDK is imported lazily, so every eval module imports without langsmith.
  • The export accepts the names evaluate gives ({provider}.{track}-<suffix>) and the unaided track.
  • Docs: eval/LANGSMITH.md, a README <details> block, the eval-record section of docs/ops.md, and a changelog line.

What stays the same

  • No change to safety, calculator, seal, or tracing behavior.
  • App tracing is still SUAS_LANGSMITH_TRACING=true with redaction. Startup still refuses LangChain's unredacted LANGSMITH_TRACING=true.
  • langsmith==0.14.12 was already pinned. No new dependency, no CI job, and no workflow change.

How it was proven (ub-mode log)

  1. Red: I wrote backend/tests/test_langsmith_experiment.py first. It failed at collection because the module did not exist yet.
  2. Green, with no network. A stand-in for evaluate makes the SDK's calls. With it, oracle/calculator_tool, constant_power/no_tools, always_no_go/unaided, and echo/unaided equal eval/results/2026-11-29 on all six columns.
  3. Other tests cover:
    • the metadata;
    • the target returning only answer fields;
    • running the sync twice, and updating a drifted example;
    • which key is read, and the endpoint;
    • the CLI's pass, fail, and missing-commit cases;
    • export name parsing;
    • a subprocess probe that imports every LangSmith eval module with langsmith blocked.
  4. The real langsmith 0.14.12 evaluate ran offline (upload_results=False, unreachable endpoint). There were zero mismatches for oracle/calculator_tool and constant_power/no_tools.
  5. Local gates: the full backend suite gave 1285 passed and 21 skipped. Ruff, ruff format, and mypy --strict are clean. crapper on the changed eval modules puts every new or changed function below CRAP 10. The US English lint passes.

Why: the LangSmith path could sync a dataset and export a finished
experiment, but nothing created an experiment, the dataset name did not
say which pack it held, every sync rewrote all 61 examples, and the export
rejected the names langsmith.evaluate gives (and the unaided track).

What: eval/langsmith_experiment.py wraps an eval/run.py provider as an
evaluate() target; row evaluators call langsmith_bridge.evaluator_feedback
and a summary evaluator calls report_from_answers, so both are
mission_scoring.score_one. Metadata carries calculator_version, provider,
track, commit_sha, dataset and fixtures; --expect fails unless the six
scores equal a committed result. The dataset is now
suas-advisory-eval-<calculator version>-<12 hex of the pack sha256>, a
repeat sync writes nothing, and the duplicated client builder is one
client_from_env (SUAS_LANGSMITH_API_KEY only, SDK imported lazily).

Proof: tests/test_langsmith_experiment.py (red first: module missing)
drives a no-network evaluate stand-in and matches eval/results/2026-11-29
for oracle, constant_power, always_no_go and echo; a subprocess probe
imports every eval LangSmith module with langsmith blocked. An offline run
of the real langsmith 0.14.12 evaluate (upload_results=False) gave zero
mismatches for oracle/calculator_tool and constant_power/no_tools. Full
backend suite 1285 passed; ruff, format, mypy clean; CRAP of every new or
changed function below 10.
Why: the new experiment runner needs setup steps a reader can follow with
environment variables only, and ops.md still named a single fixed dataset.

What: eval/LANGSMITH.md (setup, dataset naming, commands, scores,
metadata, tracing, free-tier note), a README details block, the ops.md
eval-record section, and this week's changelog line.

Proof: test_readme (links resolve), test_changelog, and the US English
lint pass in the full backend suite.
@MatthewK84
MatthewK84 merged commit c8e017f into main Nov 30, 2026
11 checks passed
@MatthewK84
MatthewK84 deleted the eval/langsmith-experiments branch November 30, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant