Judges¶
Evaluators that determine trial winners.
MetricsJudge¶
orc.judges.metrics_judge.MetricsJudge
¶
Judge that evaluates based on objective metrics.
Uses configurable weights for different metrics to calculate a final score for each submission.
Example
judge = MetricsJudge( weights={"accuracy": 0.5, "latency": 0.3, "cost": 0.2}, accuracy_checker=my_accuracy_function, )
verdict = await judge.evaluate(task, submissions)
Source code in orc/judges/metrics_judge.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
__init__(weights=None, accuracy_checker=None, latency_threshold_ms=5000, cost_threshold=0.1)
¶
Initialize the Metrics Judge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weights
|
Optional[Dict[str, float]]
|
Metric weights (must sum to 1.0). |
None
|
accuracy_checker
|
Optional[Callable]
|
Function to check result accuracy (returns 0.0-1.0). |
None
|
latency_threshold_ms
|
int
|
Latency above this gets score 0. |
5000
|
cost_threshold
|
float
|
Cost above this gets score 0. |
0.1
|
Source code in orc/judges/metrics_judge.py
evaluate(task, submissions)
async
¶
Evaluate submissions based on metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
The original task description. |
required |
submissions
|
List[Submission]
|
List of agent submissions. |
required |
Returns:
| Type | Description |
|---|---|
Verdict
|
Verdict with the winner and scores. |
Source code in orc/judges/metrics_judge.py
LLMJudge¶
orc.judges.llm_judge.LLMJudge
¶
Judge that uses an LLM to evaluate submissions.
The LLM compares agent outputs based on specified criteria and determines which agent performed better.
Example
llm = OllamaProvider(model="qwen2.5:72b") judge = LLMJudge( llm, criteria=["accuracy", "completeness", "efficiency"], )
verdict = await judge.evaluate(task, submissions)
Source code in orc/judges/llm_judge.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
__init__(llm, criteria=None, system_prompt=None)
¶
Initialize the LLM Judge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
llm
|
LLMProvider
|
LLM provider for evaluation. |
required |
criteria
|
Optional[List[str]]
|
Evaluation criteria (default: accuracy, completeness, clarity). |
None
|
system_prompt
|
Optional[str]
|
Custom system prompt for evaluation. |
None
|
Source code in orc/judges/llm_judge.py
evaluate(task, submissions)
async
¶
Evaluate submissions and determine a winner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
The original task description. |
required |
submissions
|
List[Submission]
|
List of agent submissions (typically 2). |
required |
Returns:
| Type | Description |
|---|---|
Verdict
|
Verdict with the winner and reasoning. |
Source code in orc/judges/llm_judge.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
ConsensusJudge¶
orc.judges.consensus_judge.ConsensusJudge
¶
Judge that aggregates votes from multiple sub-judges.
Useful for reducing bias and increasing reliability.
Example
judge = ConsensusJudge([ LLMJudge(llm1), LLMJudge(llm2), MetricsJudge(), ])
verdict = await judge.evaluate(task, submissions)
Source code in orc/judges/consensus_judge.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
__init__(judges, require_majority=True, tiebreaker='first')
¶
Initialize the Consensus Judge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
judges
|
List[Judge]
|
List of judges to vote. |
required |
require_majority
|
bool
|
If True, winner needs >50% votes. |
True
|
tiebreaker
|
str
|
How to break ties ("first" judge, "random", or specific judge name). |
'first'
|
Source code in orc/judges/consensus_judge.py
evaluate(task, submissions)
async
¶
Evaluate by collecting votes from all judges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
The original task description. |
required |
submissions
|
List[Submission]
|
List of agent submissions. |
required |
Returns:
| Type | Description |
|---|---|
Verdict
|
Verdict with the consensus winner. |
Source code in orc/judges/consensus_judge.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |