Record Class OutputGuardrailParams
java.lang.Object
java.lang.Record
io.quarkiverse.langchain4j.guardrails.OutputGuardrailParams
- Record Components:
responseFromLLM- the response from the LLMmemory- 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 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 Summary
ConstructorsConstructorDescriptionOutputGuardrailParams(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 aOutputGuardrailParamsrecord 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 OutputGuardrailParamsfrom(dev.langchain4j.data.message.AiMessage responseFromLLM) static OutputGuardrailParamsfinal inthashCode()Returns a hash code value for this object.dev.langchain4j.memory.ChatMemorymemory()Returns the value of thememoryrecord component.dev.langchain4j.data.message.AiMessageReturns the value of theresponseFromLLMrecord component.final StringtoString()Returns a string representation of this record class.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
-
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 aOutputGuardrailParamsrecord class.- Parameters:
responseFromLLM- the value for theresponseFromLLMrecord 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 OutputGuardrailParams from(dev.langchain4j.data.message.AiMessage responseFromLLM, 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.
-
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). -
responseFromLLM
public dev.langchain4j.data.message.AiMessage responseFromLLM()Returns the value of theresponseFromLLMrecord component.- Returns:
- the value of the
responseFromLLMrecord 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
-