Class AIController

java.lang.Object
org.imixs.workflow.office.forms.AIController
All Implemented Interfaces:
Serializable

@Named("aiController") @ConversationScoped public class AIController extends Object implements Serializable
The AIController integrates the imixs-ai module providing a AI Chat history. The method 'sendAsync' can be used to stream a prompt. This feature is used by the front end component 'workitem.ai.xhtml' to display the life-answering. After the answer was received completely the method automatically updates the workitem '' The method buildContextPrompt creates a complex prompt based on a given question and the workflow information stored in the current workitem.
Author:
rsoika
See Also:
  • Field Details

    • ERROR_PROMPT_TEMPLATE

      public static final String ERROR_PROMPT_TEMPLATE
      See Also:
    • ERROR_PROMPT_INFERENCE

      public static final String ERROR_PROMPT_INFERENCE
      See Also:
    • AI_CHAT_HISTORY

      public static final String AI_CHAT_HISTORY
      See Also:
    • AI_STREAM_EOS

      public static final String AI_STREAM_EOS
      See Also:
    • workflowController

      @Inject protected org.imixs.workflow.faces.data.WorkflowController workflowController
    • chronicleController

      @Inject protected ChronicleController chronicleController
    • userController

      @Inject protected org.imixs.marty.profile.UserController userController
    • loginController

      @Inject protected org.imixs.workflow.faces.util.LoginController loginController
  • Constructor Details

    • AIController

      public AIController()
  • Method Details

    • getChatHistory

      public List<org.imixs.workflow.ItemCollection> getChatHistory()
      Returns the chat history in reverse order. Used by the frontend component
      Returns:
    • onWorkflowEvent

      public void onWorkflowEvent(@Observes org.imixs.workflow.faces.data.WorkflowEvent workflowEvent)
      WorkflowEvent listener If a new WorkItem was created or changed, the imixs.ai.chat.history view will be initialized or updated.
      Parameters:
      workflowEvent -
    • sendAsync

      public void sendAsync() throws org.imixs.workflow.exceptions.PluginException
      Sends an asynchronous prompt '{"prompt": "Building a website","n_predict": 128}'
      Throws:
      org.imixs.workflow.exceptions.PluginException
    • isStreamingComplete

      public boolean isStreamingComplete()
    • getStreamResult

      public String getStreamResult()