Skip to content

Re-export assert_output_satisfies from the testing package - #506

Merged
ambiorix2099 merged 2 commits into
mainfrom
agentspan-evals
Sep 22, 2026
Merged

ambiorix2099 merged 2 commits into
mainfrom
agentspan-evals

Conversation

@ambiorix2099

@ambiorix2099 ambiorix2099 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • from conductor.ai.agents.testing import assert_output_satisfies raised ImportError, though semantic.py's own module docstring documents exactly that import.
  • Root cause: testing/__init__.py never imported semantic, and the name was absent from __all__, so neither the documented import nor from conductor.ai.agents.testing import * resolved it.
  • Fix: add the import and the __all__ entry, matching how every other assertion in the package is exposed. semantic.py is untouched.
  • Re-exporting the module does not make litellm a hard dependency of the testing package. It is imported lazily inside assert_output_satisfies, and a new test pins that.

User impact

Anyone following the docstring got an ImportError and had to go find the submodule path (conductor.ai.agents.testing.semantic) before they had working code.

Changes

  • testing/__init__.py: import assert_output_satisfies from semantic, and add it to __all__
  • tests/unit/ai/test_testing_semantic.py: new; covers threshold pass and fail, the judge reason reaching the assertion message, an unparseable reply failing rather than passing, and a missing litellm raising with an install hint. It imports through the package, which is the path the docstring documents, so a missing re-export fails collection

Tested with pytest tests/unit/ai: 1818 pass, five of them new.

Fixes #502

The import shown in semantic.py's own module docstring raised ImportError:
testing/__init__.py never imported the module, and the name was absent from
__all__, so neither the documented import nor a star import resolved it.

Adds the import and the __all__ entry, matching how every other assertion in
the package is exposed. semantic.py imports litellm lazily inside the function,
so the package-level import does not turn that optional dependency into a hard
one -- a test pins that invariant in a subprocess.
@ambiorix2099
ambiorix2099 marked this pull request as ready for review September 14, 2026 18:37
Replaces the export and star-import assertions with tests for what
assert_output_satisfies actually does: threshold pass and fail, the judge
reason reaching the assertion message, an unparseable reply failing rather
than passing, and a missing litellm raising with an install hint.

The tests import through the package rather than the submodule, which is the
path semantic.py's docstring documents, so a missing re-export fails collection
without asserting on __all__ directly. litellm is stubbed via sys.modules,
following test_guardrail.py.
@ambiorix2099
ambiorix2099 merged commit aab0250 into main Sep 22, 2026
6 checks passed
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.

The documented import for assert_output_satisfies raises ImportError

2 participants