InputGuardrail

org.llm4s.agent.guardrails.InputGuardrail
trait InputGuardrail extends Guardrail[String]

Validates user input before agent processing.

Input guardrails run BEFORE the LLM is called, validating:

  • User queries
  • System prompts
  • Tool arguments

Attributes

Graph
Supertypes
trait Guardrail[String]
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Concrete methods

def transform(input: String): String

Optional: Transform the input after validation. Default is identity (no transformation).

Optional: Transform the input after validation. Default is identity (no transformation).

Value parameters

input

The validated input

Attributes

Returns

The transformed input

Inherited methods

def andThen(other: Guardrail[String]): Guardrail[String]

Compose this guardrail with another sequentially.

Compose this guardrail with another sequentially.

The second guardrail runs only if this one passes.

Value parameters

other

The guardrail to run after this one

Attributes

Returns

A composite guardrail that runs both in sequence

Inherited from:
Guardrail
def description: Option[String]

Optional description of what this guardrail validates.

Optional description of what this guardrail validates.

Attributes

Inherited from:
Guardrail

Inherited and Abstract methods

def name: String

Name of this guardrail for logging and error messages.

Name of this guardrail for logging and error messages.

Attributes

Inherited from:
Guardrail
def validate(value: String): Result[String]

Validate a value.

Validate a value.

This is a PURE FUNCTION - no side effects allowed. Same input always produces same output.

Value parameters

value

The value to validate

Attributes

Returns

Right(value) if valid, Left(error) if invalid

Inherited from:
Guardrail