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 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

      public Map<String,Object> apply(ImageToDiagram.State state) throws Exception
      Applies the translation logic to the given ImageToDiagram.State object.
      Specified by:
      apply in interface NodeAction<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.