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 benull
or emptyaugmentationResult
- the augmentation result, can benull
userMessageTemplate
- the user message template, cannot benull
variables
- 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 aOutputGuardrailParams
record class. -
Method Summary
Modifier and TypeMethodDescriptiondev.langchain4j.rag.AugmentationResult
Returns the value of theaugmentationResult
record component.final boolean
Indicates whether some other object is "equal to" this one.static OutputGuardrailParams
from
(dev.langchain4j.data.message.AiMessage responseFromLLM) static OutputGuardrailParams
final int
hashCode()
Returns a hash code value for this object.dev.langchain4j.memory.ChatMemory
memory()
Returns the value of thememory
record component.dev.langchain4j.data.message.AiMessage
Returns the value of theresponseFromLLM
record component.final String
toString()
Returns a string representation of this record class.Returns the value of theuserMessageTemplate
record component.Returns the value of thevariables
record 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 aOutputGuardrailParams
record class.- Parameters:
responseFromLLM
- the value for theresponseFromLLM
record componentmemory
- the value for thememory
record componentaugmentationResult
- the value for theaugmentationResult
record componentuserMessageTemplate
- the value for theuserMessageTemplate
record componentvariables
- the value for thevariables
record component
-
-
Method Details
-
from
-
from
public static OutputGuardrailParams from(dev.langchain4j.data.message.AiMessage responseFromLLM, Map<String, Object> variables) -
withText
Description copied from interface:GuardrailParams
Recreate this guardrail param with the given input or output text.- Specified by:
withText
in 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 theresponseFromLLM
record component.- Returns:
- the value of the
responseFromLLM
record component
-
memory
public dev.langchain4j.memory.ChatMemory memory()Returns the value of thememory
record component.- Specified by:
memory
in interfaceGuardrailParams
- Returns:
- the value of the
memory
record component
-
augmentationResult
public dev.langchain4j.rag.AugmentationResult augmentationResult()Returns the value of theaugmentationResult
record component.- Specified by:
augmentationResult
in interfaceGuardrailParams
- Returns:
- the value of the
augmentationResult
record component
-
userMessageTemplate
Returns the value of theuserMessageTemplate
record component.- Returns:
- the value of the
userMessageTemplate
record component
-
variables
-