LLM Judge¶
Low-level LLM-as-a-judge helpers used by
LLMJudge. These wrap a pydantic_ai.Agent and
return a structured GradingOutput.
GradingOutput¶
ragpill.llm_judge.GradingOutput
¶
Bases: BaseModel
Structured output from the LLM judge.
Attributes:
| Name | Type | Description |
|---|---|---|
reason |
str
|
Human-readable explanation of the verdict. |
pass_ |
bool
|
Whether the output passes the rubric. Aliased to |
score |
float
|
Continuous score in |
judge_output¶
ragpill.llm_judge.judge_output
async
¶
Judge a task output against a rubric.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
Any
|
The task output to grade. |
required |
rubric
|
str
|
Rubric describing what "passing" means for this output. |
required |
model
|
Model | KnownModelName | str
|
The pydantic-ai model to use for grading. |
required |
model_settings
|
ModelSettings | None
|
Optional pydantic-ai |
None
|
Returns:
| Type | Description |
|---|---|
GradingOutput
|
A |
Example
Source code in src/ragpill/llm_judge.py
judge_input_output¶
ragpill.llm_judge.judge_input_output
async
¶
Judge a task output against a rubric given the inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Any
|
The task inputs included alongside the output in the prompt. |
required |
output
|
Any
|
The task output to grade. |
required |
rubric
|
str
|
Rubric describing what "passing" means for this output. |
required |
model
|
Model | KnownModelName | str
|
The pydantic-ai model to use for grading. |
required |
model_settings
|
ModelSettings | None
|
Optional pydantic-ai |
None
|
Returns:
| Type | Description |
|---|---|
GradingOutput
|
A |
Example
Source code in src/ragpill/llm_judge.py
See Also¶
LLMJudge— the high-level evaluator that wraps these functions.