Class OpenAiManager

  • All Implemented Interfaces:
    IAiManagerSPI

    public class OpenAiManager
    extends java.lang.Object
    implements IAiManagerSPI
    Implements IAiManagerSPI using OpenAI services.
    Since:
    16.0.0
    Version:
    $Revision: 25827 $ $Date: 2023-07-07 14:14:58 -0300 (Fri, 07 Jul 2023) $
    • Constructor Summary

      Constructors 
      Constructor Description
      OpenAiManager()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void init()
      Initializes this manager.
      boolean isAvailable()
      Returns whether this AI Manager is available to be used.
      void onEnvironmentConfigurationUpdate()
      Called when the EnvironmentConfiguration is updated.
      java.util.concurrent.CompletableFuture<java.lang.String> requestEditHtml​(java.lang.String inputHtml, java.lang.String instruction)
      Request AI to edit a HTML code according to the given instructions.
      java.util.concurrent.CompletableFuture<java.lang.String> requestEditHtmlText​(java.lang.String inputHtml, java.lang.String instruction)
      Request AI to edit the text inside a HTML code according to the given instructions.
      java.util.concurrent.CompletableFuture<java.lang.String> requestEditText​(java.lang.String inputText, java.lang.String instruction)
      Request AI to edit a text according to the given instructions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpenAiManager

        public OpenAiManager()
    • Method Detail

      • init

        public void init()
        Description copied from interface: IAiManagerSPI
        Initializes this manager. This method is expected to be called during the LumisXP boot process.
        Specified by:
        init in interface IAiManagerSPI
      • isAvailable

        public boolean isAvailable()
        Description copied from interface: IAiManagerSPI
        Returns whether this AI Manager is available to be used.
        Specified by:
        isAvailable in interface IAiManagerSPI
        Returns:
        true if this manager is available for use, false if it is not, probably due to missing configuration.
      • requestEditText

        public java.util.concurrent.CompletableFuture<java.lang.String> requestEditText​(java.lang.String inputText,
                                                                                        java.lang.String instruction)
                                                                                 throws PortalException
        Description copied from interface: IAiManagerSPI
        Request AI to edit a text according to the given instructions.
        Specified by:
        requestEditText in interface IAiManagerSPI
        Parameters:
        inputText - the text to edit.
        Returns:
        a future that will contain the resulting edited text.
        Throws:
        PortalException - if the operation could not be executed.
      • requestEditHtml

        public java.util.concurrent.CompletableFuture<java.lang.String> requestEditHtml​(java.lang.String inputHtml,
                                                                                        java.lang.String instruction)
                                                                                 throws PortalException
        Description copied from interface: IAiManagerSPI
        Request AI to edit a HTML code according to the given instructions.
        Specified by:
        requestEditHtml in interface IAiManagerSPI
        Parameters:
        inputHtml - the HTML code to edit.
        Returns:
        a future that will contain the resulting edited HTML code.
        Throws:
        PortalException - if the operation could not be executed.
      • requestEditHtmlText

        public java.util.concurrent.CompletableFuture<java.lang.String> requestEditHtmlText​(java.lang.String inputHtml,
                                                                                            java.lang.String instruction)
                                                                                     throws PortalException
        Description copied from interface: IAiManagerSPI
        Request AI to edit the text inside a HTML code according to the given instructions. Note that the underlying implementation may not give AI details about the HTML, so instructions that are not only about the text and that depends on the HTML structure may fail.
        Specified by:
        requestEditHtmlText in interface IAiManagerSPI
        Parameters:
        inputHtml - the HTML code to edit.
        Returns:
        a future that will contain the resulting edited HTML code.
        Throws:
        PortalException - if the operation could not be executed.