Package dev.langchain4j.guardrail
@Experimental
package dev.langchain4j.guardrail
-
ClassDescriptionAbstractGuardrailExecutor<C extends GuardrailsConfig,
P extends GuardrailRequest<P>, R extends GuardrailResult<R>, G extends Guardrail<P, R>, F extends GuardrailResult.Failure> Abstract base class forGuardrailExecutor
s.AbstractGuardrailExecutor.GuardrailExecutorBuilder<C extends GuardrailsConfig,R extends GuardrailResult<R>, P extends GuardrailRequest<P>, G extends Guardrail<P, R>, B extends AbstractGuardrailExecutor.GuardrailExecutorBuilder<C, R, P, G, B>> A generic abstract builder class for creating instances ofGuardrailExecutor
.Generic executor interface that defines a chat interactionChatExecutor.AbstractBuilder<T extends ChatExecutor.AbstractBuilder<T>>An abstract base-builder class for constructing instances ofChatExecutor
.StreamingToSynchronousBuilder for constructing instances ofChatExecutor
.SynchronousBuilder for constructing instances ofChatExecutor
.A guardrail is a rule that is applied when interacting with an LLM either to the input (the user message) or to the output of the model to ensure that they are safe and meet the expectations of the model.Exception thrown when an input or output guardrail validation fails.GuardrailExecutor<C extends GuardrailsConfig,P extends GuardrailRequest, R extends GuardrailResult<R>, G extends Guardrail<P, R>> Represents a mechanism to execute a set of guardrails on given parameters.GuardrailRequest<P extends GuardrailRequest<P>>Represents the parameter passed toGuardrail.validate(GuardrailRequest)
} in order to validate an interaction between a user and the LLM.Represents the common parameters shared across guardrail checks when validating interactions between a user and a language model.Builder forGuardrailRequestParams
.GuardrailResult<GR extends GuardrailResult<GR>>The result of the validation of an interaction between a user and the LLM.The message and the cause of the failure of a single validation.The possible results of a guardrails validation.An input guardrail is a rule that is applied to the input of the model to ensure that the input (i.e.Exception thrown when an input guardrail validation fails.TheGuardrailExecutor
forInputGuardrail
s.Builder class for constructing instances ofInputGuardrailExecutor
.Represents the parameter passed toInputGuardrail.validate(InputGuardrailRequest)
.Builder forInputGuardrailRequest
.The result of the validation of anInputGuardrail
Represents an input guardrail failureAnOutputGuardrail
that will check whether or not a response can be successfully deserialized to an object of typeT
from JSONAn output guardrail is a rule that is applied to the output of the model to ensure that the output is safe and meets the expectations.Exception thrown when an output guardrail validation fails.TheGuardrailExecutor
forOutputGuardrail
s.Builder class for constructing instances ofOutputGuardrailExecutor
.Represents the parameter passed toOutputGuardrail.validate(OutputGuardrailRequest)
.Builder forOutputGuardrailRequest
.The result of the validation of anOutputGuardrail
Represents an output guardrail failure