Class: Phronomy::Guardrail::OutputGuardrail

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

Overview

Guardrail applied to agent/chain output before it is returned to the caller.

Examples:

class NoSecretsGuardrail < Phronomy::Guardrail::OutputGuardrail
  def check(output)
    fail!("Response contains a secret key") if output.to_s.match?(/sk-[A-Za-z0-9]{32,}/)
  end
end

agent = MyAgent.new
agent.add_output_guardrail(NoSecretsGuardrail.new)

Method Summary

Methods inherited from Base

#check, #run!