Repository navigation
Conversation
architecture/probes.md lists every public method of BaseProbe, BankBackedProbe and the six mixins in its hook table, with where each is called, and every class attribute and classmethod in a new table, with its default and what reads it. tests/test_reference_docs.py fails when a public name on those classes has no row, when a row names nothing they define, when a method sits outside the hook table, or when a documented default value differs from the class. BaseProbe defines should_inline_judge_user_turn and should_inline_judge_assistant_turn, and AgenticMixin overrides the first, but nothing calls either. The tables, the authoring guide, the docstrings and the agentic template say so. Signed-off-by: Yev Meyer <ymeyer@nvidia.com>
tests/test_probe_names_in_shared_code.py counts the built-in probe labels written as string constants in src/usersim/ outside engine/probes/, docstrings excluded, file by file. A file over its allowance in _ALLOWED fails with every occurrence listed, and an allowance above the count fails too, so a label taken out cannot come back. architecture/probes.md points at the test from the declarations table, and the authoring guide says a scorer registered under its probe label adds its module to the allowances. Signed-off-by: Yev Meyer <ymeyer@nvidia.com>
…nsion API from usersim.extension exports 59 names: the probe classes, mixins and register_probe, the conversation and outcome types, the core model aliases and acall_llm, the prompt, locale and tool-call helpers, register_scorer, and the capability, asset-domain and backend types. Each is imported from the module that defines it on first use, so an asset domain or backend importing from it does not load the conversation loop, and usersim --help stays fast. docs/extension_api.md lists every name in usersim.extension and usersim.testing. tests/test_extension_api.py checks both modules against the page, each name against the module that defines it, the imports a type checker reads against the runtime map, and in a subprocess that importing an asset domain or backend leaves the loop unloaded. Signed-off-by: Yev Meyer <ymeyer@nvidia.com>
docs/extensions.md, architecture/plugins.md, the authoring guide, the probe templates and the make check-extensions fixture import from usersim.extension and usersim.testing, and every import in them is absolute, as ruff requires. CONTRIBUTING.md names the two modules and links the page that lists their names. The guide's worked example loads its bank through the probe's assets_dir(), from a folder named for its label, and the test template checks registration with assert_probe_conforms. tests/test_extension_api.py fails when one of these examples imports another usersim module, apart from a listed few: the modules of the in-tree example, the test template's standard tests, which patch the loop's model calls, and the fixture's probe built on identity_disclosure. Signed-off-by: Yev Meyer <ymeyer@nvidia.com>
docs/extensions.md builds an extension package, my_bookings, and the authoring guide's worked example builds the same probe in tree, as bookings. A simulated user asks an assistant that has a book_appointment(date, time, people) tool to book a tour. The en_US and pt_BR banks both open with 04/03/2027, which is 3 April to the first user and 4 March to the second, and the user gives the number of people only when the assistant asks. The probe answers the tool call through ToolExecutionMixin, records the first booking, and lets a conversation end only once the assistant has booked. The extension's scorer checks each argument against what the user meant and whether the assistant asked before booking, and its tests run an episode in pt_BR offline. The in-tree version adds what a built-in probe needs: a LocalePromptPack, a WarningKind member, the BUILTIN_PROBE_MODULES entry and an asset_problems check. Signed-off-by: Yev Meyer <ymeyer@nvidia.com>
Every example of a name an extension adds starts with my_, the prefix of the package docs/extensions.md builds: the warning kind in architecture/plugins.md and the authoring guide, the example in the error for a malformed warning kind, and the warning kinds, metadata keys and scorer names in the tests that stand in for an extension. Signed-off-by: Yev Meyer <ymeyer@nvidia.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
An extension imports from one module,
usersim.extension, and its tests import fromusersim.testing. A reference page lists every name the two export. Tests keep the probe reference tables, that page and the examples an author copies in step with the code, and limit how often shared code names a built-in probe, so what a probe needs from the core goes on its class.Builds on #112.
Every probe hook and declaration documented (first commit).
architecture/probes.mdlists every public method ofBaseProbe,BankBackedProbeand the six mixins with where it is called, and every class attribute and classmethod with its default and what reads it.tests/test_reference_docs.pyfails when a public name has no row, when a row names nothing the classes define, when a method sits outside the hook table, or when a documented default differs from the class.should_inline_judge_user_turnandshould_inline_judge_assistant_turnare defined onBaseProbe, but nothing calls them. The tables, the authoring guide, the docstrings and the agentic template say so.Probe labels in shared code (second commit).
tests/test_probe_names_in_shared_code.pycounts the built-in probe labels written as strings insrc/usersim/outsideengine/probes/, docstrings excluded, file by file: 88 in 24 files.architecture/probes.mdpoints at the test, and the authoring guide says a scorer registered under its probe's label adds its module to the allowances.usersim.extension(third commit). 59 names:register_probe;acall_llmand the run's settings;register_scorerand the empty-cell helpers;Each name is imported from the module that defines it on first use.
usersim --helpimports every installed asset domain and backend to list them, and an extension that importsAssetDomainfrom here loads the asset-domain registry, not the conversation loop or Data Designer. Type checkers read ordinary imports and a literal__all__.docs/extension_api.mdlists every name inusersim.extensionandusersim.testing, and says the listed names can change in any release.tests/test_extension_api.pychecks both modules against the page, each name against the module that defines it, the type-checker imports against the runtime map, and, in a subprocess, that importing the asset-domain and backend types leaves the loop unloaded.Examples import the public API (fourth commit).
docs/extensions.md,architecture/plugins.md, the authoring guide, the probe templates and themake check-extensionsfixture import fromusersim.extensionandusersim.testing, and every import in them is absolute, as ruff requires.assets_dir(), from a folder named for its label.assert_probe_conforms.usersimmodule, apart from a listed few: the modules of the in-tree example, the test template's standard tests, which patch the loop's model calls, and the fixture's probe built onidentity_disclosure.CONTRIBUTING.mdpoints at the reference page.A multilingual tool-calling example (fifth commit).
docs/extensions.mdbuilds an extension package,my_bookings, and the authoring guide's worked example builds the same probe in tree, asbookings. A simulated user asks an assistant that has abook_appointment(date, time, people)tool to book a tour.en_USandpt_BRbanks both open with04/03/2027, which is 3 April to the first user and 4 March to the second. The user gives the number of people only when the assistant asks.ToolExecutionMixin, records the first booking with how many user turns came before it, and lets a conversation end only once the assistant has booked.pt_BRoffline and score a month-first reading of the Brazilian date as wrong.LocalePromptPack, aWarningKindmember, theBUILTIN_PROBE_MODULESentry and anasset_problemscheck.One example prefix (sixth commit). Every example of a name an extension adds starts with
my_, the prefix of the packagedocs/extensions.mdbuilds: the warning kind inarchitecture/plugins.mdand the authoring guide, the error for a malformed warning kind, and the warning kinds, metadata keys and scorer names in the tests that stand in for an extension.How it was verified
At the head commit:
Each commit passes
make check-all && make test && make smokeon its own: 4622 tests after the first, 4624 after the second, 4630 after the third, and 4631 after each of the last three.Each new test fails on the breakage it guards against, checked by breaking a copy:
usersimimport in a code block that does not parse, a listed exception no example makes, and a nameusersim.extensiondoes not export.The new tests pass three times in parallel, and serially after the tests that register and restore probes.
The example package in
docs/extensions.mdmatches the guide's code blocks byte for byte, and its five tests pass offline. Installed next tousersim, it is listed byusersim smokeas the guide shows:The in-tree example, copied file for file from the authoring guide into a copy of the source, passes
assert_probe_conforms, runs an episode in each locale with scripted models and through a host with the same result, and reports a missingpt_BRbank fromasset_problems. A--dry-runin another locale stops before any model call:The in-tree example ran live against a custom provider config: three
pt_BRrows at four turns, every request succeeding, each row recording the booking the assistant made.make health-checkwas not run: no shipped model, provider, prompt, scorer or stored data changes.