Class DefaultGuardrailExecutedEvent<P extends GuardrailRequest<P>, R extends GuardrailResult<R>, G extends Guardrail<P,R>, E extends GuardrailExecutedEvent<P,R,G>>
java.lang.Object
dev.langchain4j.observability.event.AbstractAiServiceEvent
dev.langchain4j.observability.event.DefaultGuardrailExecutedEvent<P,R,G,E>
- Type Parameters:
P
- the type of guardrail parameters used in the validation processR
- the type of guardrail result produced by the validation processG
- the type of guardrail class used in the validation process
- All Implemented Interfaces:
AiServiceEvent, GuardrailExecutedEvent<P,
R, G>
- Direct Known Subclasses:
DefaultInputGuardrailExecutedEvent, DefaultOutputGuardrailExecutedEvent
public abstract class DefaultGuardrailExecutedEvent<P extends GuardrailRequest<P>, R extends GuardrailResult<R>, G extends Guardrail<P,R>, E extends GuardrailExecutedEvent<P,R,G>>
extends AbstractAiServiceEvent
implements GuardrailExecutedEvent<P,R,G>
Represents an event that is executed when a guardrail validation occurs.
This interface serves as a marker for events that contain both parameters
and results associated with guardrail validation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface AiServiceEvent
AiServiceEvent.Builder<T>
Nested classes/interfaces inherited from interface GuardrailExecutedEvent
GuardrailExecutedEvent.GuardrailExecutedEventBuilder<P,
R, G, T> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DefaultGuardrailExecutedEvent
(GuardrailExecutedEvent.GuardrailExecutedEventBuilder<P, R, G, E> builder) -
Method Summary
Methods inherited from class AbstractAiServiceEvent
invocationContext
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface AiServiceEvent
eventClass, invocationContext, toBuilder
-
Constructor Details
-
DefaultGuardrailExecutedEvent
protected DefaultGuardrailExecutedEvent(GuardrailExecutedEvent.GuardrailExecutedEventBuilder<P, R, G, E> builder)
-
-
Method Details
-
request
Description copied from interface:GuardrailExecutedEvent
Retrieves the request used for input guardrail validation.- Specified by:
request
in interfaceGuardrailExecutedEvent<P extends GuardrailRequest<P>, R extends GuardrailResult<R>, G extends Guardrail<P,
R>> - Returns:
- the parameters containing user message, memory, augmentation result, user message template, and associated variables for input guardrail validation.
-
result
Description copied from interface:GuardrailExecutedEvent
Retrieves the result of the input guardrail validation process.- Specified by:
result
in interfaceGuardrailExecutedEvent<P extends GuardrailRequest<P>, R extends GuardrailResult<R>, G extends Guardrail<P,
R>> - Returns:
- the result of the input guardrail validation, including the validation outcome and any associated failures, if present.
-
guardrailClass
Description copied from interface:GuardrailExecutedEvent
Retrieves the guardrail class associated with the validation process.- Specified by:
guardrailClass
in interfaceGuardrailExecutedEvent<P extends GuardrailRequest<P>, R extends GuardrailResult<R>, G extends Guardrail<P,
R>> - Returns:
- the guardrail class that implements the logic for validating
the interaction between user and LLM, represented as an instance
of the type extending
Guardrail<P, R>
.
-