Package dev.langchain4j.image_to_diagram
Class ImageToDiagramProcess
java.lang.Object
dev.langchain4j.image_to_diagram.ImageToDiagramProcess
- All Implemented Interfaces:
ImageToDiagram
Class for processing images to generate diagrams.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Represents an image that can be identified by a URL or encapsulated as data.Nested classes/interfaces inherited from interface dev.langchain4j.image_to_diagram.ImageToDiagram
ImageToDiagram.EvaluationResult, ImageToDiagram.State
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.bsc.async.AsyncGenerator<NodeOutput<ImageToDiagram.State>>
execute
(@NonNull ImageToDiagramProcess.ImageUrlOrData imageData) Executes the workflow using the provided image data and returns a stream of NodeOutput objects.org.bsc.async.AsyncGenerator<NodeOutput<ImageToDiagram.State>>
executeWithCorrection
(@NonNull ImageToDiagramProcess.ImageUrlOrData imageData) Executes the workflow with correction for the given image data.workflow()
Generates a workflow graph using the StateGraph framework with specific nodes and conditional edges.This method orchestrates a workflow for processing diagrams.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.langchain4j.image_to_diagram.ImageToDiagram
getModel, getVisionModel
-
Constructor Details
-
ImageToDiagramProcess
public ImageToDiagramProcess()
-
-
Method Details
-
workflow
Generates a workflow graph using the StateGraph framework with specific nodes and conditional edges.- Returns:
- A configured StateGraph instance representing the workflow.
- Throws:
Exception
- if an error occurs during the configuration of the graph.
-
workflowWithCorrection
This method orchestrates a workflow for processing diagrams. It initializes a state graph and adds nodes and subgraphs to represent different stages of diagram correction and translation. The method also sets up conditional edges based on the type of diagram being translated.- Returns:
- A StateGraph object representing the complete workflow diagram.
- Throws:
Exception
- if any errors occur during the setup of the workflow.
-
execute
public org.bsc.async.AsyncGenerator<NodeOutput<ImageToDiagram.State>> execute(@NonNull @NonNull ImageToDiagramProcess.ImageUrlOrData imageData) throws Exception Executes the workflow using the provided image data and returns a stream of NodeOutput objects.- Parameters:
imageData
- The image data to be processed, which must not be null.- Returns:
- A stream of NodeOutput objects generated by the workflow.
- Throws:
Exception
- if an error occurs during execution.
-
executeWithCorrection
public org.bsc.async.AsyncGenerator<NodeOutput<ImageToDiagram.State>> executeWithCorrection(@NonNull @NonNull ImageToDiagramProcess.ImageUrlOrData imageData) throws Exception Executes the workflow with correction for the given image data.- Parameters:
imageData
- The image data to process, cannot be null.- Returns:
- An asynchronous generator of node outputs.
- Throws:
Exception
- If an error occurs during execution.
-