Scorers
JSONCorrectness
The JSONCorrectness
scorer is a default scorer that checks whether your LLM’s actual_output
matches your JSON schema.
Required Fields
To run the JSONCorrectness
scorer, you must include the following fields in your Example
:
input
actual_output
Scorer Breakdown
JSONCorrectness
scores are calculated with a binary score representing whether the actual_output
matches the JSON schema.
To define a JSON schema, you can define a pydantic
BaseModel
and pass it to the JSONCorrectness
scorer.
example_schema.py
Sample Implementation
json_correctness.py