Module: Phronomy::Agent::Concerns::Guardrailable Private

Included in:
Base
Defined in:
lib/phronomy/agent/concerns/guardrailable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Adds input and output guardrail support to an agent.

Included in Base. Guardrails are run on the raw input string before the LLM is called, and on the raw output string before the result is returned to the caller.

Instance Method Summary collapse

Instance Method Details

#add_input_guardrail(guardrail) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Attach a guardrail that validates input before every #invoke call.

Parameters:

Returns:

  • (self)


17
18
19
20
21
# File 'lib/phronomy/agent/concerns/guardrailable.rb', line 17

def add_input_guardrail(guardrail)
  @input_guardrails ||= []
  @input_guardrails << guardrail
  self
end

#add_output_guardrail(guardrail) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Attach a guardrail that validates output before it is returned.

Parameters:

Returns:

  • (self)


27
28
29
30
31
# File 'lib/phronomy/agent/concerns/guardrailable.rb', line 27

def add_output_guardrail(guardrail)
  @output_guardrails ||= []
  @output_guardrails << guardrail
  self
end