Skip to main content

Module guardrail

Module guardrail 

Source
Expand description

Input and output guardrails with tripwire support.

Guardrails check input before it reaches the LLM and output before it reaches the user. A GuardrailResult::Tripwire halts execution immediately, while GuardrailResult::Warn allows execution to continue with a logged warning.

Enums§

GuardrailResult
Result of a guardrail check.

Traits§

ErasedInputGuardrail
Dyn-compatible wrapper for InputGuardrail.
ErasedOutputGuardrail
Dyn-compatible wrapper for OutputGuardrail.
InputGuardrail
Guardrail that checks input before it reaches the LLM.
OutputGuardrail
Guardrail that checks output before it reaches the user.

Functions§

run_input_guardrails
Run a sequence of input guardrails, returning the first non-Pass result.
run_output_guardrails
Run a sequence of output guardrails, returning the first non-Pass result.