Skip to content

Commit

Permalink
improved error message for undecorated solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Oct 5, 2024
1 parent 0af777a commit 94b2855
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 7 additions & 3 deletions src/inspect_ai/_util/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 94b2855

Please sign in to comment.