Record Class OutputGuardrailParams

java.lang.Object
java.lang.Record
io.quarkiverse.langchain4j.guardrails.OutputGuardrailParams
Record Components:
responseFromLLM - the response from the LLM
memory - the memory, can be null or empty
augmentationResult - the augmentation result, can be null
userMessageTemplate - the user message template, cannot be null
variables - the variable to be used with userMessageTemplate, cannot be null
All Implemented Interfaces:
GuardrailParams

public record OutputGuardrailParams(dev.langchain4j.data.message.AiMessage responseFromLLM, dev.langchain4j.memory.ChatMemory memory, dev.langchain4j.rag.AugmentationResult augmentationResult, String userMessageTemplate, Map<String,Object> variables) extends Record implements GuardrailParams
Represents the parameter passed to OutputGuardrail.validate(OutputGuardrailParams).
  • Constructor Details

    • OutputGuardrailParams

      public OutputGuardrailParams(dev.langchain4j.data.message.AiMessage responseFromLLM, dev.langchain4j.memory.ChatMemory memory, dev.langchain4j.rag.AugmentationResult augmentationResult, String userMessageTemplate, Map<String,Object> variables)
      Creates an instance of a OutputGuardrailParams record class.
      Parameters:
      responseFromLLM - the value for the responseFromLLM record component
      memory - the value for the memory record component
      augmentationResult - the value for the augmentationResult record component
      userMessageTemplate - the value for the userMessageTemplate record component
      variables - the value for the variables record component
  • Method Details

    • from

      public static OutputGuardrailParams from(dev.langchain4j.data.message.AiMessage responseFromLLM)
    • from

      public static OutputGuardrailParams from(dev.langchain4j.data.message.AiMessage responseFromLLM, Map<String,Object> variables)
    • withText

      public OutputGuardrailParams withText(String text)
      Description copied from interface: GuardrailParams
      Recreate this guardrail param with the given input or output text.
      Specified by:
      withText in interface GuardrailParams
      Parameters:
      text - The text of the rewritten param.
      Returns:
      A clone of this guardrail params with the given input or output text.
    • 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.
    • responseFromLLM

      public dev.langchain4j.data.message.AiMessage responseFromLLM()
      Returns the value of the responseFromLLM record component.
      Returns:
      the value of the responseFromLLM record component
    • memory

      public dev.langchain4j.memory.ChatMemory memory()
      Returns the value of the memory record component.
      Specified by:
      memory in interface GuardrailParams
      Returns:
      the value of the memory record component
    • augmentationResult

      public dev.langchain4j.rag.AugmentationResult augmentationResult()
      Returns the value of the augmentationResult record component.
      Specified by:
      augmentationResult in interface GuardrailParams
      Returns:
      the value of the augmentationResult record component
    • userMessageTemplate

      public String userMessageTemplate()
      Returns the value of the userMessageTemplate record component.
      Returns:
      the value of the userMessageTemplate record component
    • variables

      public Map<String,Object> variables()
      Returns the value of the variables record component.
      Returns:
      the value of the variables record component