Class EvaluateResult
java.lang.Object
dev.langchain4j.image_to_diagram.actions.EvaluateResult
- All Implemented Interfaces:
Function<ImageToDiagram.State,
,CompletableFuture<Map<String, Object>>> AsyncNodeAction<ImageToDiagram.State>
The EvaluateResult class is designed to evaluate and process results asynchronously,
specifically targeting the conversion of image data to diagram data using an AI chat model.
It implements the AsyncNodeAction interface, which allows for asynchronous processing
of a State object into a Map. The class leverages the OpenAiChatModel for its operations.
-
Constructor Summary
ConstructorDescriptionEvaluateResult
(dev.langchain4j.model.openai.OpenAiChatModel model) Constructor for initializing the EvaluateResult with an OpenAiChatModel. -
Method Summary
Modifier and TypeMethodDescriptionapply
(ImageToDiagram.State state) Converts an ImageToDiagram state to a diagram using theDiagramCorrectionProcess
.
-
Constructor Details
-
EvaluateResult
public EvaluateResult(dev.langchain4j.model.openai.OpenAiChatModel model) Constructor for initializing the EvaluateResult with an OpenAiChatModel.- Parameters:
model
- The instance of OpenAiChatModel to be used for processing.
-
-
Method Details
-
apply
Converts an ImageToDiagram state to a diagram using theDiagramCorrectionProcess
. This method processes the input state asynchronously and returns aCompletableFuture
with the resulting diagram data. If no results are generated, it throws aRuntimeException
.- Specified by:
apply
in interfaceAsyncNodeAction<ImageToDiagram.State>
- Specified by:
apply
in interfaceFunction<ImageToDiagram.State,
CompletableFuture<Map<String, Object>>> - Parameters:
state
- The input state for the diagram correction process.- Returns:
- A
CompletableFuture
that will contain the diagram data upon successful completion, or be completed exceptionally if an error occurs during the processing.
-