Class: Phronomy::Guardrail::InputGuardrail

Inherits:
Base
  • Object
show all
Defined in:
lib/phronomy/guardrail/input_guardrail.rb

Overview

Guardrail applied to agent/chain input before it reaches the LLM.

Examples:

class NoCreditCardGuardrail < Phronomy::Guardrail::InputGuardrail
  def check(input)
    fail!("Credit card numbers are not allowed") if input.to_s.match?(/\d{4}[- ]\d{4}[- ]\d{4}[- ]\d{4}/)
  end
end

agent = MyAgent.new
agent.add_input_guardrail(NoCreditCardGuardrail.new)

Method Summary

Methods inherited from Base

#check, #run!