Skip to content

fix(evaluator): normalize strict response schemas - #14

Merged
3mei merged 15 commits into
mainfrom
ffrujeri/trajectory-evaluator-runtime
Oct 1, 2026
Merged

3mei merged 15 commits into
mainfrom
ffrujeri/trajectory-evaluator-runtime

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

Normalize JSON-schema response formats before UserSim sends evaluator calls to strict providers.

  • Close every nested object with additionalProperties: false.
  • Inline local $ref targets that also carry sibling constraints, preserving those siblings.
  • Leave the caller-owned schema unchanged.

This is now a focused two-file follow-up stacked on PR #15. The direct TrajectoryEvaluatorRuntime implementation and tests were removed from this PR because #15 already contains them.

How it was verified

  • uv run pytest tests/engine/core/test_llm.py tests/engine/evaluator/test_evaluator_runtime.py -q -o addopts= — 19 passed
  • uv run ruff check src/usersim/engine/core/llm.py tests/engine/core/test_llm.py — passed
  • uv run ruff format --check src/usersim/engine/core/llm.py tests/engine/core/test_llm.py — passed

make health-check was not run because this focused change does not modify a provider implementation.

Results impact

Strict providers can accept nested evaluator schemas that they previously rejected. Evaluation axes and scoring semantics are unchanged.

@ffrujeri
ffrujeri requested a review from a team as a code owner September 29, 2026 21:54
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@3mei 3mei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not depend on #15: evaluator/runtime.py imports only evaluator modules. Could it be restacked onto #12 or main so it can be reviewed on its own?

Non-blocking: _close_json_schema_objects sets additionalProperties: false on every object, including objects that declare a map (additionalProperties: {...}), and acall_llm applies it to every structured call for every provider. No current schema declares a map, but a future map-typed field could then only be {}. Could it leave objects that already declare additionalProperties unchanged?

@ffrujeri

Copy link
Copy Markdown
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@ffrujeri
ffrujeri force-pushed the ffrujeri/trajectory-evaluator-runtime branch from 85c61e3 to e0271ff Compare September 30, 2026 21:05
@ffrujeri ffrujeri changed the title feat(evaluator): add direct trajectory runtime fix(evaluator): normalize strict response schemas Sep 30, 2026
@ffrujeri

Copy link
Copy Markdown
Contributor Author

Rebased onto the current #15 head and removed the evaluator-runtime commits already absorbed there. The PR now contains only strict-schema normalization plus its regression test (2 files, 102 added lines). Focused validation: 19 passed; Ruff lint/format passed.

@3mei

3mei commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@ffrujeri This no longer depends on #15; it only touches core/llm.py and its test. Could it target main, as suggested on #10?

@ffrujeri
ffrujeri force-pushed the ffrujeri/probe-episode-runtime-v2 branch from 4fd4c80 to a4665b3 Compare October 1, 2026 02:56
Brings in the external probe episode runtime from main, so this branch differs from main only by the strict response-schema normalization.

Signed-off-by: Yev Meyer <[email protected]>
@3mei
3mei changed the base branch from ffrujeri/probe-episode-runtime-v2 to main October 1, 2026 17:15
@3mei
3mei self-requested a review October 1, 2026 17:22

@3mei 3mei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. With main merged in, this PR is now just the strict-schema normalization in acall_llm and its test: every object gets additionalProperties: false, local $refs with sibling keywords are inlined, and the caller's schema is left untouched. The new test fails on main with KeyError: 'additionalProperties' and passes here, and the full suite passes (3699).

Signed-off-by: Yev Meyer <[email protected]>
@3mei
3mei merged commit 3f75156 into main Oct 1, 2026
7 checks passed
@3mei
3mei deleted the ffrujeri/trajectory-evaluator-runtime branch October 2, 2026 20: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.

2 participants