diff --git a/app/nullius/catalogue/benchmarks/tau3-bench/standard.json b/app/nullius/catalogue/benchmarks/tau3-bench/standard.json index 191acfdf..df8b0ebe 100644 --- a/app/nullius/catalogue/benchmarks/tau3-bench/standard.json +++ b/app/nullius/catalogue/benchmarks/tau3-bench/standard.json @@ -99,6 +99,7 @@ }, "simulator": { "model": "gpt-4.1-2025-04-14", + "served_as": {"openrouter": "openai/gpt-4.1"}, "says": "the customer: the upstream's own user simulator, built by its build_text_orchestrator (its guidelines and the task's scenario), its default model at its default arguments (temperature 0)" }, "leaderboard": { @@ -124,6 +125,7 @@ "says": "the upstream's own batch runner, run_tasks, on the task: its Orchestrator holds the conversation by its rules (max steps 200 and max errors 10 unless the run sets lower or other ones, the user's stop) at the trial's seed run_tasks draws, an attempt that raises is made again (3 retries) and the last recorded INFRASTRUCTURE_ERROR, which is the unit's error, never a score; its evaluator (evaluate_simulation, ALL) scores the SimulationRun the Orchestrator returns: 0 unless the user ended it (the upstream's agent never does); else the product of the task's reward_basis - the database after the agent's calls, replayed by the upstream's environment, hashes as after the gold actions (DB), each required fact is in one of the agent's messages (COMMUNICATE), the judge finds each NL assertion met (NL_ASSERTION)", "judge": { "model": "gpt-4.1-2025-04-14", + "served_as": {"openrouter": "openai/gpt-4.1"}, "says": "the upstream's NL-assertion evaluator (evaluator_nl_assertions.py, its prompt, its call and its own model name), reached through the judge's route, at temperature 0, asked only for a task whose reward_basis names NL_ASSERTION and that has assertions" } }, diff --git a/app/nullius/providers.py b/app/nullius/providers.py index ac7f1e75..f0dc8c49 100644 --- a/app/nullius/providers.py +++ b/app/nullius/providers.py @@ -312,6 +312,13 @@ def served_as(model: str, provider: str) -> str: return model +def official_as(spec: dict, provider: str) -> str: + """A benchmark's official judge or simulated user ({model, served_as?}) as ``provider`` serves it: + its own name there when the definition gives one (OpenRouter serves gpt-4.1-2025-04-14 as + openai/gpt-4.1), else ``served_as``.""" + return (spec.get("served_as") or {}).get(provider) or served_as(spec["model"], provider) + + def available(env=os.environ) -> List[str]: """The choices whose setting is set (``needs``), in the order the builder prefers them: OpenRouter, OpenAI, Anthropic, then each custom provider.""" diff --git a/app/nullius/standard/cli.py b/app/nullius/standard/cli.py index 7e9e2d01..8eb448e9 100644 --- a/app/nullius/standard/cli.py +++ b/app/nullius/standard/cli.py @@ -689,8 +689,8 @@ def _boat_units(a, b, other) -> int: words += ["--" + field.replace("_", "-"), value] # Saved price overrides belong to the launching profile, not the fresh VM. needs = definitions.option_needs(b, vals) - models = [a.model, other.get("sent"), a.judge_model or providers.served_as((b.get("score", {}).get("judge") or {}).get("model", ""), a.provider), - a.simulator_model or providers.served_as((b.get("simulator") or {}).get("model", ""), a.provider), + models = [a.model, other.get("sent"), a.judge_model or providers.official_as((b.get("score", {}).get("judge") or {"model": ""}), a.provider), + a.simulator_model or providers.official_as((b.get("simulator") or {"model": ""}), a.provider), *[providers.served_as(m, a.provider) for m in needs["embeddings"] + needs["reranker"]]] explicit = prices(a.price) for model, row in price_list.given(models, price_list.table()).items(): diff --git a/app/nullius/standard/contract/definitions.py b/app/nullius/standard/contract/definitions.py index 0b6e846a..d4b542b3 100644 --- a/app/nullius/standard/contract/definitions.py +++ b/app/nullius/standard/contract/definitions.py @@ -1719,6 +1719,7 @@ def problems(d: dict, kind: str) -> List[str]: j = s.get("judge") if j is not None and (not isinstance(j, dict) or not _MODEL_NAME.match(str(j.get("model", ""))) or not j.get("says")): bad.append("score.judge: {model: the official judge, as the provider names it; says: what it is asked}") + bad += _served_as("score.judge", j) x = s.get("experiment_judge") if x is not None and (j is not None or not isinstance(x, dict) or not x.get("label") or not x.get("says") or not _MODEL_NAME.match(str(x.get("model", "")))): @@ -1729,6 +1730,7 @@ def problems(d: dict, kind: str) -> List[str]: bad.append("simulator: {model: the official simulated user's model, as the provider names it; says: whom it plays}") elif "agent.conversation/v1" not in (needs if isinstance(needs, list) else []): bad.append("simulator: only a benchmark that needs agent.conversation/v1 has a user to simulate") + bad += _served_as("simulator", sim) bad += _controls(d.get("controls")) bad += _leaderboard(d) bad += _setups(d.get("setups")) @@ -1966,6 +1968,18 @@ def skills_shown(port: str, record: Optional[dict]) -> List[str]: return list(port_skills(port)) if on_current_kit(port, record) else [] +def _served_as(w: str, spec) -> List[str]: + """An official judge's or simulated user's ``served_as``: {provider: the name that provider serves it as}.""" + sa = spec.get("served_as") if isinstance(spec, dict) else None + if sa is None: + return [] + from nullius.providers import PROVIDERS + if not isinstance(sa, dict) or not sa or any(p not in PROVIDERS or not _MODEL_NAME.match(str(m)) + for p, m in sa.items()): + return [f"{w}.served_as: {{provider: the name it serves the model as}}"] + return [] + + def _skills(d: dict) -> List[str]: """A kit's ``basic`` and ``skills``, a benchmark's ``needs_skills``.""" bad = [] diff --git a/app/nullius/standard/pages/recipe.py b/app/nullius/standard/pages/recipe.py index 8cd5dd78..31e45125 100644 --- a/app/nullius/standard/pages/recipe.py +++ b/app/nullius/standard/pages/recipe.py @@ -701,10 +701,12 @@ def add(step, message, shown=False, field=None, unset=False): retries = 0 sim_model = str(recipe.get("simulator_model") or "").strip() like = {"paper": "Like the paper", "leaderboard": "Like the leaderboard"}.get(model_choice) + spec = {"judge": (b.get("score") or {}).get("judge"), "simulator": b.get("simulator")} for what, role, m in (("the user simulator's", "simulator", sim_model), ("the judge's", "judge", judge_model)): if m and not _MODEL.match(m): add("model", f"Enter {what} model as the provider lists it, or leave it empty for its official one.") - elif m and like and m not in (fixed[role], providers.served_as(fixed[role], provider_)): + elif m and like and m not in (fixed[role], providers.served_as(fixed[role], provider_), + providers.official_as({"model": fixed[role], **({} if lb.get(role) else spec[role] or {})}, provider_)): add("model", f"{like} uses {what} model {fixed[role]}: choose Any of your choice for {m}.") # the leaderboard's own models, as the run's provider spells them; the official ones stay the run's default sim_model = providers.served_as(lb["simulator"], provider_) if lb.get("simulator") else sim_model @@ -842,8 +844,8 @@ def add(step, message, shown=False, field=None, unset=False): judge, sim = (b.get("score") or {}).get("judge"), b.get("simulator") called = [m for x in dss for p in picks for m in ledger.models( p["o"], None if p["control"] else (p["o"].get("sent") or p.get("model")) if p.get("setup") else model, - (judge_model or providers.served_as(judge["model"], provider)) if judge else judge_model if judges else None, - (sim_model or providers.served_as(sim["model"], provider)) if sim else None, + (judge_model or providers.official_as(judge, provider)) if judge else judge_model if judges else None, + (sim_model or providers.official_as(sim, provider)) if sim else None, providers.served_as((definitions.option_needs(b, per_ds[x["id"]])["embeddings"] or [""])[0], provider), control=p["control"])] called += [providers.served_as(m, provider) for m in needs["reranker"]] missing = unpriced([m for m in dict.fromkeys(called) if isinstance(m, str) and m]) @@ -859,8 +861,8 @@ def add(step, message, shown=False, field=None, unset=False): def sent_of(p: dict) -> Dict[str, Optional[str]]: """Each model field's model as job ``p`` sends it; None where it has none (a control has no model of its own).""" return {"model": None if p["control"] else (p["o"].get("sent") or p.get("model")) if p.get("setup") else model, - "judge": (judge_model or providers.served_as(judge_def["model"], provider)) if judge_def else judge_model if judges else None, - "simulator": (sim_model or providers.served_as(sim_def["model"], provider)) if sim_def else None} + "judge": (judge_model or providers.official_as(judge_def, provider)) if judge_def else judge_model if judges else None, + "simulator": (sim_model or providers.official_as(sim_def, provider)) if sim_def else None} def called_of(p: dict) -> List[str]: s = sent_of(p) diff --git a/app/nullius/standard/runner/run.py b/app/nullius/standard/runner/run.py index 76558ca8..8c92391f 100644 --- a/app/nullius/standard/runner/run.py +++ b/app/nullius/standard/runner/run.py @@ -894,12 +894,12 @@ def __init__(self, bench: dict, other: dict, *, model: str, provider: str, datas # The official one is written as its maker spells it; the run's provider may spell it otherwise. # An experiment judge (``score.experiment_judge``) runs only when the run names its model. j = (bench.get("score") or {}).get("judge") - self.judge_model = ((judge_model or providers.served_as(j["model"], provider)) if j + self.judge_model = ((judge_model or providers.official_as(j, provider)) if j else judge_model or None if (bench.get("score") or {}).get("experiment_judge") else None) # A benchmark whose user a model plays: its driver's turns ask that model the same way, on -simulator. # A control holds no conversation, so it never asks it. sim = bench.get("simulator") - self.simulator_model = (simulator_model or providers.served_as(sim["model"], provider)) if sim else None + self.simulator_model = (simulator_model or providers.official_as(sim, provider)) if sim else None # A control (definitions.control) calls no model: its run needs a key only for the benchmark's judge. ds = [d for d in bench["datasets"] if dataset in (None, d["id"])] if not ds: diff --git a/app/tests/test_providers.py b/app/tests/test_providers.py index b72b7386..1420d5c0 100644 --- a/app/tests/test_providers.py +++ b/app/tests/test_providers.py @@ -48,6 +48,13 @@ def test_an_official_model_is_named_as_openrouter_names_it(self): ("openai/gpt-4o", "openrouter"), ("some-local-model", "openrouter")): self.assertEqual(providers.served_as(model, provider), model) + def test_an_official_model_openrouter_serves_under_another_name(self): + """OpenRouter lists gpt-4.1-2025-04-14 only as openai/gpt-4.1: the definition names it there.""" + sim = {"model": "gpt-4.1-2025-04-14", "served_as": {"openrouter": "openai/gpt-4.1"}} + self.assertEqual(providers.official_as(sim, "openrouter"), "openai/gpt-4.1") + self.assertEqual(providers.official_as(sim, "openai"), "gpt-4.1-2025-04-14") + self.assertEqual(providers.official_as({"model": "gpt-4o-2024-08-06"}, "openrouter"), "openai/gpt-4o-2024-08-06") + class Runners(unittest.TestCase): def test_the_builder_offers_harbor_and_nullius_and_says_why_another_is_gone(self): diff --git a/app/tests/test_standard_run.py b/app/tests/test_standard_run.py index efe412f8..55fd7675 100644 --- a/app/tests/test_standard_run.py +++ b/app/tests/test_standard_run.py @@ -1317,6 +1317,9 @@ def test_a_simulator_is_only_for_a_conversation(self): " ".join(definitions.problems(dict(b, simulator={"model": "u", "says": "x"}), "benchmark"))) self.assertIn("simulator: {model", " ".join(definitions.problems(dict(b, simulator={"model": "a user"}), "benchmark"))) + for bad in ({"nowhere": "x/y"}, {"openrouter": "a user"}, {}): + self.assertIn("score.judge.served_as: {provider", + " ".join(definitions.problems(dict(b, score=dict(b["score"], judge={"model": "j", "says": "x", "served_as": bad})), "benchmark"))) def test_the_container_backend_needs_no_yes_but_a_usable_engine(self): from unittest import mock diff --git a/docs/standard.md b/docs/standard.md index a5fb05ea..42eb1a19 100644 --- a/docs/standard.md +++ b/docs/standard.md @@ -443,9 +443,9 @@ An `answer` or `score` error that begins `EnvironmentSetupError: `, `VerifierErr | Field in `standard.json` | Meaning | | --- | --- | | `gated` | `true` for a benchmark whose tasks are gated: a unit's failing model endpoint (the agent's, the judge's, the simulated user's) is kept as its status and class, never the provider's words | -| `score.judge` | `{model, says}`: the official judge. Its route (`-judge`) is asked as that model, recorded beside the unit's calls, never as the agent's. `cli run --judge-model` asks another | +| `score.judge` | `{model, says, served_as?}`: the official judge. Its route (`-judge`) is asked as that model, recorded beside the unit's calls, never as the agent's. `cli run --judge-model` asks another. `served_as`: `{provider: name}` where a provider lists the model under another name | | `score.experiment_judge` | `{label, model, says}`: a judge beside the score, never in its place, on a benchmark with no official one. Runs only on `--judge-model`, on the same route; `model` is the one its source used, never a default | -| `simulator` | `{model, says}`, only with `agent.conversation/v1`: the user's model, on `-simulator`. The conversation opens with a `turn` on an empty transcript, its message after `setup`'s prompt and a blank line. A control never asks it. `cli run --simulator-model` asks another | +| `simulator` | `{model, says, served_as?}`, only with `agent.conversation/v1`: the user's model, on `-simulator`. The conversation opens with a `turn` on an empty transcript, its message after `setup`'s prompt and a blank line. A control never asks it. `cli run --simulator-model` asks another | | `leaderboard` | `{says, simulator?, judge?, bench_options?, repeat?}`: what the upstream's leaderboard fixes besides the ranked model, from its own submission rules - the user simulator's and judge's models, the benchmark's options it sets and the fewest attempts per unit. The builder then offers **Like the leaderboard** | | `limits.turns` | At most this many agent turns in a conversation (default 20; `cli run --max-turns` forces another) | | `limits.turn_seconds` | The agent's whole work on a unit, every turn of a conversation included (default 900; a task's `agent_seconds`, a setup's own `turn_seconds` or `cli run --timeout agent=` before it) |