Class PromptingBase

java.lang.Object
org.eclnt.ccee.prompting.PromptingBase
All Implemented Interfaces:
IPrompting
Direct Known Subclasses:
PromptingOllama, PromptingWithToolsBase

public abstract class PromptingBase extends Object implements IPrompting
  • Field Details

  • Constructor Details

    • PromptingBase

      public PromptingBase()
  • Method Details

    • addMessageExtender

      public void addMessageExtender(IPromptingMessageExtender extender)
    • removeMessageExtender

      public void removeMessageExtender(IPromptingMessageExtender extender)
    • getMessageExtenders

      public Set<IPromptingMessageExtender> getMessageExtenders()
    • addMessage

      public void addMessage(PromptingMessage message)
      Description copied from interface: IPrompting
      Adds a request a message to the prompting context. This function does not trigger the sending of the message to the prompting system, but just adds it to the prompting context. Invoking the prompt processing is always done by calling IPrompting.startNewMessage(String, boolean).
      Specified by:
      addMessage in interface IPrompting
    • addInitialSystemMessage

      public void addInitialSystemMessage(String message)
      Passing context information as system message that is sent to the LLM the first time a communication is executed.
    • getWithInterimFramgents

      public boolean getWithInterimFramgents()
      If set to true, then technical interim messages are added to the response text that do not belong to the response text itself.
    • setWithInterimFramgents

      public void setWithInterimFramgents(boolean withInterimFramgents)
    • startNewMessage

      public final void startNewMessage(String text, boolean synchronous)
      Description copied from interface: IPrompting
      Adds the text to the current prompting context and starts the processing of the prompt.
      Specified by:
      startNewMessage in interface IPrompting
    • createRequestThread

      protected PromptingBase.PromptingRequestThread createRequestThread(Runnable runnable)
      In case of asynchronous message processing this is the method to create the thread in which the prompting against the LLM is executed.
    • prepareNewMessage

      public void prepareNewMessage(String text)
    • cancelCurrentRequest

      public void cancelCurrentRequest()
      Specified by:
      cancelCurrentRequest in interface IPrompting
    • addPromptingListener

      public void addPromptingListener(IPromptingListener listener)
      Description copied from interface: IPrompting
      Adds a listener to react on events from the prompting system, e.g. when a new response text is available or finished.
      Specified by:
      addPromptingListener in interface IPrompting
    • removePromptingListener

      public void removePromptingListener(IPromptingListener listener)
      Specified by:
      removePromptingListener in interface IPrompting
    • startNewMessageExecute

      protected void startNewMessageExecute(List<PromptingMessage> messages)
      Actual implementation of sending the prompt text to the LLM.
      Parameters:
      messages - All the messages of this prompting session.
    • processResponseMarkdownFragmentReceived

      protected void processResponseMarkdownFragmentReceived(String markdown)
    • processResponseCompleted

      protected void processResponseCompleted()
    • addInterimComment

      public void addInterimComment(String comment)
      Description copied from interface: IPrompting
      Allows to add a comment into the currently running message processing. The comment is embedded into the response so that the prompting user interface can show the comment to the user as part of the reponse.
      Specified by:
      addInterimComment in interface IPrompting
    • mdComment

      protected String mdComment(String s)
      Transfers a comment string into mark down format. A comment typically is less visible than normal response strings.