Glider
any_guardrail.guardrails.glider.glider
Glider
Bases: HuggingFace
A prompt based guardrail from Patronus AI that utilizes pass criteria and a rubric to judge text.
For more information, see the model card:GLIDER. It outputs its reasoning, highlights for what determined the score, and an integer score.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
str | None
|
HuggingFace path to model. |
None
|
pass_criteria
|
str
|
A question or description of what you are validating. |
required |
rubric
|
str
|
A scoring rubric, describing to the model how to score the provided data. |
required |
Raise
ValueError: Can only use model path to GLIDER from HuggingFace.
Source code in src/any_guardrail/guardrails/glider/glider.py
__init__(pass_criteria, rubric, model_id=None)
Initialize the GLIDER guardrail.
Source code in src/any_guardrail/guardrails/glider/glider.py
validate(input_text, output_text=None)
Use the provided pass criteria and rubric to judge the input and output text provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_text
|
str
|
the initial text. |
required |
output_text
|
str | None
|
the subsequent text. |
None
|
Returns:
Type | Description |
---|---|
GuardrailOutput
|
An explanation in the format provided by the system prompt. |