Record Class InputGuardrailParams
java.lang.Object
java.lang.Record
io.quarkiverse.langchain4j.guardrails.InputGuardrailParams
- Record Components:
userMessage- the user message, cannot benullmemory- the memory, can benullor emptyaugmentationResult- the augmentation result, can benulluserMessageTemplate- the user message template, cannot benullvariables- the variable to be used with userMessageTemplate, cannot benull
- 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 Summary
ConstructorsConstructorDescriptionInputGuardrailParams(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 aInputGuardrailParamsrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondev.langchain4j.rag.AugmentationResultReturns the value of theaugmentationResultrecord component.final booleanIndicates whether some other object is "equal to" this one.static InputGuardrailParamsfrom(dev.langchain4j.data.message.UserMessage userMessage) static InputGuardrailParamsfinal inthashCode()Returns a hash code value for this object.dev.langchain4j.memory.ChatMemorymemory()Returns the value of thememoryrecord component.static dev.langchain4j.data.message.UserMessagerewriteUserMessage(dev.langchain4j.data.message.UserMessage userMessage, String text) final StringtoString()Returns a string representation of this record class.dev.langchain4j.data.message.UserMessageReturns the value of theuserMessagerecord component.Returns the value of theuserMessageTemplaterecord component.Returns the value of thevariablesrecord component.Recreate this guardrail param with the given input or output text.
-
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 aInputGuardrailParamsrecord class.- Parameters:
userMessage- the value for theuserMessagerecord componentmemory- the value for thememoryrecord componentaugmentationResult- the value for theaugmentationResultrecord componentuserMessageTemplate- the value for theuserMessageTemplaterecord componentvariables- the value for thevariablesrecord component
-
-
Method Details
-
from
-
from
public static InputGuardrailParams from(dev.langchain4j.data.message.UserMessage userMessage, Map<String, Object> variables) -
withText
Description copied from interface:GuardrailParamsRecreate this guardrail param with the given input or output text.- Specified by:
withTextin interfaceGuardrailParams- 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
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
userMessage
public dev.langchain4j.data.message.UserMessage userMessage()Returns the value of theuserMessagerecord component.- Returns:
- the value of the
userMessagerecord component
-
memory
public dev.langchain4j.memory.ChatMemory memory()Returns the value of thememoryrecord component.- Specified by:
memoryin interfaceGuardrailParams- Returns:
- the value of the
memoryrecord component
-
augmentationResult
public dev.langchain4j.rag.AugmentationResult augmentationResult()Returns the value of theaugmentationResultrecord component.- Specified by:
augmentationResultin interfaceGuardrailParams- Returns:
- the value of the
augmentationResultrecord component
-
userMessageTemplate
Returns the value of theuserMessageTemplaterecord component.- Returns:
- the value of the
userMessageTemplaterecord component
-
variables
-