org.llm4s.agent.guardrails.builtin.JSONValidator
See theJSONValidator companion object
Validates that output is valid JSON matching an optional schema.
This guardrail ensures that LLM output is properly formatted JSON, which is useful when requesting structured data from the agent.
Value parameters
-
schema
-
Optional JSON schema to validate against (minimal subset)
Attributes
-
Companion
-
object
-
Graph
-
-
Supertypes
-
class Object
trait Matchable
class Any
Members list
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
-
Definition Classes
-
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
Optional description of what this guardrail validates.
Optional description of what this guardrail validates.
Attributes
Name of this guardrail for logging and error messages.
Name of this guardrail for logging and error messages.
Attributes