Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/art/rewards/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .ruler import ruler, ruler_score_group
from .ruler import DEFAULT_RUBRIC, ruler, ruler_score_group

__all__ = ["ruler", "ruler_score_group"]
__all__ = ["DEFAULT_RUBRIC", "ruler", "ruler_score_group"]
16 changes: 12 additions & 4 deletions src/art/rewards/ruler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def ruler(
message_lists: list[list[ChatCompletionMessageParam]],
judge_model: str = "openai/o3",
extra_litellm_params: dict | None = None,
rubric: str = DEFAULT_RUBRIC,
rubric: str | None = DEFAULT_RUBRIC,
tools: list | None = None,
*,
debug: bool = False,
Expand All @@ -81,7 +81,8 @@ async def ruler(
- "anthropic/claude-3-opus-20240229" - Alternative judge
extra_litellm_params: Additional parameters to pass to LiteLLM completion.
Can include temperature, max_tokens, etc.
rubric: The grading rubric. The default rubric works well for most tasks.
rubric: The grading rubric, or None to use DEFAULT_RUBRIC.
The default rubric works well for most tasks.
tools: Optional list of tool definitions available to the agent. When provided,
the judge will see which tools were available when evaluating tool usage.
debug: If True, pretty-print the judge's reasoning to help understand scores.
Expand All @@ -103,6 +104,9 @@ async def ruler(
0.9
"""

if rubric is None:
rubric = DEFAULT_RUBRIC

# Short-circuit for the trivial case
if not message_lists:
return []
Expand Down Expand Up @@ -230,7 +234,7 @@ async def ruler_score_group(
group: art.TrajectoryGroup,
judge_model: str = "openai/o3",
extra_litellm_params: dict | None = None,
rubric: str = DEFAULT_RUBRIC,
rubric: str | None = DEFAULT_RUBRIC,
*,
swallow_exceptions: bool = False,
debug: bool = False,
Expand All @@ -251,7 +255,8 @@ async def ruler_score_group(
group: A TrajectoryGroup containing trajectories to score.
judge_model: The model to use for judging. See `ruler` for options.
extra_litellm_params: Additional parameters to pass to LiteLLM completion.
rubric: Custom rubric or use the default which works well for most tasks.
rubric: Custom rubric, or None to use DEFAULT_RUBRIC. The default works well
for most tasks.
swallow_exceptions: If True, returns None on errors instead of raising.
This is recommended for production to handle API failures gracefully.
debug: If True, prints the judge's reasoning.
Expand All @@ -272,6 +277,9 @@ async def ruler_score_group(
For complete documentation and examples, see: https://art.openpipe.ai/fundamentals/ruler
"""

if rubric is None:
rubric = DEFAULT_RUBRIC

# Validate that we don't have additional histories (not yet supported)
for traj in group.trajectories:
if len(traj.additional_histories) > 0:
Expand Down