Record Class InputGuardrailParams

java.lang.Object
java.lang.Record
io.quarkiverse.langchain4j.guardrails.InputGuardrailParams
Record Components:
userMessage - the user message, cannot be null
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 InputGuardrailParams(dev.langchain4j.data.message.UserMessage userMessage, 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 InputGuardrail.validate(InputGuardrailParams).
  • Constructor Details

    • InputGuardrailParams

      public InputGuardrailParams(dev.langchain4j.data.message.UserMessage userMessage, dev.langchain4j.memory.ChatMemory memory, dev.langchain4j.rag.AugmentationResult augmentationResult, String userMessageTemplate, Map<String,Object> variables)
      Creates an instance of a InputGuardrailParams record class.
      Parameters:
      userMessage - the value for the userMessage 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 InputGuardrailParams from(dev.langchain4j.data.message.UserMessage userMessage)
    • from

      public static InputGuardrailParams from(dev.langchain4j.data.message.UserMessage userMessage, Map<String,Object> variables)
    • withText

      public InputGuardrailParams 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.
    • rewriteUserMessage

      public static dev.langchain4j.data.message.UserMessage rewriteUserMessage(dev.langchain4j.data.message.UserMessage userMessage, String 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.
    • userMessage

      public dev.langchain4j.data.message.UserMessage userMessage()
      Returns the value of the userMessage record component.
      Returns:
      the value of the userMessage 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