Package lumis.portal.ai.openai
Class OpenAiManager
- java.lang.Object
-
- lumis.portal.ai.openai.OpenAiManager
-
- All Implemented Interfaces:
IAiManagerSPI
public class OpenAiManager extends java.lang.Object implements IAiManagerSPI
ImplementsIAiManagerSPI
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 theEnvironmentConfiguration
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
-
Methods inherited from interface lumis.portal.ai.IAiManagerSPI
isAiEnabled
-
-
-
-
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 interfaceIAiManagerSPI
-
isAvailable
public boolean isAvailable()
Description copied from interface:IAiManagerSPI
Returns whether this AI Manager is available to be used.- Specified by:
isAvailable
in interfaceIAiManagerSPI
- Returns:
true
if this manager is available for use,false
if it is not, probably due to missing configuration.
-
onEnvironmentConfigurationUpdate
public void onEnvironmentConfigurationUpdate()
Description copied from interface:IAiManagerSPI
Called when theEnvironmentConfiguration
is updated. This is called on each server if it is a cluster environment.- Specified by:
onEnvironmentConfigurationUpdate
in interfaceIAiManagerSPI
-
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 interfaceIAiManagerSPI
- 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 interfaceIAiManagerSPI
- 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 interfaceIAiManagerSPI
- 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.
-
-