Class TranslateGenericDiagramToPlantUML
java.lang.Object
dev.langchain4j.image_to_diagram.actions.TranslateGenericDiagramToPlantUML
- All Implemented Interfaces:
NodeAction<ImageToDiagram.State>
public class TranslateGenericDiagramToPlantUML
extends Object
implements NodeAction<ImageToDiagram.State>
TranslateGenericDiagramToPlantUML class implementation.
This class implements the NodeAction<ImageToDiagram.State> interface and is responsible for translating a generic diagram to PlantUML code.
-
Constructor Summary
ConstructorDescriptionTranslateGenericDiagramToPlantUML
(@NonNull dev.langchain4j.model.openai.OpenAiChatModel model) Constructor to initialize the TranslateGenericDiagramToPlantUML object with a provided OpenAiChatModel instance. -
Method Summary
Modifier and TypeMethodDescriptionapply
(ImageToDiagram.State state) Applies the translation logic to the given ImageToDiagram.State object.
-
Constructor Details
-
TranslateGenericDiagramToPlantUML
public TranslateGenericDiagramToPlantUML(@NonNull @NonNull dev.langchain4j.model.openai.OpenAiChatModel model) Constructor to initialize the TranslateGenericDiagramToPlantUML object with a provided OpenAiChatModel instance.- Parameters:
model
- The non-null OpenAiChatModel instance.
-
-
Method Details
-
apply
Applies the translation logic to the given ImageToDiagram.State object.- Specified by:
apply
in interfaceNodeAction<ImageToDiagram.State>
- Parameters:
state
- The current state of the image diagram conversion process.- Returns:
- A map containing the translated PlantUML code as key "diagramCode".
- Throws:
Exception
- If an error occurs during the translation process, e.g., if no diagram is provided.
-