Skip to content

Commit 6bd33e6

Browse files
corbtclaude
andcommitted
refactor: Split litellm_completion_params into judge_model and extra_litellm_params
- Changed ruler() and ruler_score_group() to accept separate judge_model (str) and extra_litellm_params (dict) parameters - Updated all call sites to use the new signature - Updated documentation with new parameter structure and examples - Removed backward compatibility as this is a new feature 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent cfc4d87 commit 6bd33e6

File tree

5 files changed

+2937
-137
lines changed

5 files changed

+2937
-137
lines changed

docs/fundamentals/ruler.mdx

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ group = art.TrajectoryGroup([...]) # List of art.Trajectory objects
4646
# Use RULER to score them
4747
judged_group = await ruler_score_group(
4848
group,
49-
{"model": "openai/o3"},
49+
"openai/o3",
5050
debug=True # Shows the judge's reasoning
5151
)
5252

@@ -111,7 +111,7 @@ async def main():
111111

112112
# Create a TrajectoryGroup and use RULER to score
113113
group = art.TrajectoryGroup([good_trajectory, mediocre_trajectory, off_topic_trajectory])
114-
judged_group = await ruler_score_group(group, {"model": "openai/o3"}, debug=True)
114+
judged_group = await ruler_score_group(group, "openai/o3", debug=True)
115115

116116
# Display rankings
117117
if judged_group:
@@ -164,13 +164,33 @@ You can use any LLM supported by LiteLLM as the judge:
164164

165165
```python
166166
# Using o4-mini
167-
await ruler_score_group(group, {"model": "openai/o4-mini"})
167+
await ruler_score_group(group, "openai/o4-mini")
168168

169169
# Using Claude
170-
await ruler_score_group(group, {"model": "anthropic/claude-sonnet-4-20250514"})
170+
await ruler_score_group(group, "anthropic/claude-sonnet-4-20250514")
171171

172172
# Using local models
173-
await ruler_score_group(group, {"model": "ollama/qwen3:32b"})
173+
await ruler_score_group(group, "ollama/qwen3:32b")
174+
```
175+
176+
### Extra LiteLLM Parameters
177+
178+
You can pass additional parameters to LiteLLM for fine-tuning the judge behavior:
179+
180+
```python
181+
# Adjust temperature and max tokens
182+
await ruler_score_group(
183+
group,
184+
"openai/o3",
185+
extra_litellm_params={"temperature": 0.7, "max_tokens": 1000}
186+
)
187+
188+
# Use custom API base for local models
189+
await ruler_score_group(
190+
group,
191+
"openai/gpt-4",
192+
extra_litellm_params={"api_base": "http://localhost:8000"}
193+
)
174194
```
175195

176196
### Custom Rubric
@@ -186,7 +206,7 @@ custom_rubric = """
186206

187207
await ruler_score_group(
188208
group,
189-
{"model": "openai/o3"},
209+
"openai/o3",
190210
rubric=custom_rubric
191211
)
192212
```
@@ -210,7 +230,7 @@ message_lists = [
210230

211231
scores = await ruler(
212232
message_lists,
213-
{"model": "openai/o3"}
233+
"openai/o3"
214234
)
215235

216236
for score in scores:
@@ -245,7 +265,7 @@ groups = await art.gather_trajectory_groups(
245265
),
246266
after_each=lambda group: ruler_score_group(
247267
group,
248-
{"model": "openai/o3"},
268+
"openai/o3",
249269
swallow_exceptions=True # Return None on error, filtering out the group
250270
)
251271
)

examples/art-e/art_e/test_ruler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def main():
5454

5555
judged_group = await ruler_score_group(
5656
group,
57-
{"model": "openai/o3"},
57+
"openai/o3",
5858
debug=True,
5959
)
6060

examples/art-e/art_e/train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def judge_after_each(
8383

8484
return await ruler_score_group(
8585
group,
86-
{"model": model.config.group_judge_model},
86+
model.config.group_judge_model,
8787
swallow_exceptions=True,
8888
)
8989

0 commit comments

Comments
 (0)