diff --git a/CHANGELOG.md b/CHANGELOG.md index 125b868d1..3c6d633df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Add optional `content` parameter to `ModelOutput.for_tool_call()`. - Display total samples in Inspect View - Prune `sample_reductions` when returning eval logs with `header_only=True`. +- Improved error message for undecorated solvers. - For simple matching scorers, only include explanation if it differs from answer. ## v0.3.39 (3 October 2024) diff --git a/src/inspect_ai/_util/registry.py b/src/inspect_ai/_util/registry.py index 90cf98ddb..f60c73f2d 100644 --- a/src/inspect_ai/_util/registry.py +++ b/src/inspect_ai/_util/registry.py @@ -233,11 +233,15 @@ def registry_info(o: object) -> RegistryInfo: Returns: RegistryInfo for object. """ - info = getattr(o, REGISTRY_INFO) - if info: + info = getattr(o, REGISTRY_INFO, None) + if info is not None: return cast(RegistryInfo, info) else: - raise ValueError("Object does not have registry info") + name = getattr(o, "__name__", "unknown") + decorator = " @solver " if name == "solve" else "" + raise ValueError( + f"Object '{name}' does not have registry info. Did you forget to add a{decorator}decorator somewhere?" + ) def registry_params(o: object) -> dict[str, Any]: