Class AbstractJsonExtractorOutputGuardrail
java.lang.Object
io.quarkiverse.langchain4j.guardrails.AbstractJsonExtractorOutputGuardrail
- All Implemented Interfaces:
Guardrail<OutputGuardrailParams,,OutputGuardrailResult> OutputGuardrail
public abstract class AbstractJsonExtractorOutputGuardrail
extends Object
implements OutputGuardrail
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectdeserialize(String llmResponse) protected StringgetInvalidJsonMessage(dev.langchain4j.data.message.AiMessage aiMessage, String json) protected StringgetInvalidJsonReprompt(dev.langchain4j.data.message.AiMessage aiMessage, String json) protected Class<?> protected com.fasterxml.jackson.core.type.TypeReference<?> protected OutputGuardrailResultinvokeInvalidJson(dev.langchain4j.data.message.AiMessage aiMessage, String json) validate(dev.langchain4j.data.message.AiMessage responseFromLLM) Validates the response from the LLM.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.quarkiverse.langchain4j.guardrails.OutputGuardrail
failure, failure, fatal, fatal, reprompt, reprompt, retry, retry, success, successWith, successWith, validate
-
Constructor Details
-
AbstractJsonExtractorOutputGuardrail
protected AbstractJsonExtractorOutputGuardrail()
-
-
Method Details
-
validate
Description copied from interface:OutputGuardrailValidates the response from the LLM.- Specified by:
validatein interfaceOutputGuardrail- Parameters:
responseFromLLM- the response from the LLM
-
invokeInvalidJson
protected OutputGuardrailResult invokeInvalidJson(dev.langchain4j.data.message.AiMessage aiMessage, String json) -
getInvalidJsonMessage
-
getInvalidJsonReprompt
-
deserialize
-
getOutputClass
-
getOutputType
protected com.fasterxml.jackson.core.type.TypeReference<?> getOutputType()
-