Skip to content

feat(vitest-evals): support a direct meta.eval.input, mirroring meta.eval.output - #2318

Open
Aislinn Cronin (aislinnnnn) wants to merge 3 commits into
braintrustdata:mainfrom
aislinnnnn:aislinnnnn/vitest-evals-direct-input
Open

feat(vitest-evals): support a direct meta.eval.input, mirroring meta.eval.output#2318
Aislinn Cronin (aislinnnnn) wants to merge 3 commits into
braintrustdata:mainfrom
aislinnnnn:aislinnnnn/vitest-evals-direct-input

Conversation

@aislinnnnn

Copy link
Copy Markdown

What this PR does

Adds meta.eval.input to the vitest-evals reporter, as a direct passthrough for an eval row's input field — the same way meta.eval.output already works.

Why

Today the eval-level root span's input can only be populated via harness.run.session.messages, specifically the first entry with role: "user" (firstUserMessageContent()). That's a reasonable default for conversational harnesses, but it forces any harness whose input isn't a conversation (e.g. a structured payload, a single scalar) to fabricate a synthetic { role: "user", content: ... } message just to get anything into input at all.

This is inconsistent with the rest of this same file:

  • meta.eval.output already supports a direct passthrough (input.output !== undefined ? { output: input.output } : {} in readEvalMeta) — there's no equivalent for input.
  • logToolCallSpans in this file sets event: { input: call.arguments } directly, no message-shape required.
  • The classic Eval() framework (js/src/framework.ts) does event: { input: datum.input } — a direct, arbitrary passthrough, which is the norm for the rest of the SDK.

Changes

  • EvalMeta gains an input?: unknown field, alongside the existing output?: unknown.
  • readEvalMeta reads input.input the same way it already reads input.output.
  • logEvalTest computes const input = meta.eval?.input ?? firstUserMessageContent(run);meta.eval.input takes precedence when present, falling back to the existing session-derived behavior when it's not. Fully backward compatible: nothing changes for consumers that only set harness.run.session.messages.
  • Adds a test covering both the direct-passthrough case and the fallback case.

Testing

  • pnpm vitest run src/wrappers/vitest-evals/reporter.test.ts — all 6 tests pass (5 existing + 1 new).
  • pnpm run fix:formatting — clean.
  • Added a changeset (minor, per the existing convention for new fields).

🤖 Generated with Claude Code

…eval.output

The eval-level root span's `input` field could only be populated via
harness.run.session.messages (the first message with role: "user"),
via firstUserMessageContent(). That forces any non-conversational
harness to fabricate a synthetic message just to surface its real
input, even though meta.eval.output already supports a direct
passthrough for the symmetric case, and logToolCallSpans in this same
file already does `input: call.arguments` with no such indirection.

Add meta.eval.input as a direct passthrough that takes precedence over
session.messages when present, falling back to the existing
firstUserMessageContent(run) behavior when it's not set — so existing
consumers relying on session.messages are unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The changeset described the internal shape (eval task meta,
harness.run.session.messages) without ever naming the reporter it
affects, unlike other changesets in this repo that name the concrete
integration in the title.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@AbhiPrasad

Copy link
Copy Markdown
Member

thanks for the PR Aislinn Cronin (@aislinnnnn). We'll take a look at this on monday!

The comment restated what the code and PR description already say.
Test data used our internal domain fields (memberUuid, payPeriodEnd)
instead of this file's existing refund/invoice fixtures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

2 participants