Record Class DefaultInputGuardrailExecutedEvent

java.lang.Object
java.lang.Record
io.quarkiverse.langchain4j.audit.guardrails.internal.DefaultInputGuardrailExecutedEvent
All Implemented Interfaces:
GuardrailExecutedEvent<dev.langchain4j.guardrail.InputGuardrailRequest,dev.langchain4j.guardrail.InputGuardrailResult,dev.langchain4j.guardrail.InputGuardrail>, InputGuardrailExecutedEvent, LLMInteractionEvent

public record DefaultInputGuardrailExecutedEvent(AuditSourceInfo sourceInfo, dev.langchain4j.guardrail.InputGuardrailRequest request, dev.langchain4j.guardrail.InputGuardrailResult result, Class<dev.langchain4j.guardrail.InputGuardrail> guardrailClass) extends Record implements InputGuardrailExecutedEvent
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultInputGuardrailExecutedEvent(AuditSourceInfo sourceInfo, dev.langchain4j.guardrail.InputGuardrailRequest request, dev.langchain4j.guardrail.InputGuardrailResult result, Class<dev.langchain4j.guardrail.InputGuardrail> guardrailClass)
    Creates an instance of a DefaultInputGuardrailExecutedEvent record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    Class<dev.langchain4j.guardrail.InputGuardrail>
    Returns the value of the guardrailClass record component.
    final int
    Returns a hash code value for this object.
    dev.langchain4j.guardrail.InputGuardrailRequest
    Returns the value of the request record component.
    dev.langchain4j.guardrail.InputGuardrailResult
    Returns the value of the result record component.
    dev.langchain4j.data.message.UserMessage
    Retrieves a rewritten user message if a successful rewritten result exists.
    Returns the value of the sourceInfo record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DefaultInputGuardrailExecutedEvent

      public DefaultInputGuardrailExecutedEvent(AuditSourceInfo sourceInfo, dev.langchain4j.guardrail.InputGuardrailRequest request, dev.langchain4j.guardrail.InputGuardrailResult result, Class<dev.langchain4j.guardrail.InputGuardrail> guardrailClass)
      Creates an instance of a DefaultInputGuardrailExecutedEvent record class.
      Parameters:
      sourceInfo - the value for the sourceInfo record component
      request - the value for the request record component
      result - the value for the result record component
      guardrailClass - the value for the guardrailClass record component
  • Method Details

    • rewrittenUserMessage

      public dev.langchain4j.data.message.UserMessage rewrittenUserMessage()
      Description copied from interface: InputGuardrailExecutedEvent
      Retrieves a rewritten user message if a successful rewritten result exists. If the result contains a rewritten message, it constructs a new user message with the rewritten text; otherwise, it returns the original user message.
      Specified by:
      rewrittenUserMessage in interface InputGuardrailExecutedEvent
      Returns:
      The rewritten user message if a rewritten result exists; otherwise, the original user message.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sourceInfo

      public AuditSourceInfo sourceInfo()
      Returns the value of the sourceInfo record component.
      Specified by:
      sourceInfo in interface LLMInteractionEvent
      Returns:
      the value of the sourceInfo record component
    • request

      public dev.langchain4j.guardrail.InputGuardrailRequest request()
      Returns the value of the request record component.
      Specified by:
      request in interface GuardrailExecutedEvent<dev.langchain4j.guardrail.InputGuardrailRequest,dev.langchain4j.guardrail.InputGuardrailResult,dev.langchain4j.guardrail.InputGuardrail>
      Returns:
      the value of the request record component
    • result

      public dev.langchain4j.guardrail.InputGuardrailResult result()
      Returns the value of the result record component.
      Specified by:
      result in interface GuardrailExecutedEvent<dev.langchain4j.guardrail.InputGuardrailRequest,dev.langchain4j.guardrail.InputGuardrailResult,dev.langchain4j.guardrail.InputGuardrail>
      Returns:
      the value of the result record component
    • guardrailClass

      public Class<dev.langchain4j.guardrail.InputGuardrail> guardrailClass()
      Returns the value of the guardrailClass record component.
      Specified by:
      guardrailClass in interface GuardrailExecutedEvent<dev.langchain4j.guardrail.InputGuardrailRequest,dev.langchain4j.guardrail.InputGuardrailResult,dev.langchain4j.guardrail.InputGuardrail>
      Returns:
      the value of the guardrailClass record component