Package org.eclnt.ccee.prompting
Class PromptingBase
java.lang.Object
org.eclnt.ccee.prompting.PromptingBase
- All Implemented Interfaces:
IPrompting
- Direct Known Subclasses:
PromptingOllama,PromptingWithToolsBase
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassDefault implementation of Thread that is created in case of asynchronous message processing within methodcreateRequestThread(Runnable). -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInitialSystemMessage(String message) Passing context information as system message that is sent to the LLM the first time a communication is executed.voidaddInterimComment(String comment) Allows to add a comment into the currently running message processing.voidaddMessage(PromptingMessage message) Adds a request a message to the prompting context.voidaddMessageExtender(IPromptingMessageExtender extender) voidaddPromptingListener(IPromptingListener listener) Adds a listener to react on events from the prompting system, e.g. when a new response text is available or finished.voidprotected PromptingBase.PromptingRequestThreadcreateRequestThread(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.booleanIf set to true, then technical interim messages are added to the response text that do not belong to the response text itself.protected StringTransfers a comment string into mark down format.voidprepareNewMessage(String text) protected voidprotected voidvoidvoidremovePromptingListener(IPromptingListener listener) voidsetWithInterimFramgents(boolean withInterimFramgents) final voidstartNewMessage(String text, boolean synchronous) Adds the text to the current prompting context and starts the processing of the prompt.protected voidstartNewMessageExecute(List<PromptingMessage> messages) Actual implementation of sending the prompt text to the LLM.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclnt.ccee.prompting.IPrompting
postIsolatedPrompt
-
Field Details
-
m_listeners
-
-
Constructor Details
-
PromptingBase
public PromptingBase()
-
-
Method Details
-
addMessageExtender
-
removeMessageExtender
-
getMessageExtenders
-
addMessage
Description copied from interface:IPromptingAdds 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 callingIPrompting.startNewMessage(String, boolean).- Specified by:
addMessagein interfaceIPrompting
-
addInitialSystemMessage
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
Description copied from interface:IPromptingAdds the text to the current prompting context and starts the processing of the prompt.- Specified by:
startNewMessagein interfaceIPrompting
-
createRequestThread
In case of asynchronous message processing this is the method to create the thread in which the prompting against the LLM is executed. -
prepareNewMessage
-
cancelCurrentRequest
public void cancelCurrentRequest()- Specified by:
cancelCurrentRequestin interfaceIPrompting
-
addPromptingListener
Description copied from interface:IPromptingAdds a listener to react on events from the prompting system, e.g. when a new response text is available or finished.- Specified by:
addPromptingListenerin interfaceIPrompting
-
removePromptingListener
- Specified by:
removePromptingListenerin interfaceIPrompting
-
startNewMessageExecute
Actual implementation of sending the prompt text to the LLM.- Parameters:
messages- All the messages of this prompting session.
-
processResponseMarkdownFragmentReceived
-
processResponseCompleted
protected void processResponseCompleted() -
addInterimComment
Description copied from interface:IPromptingAllows 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:
addInterimCommentin interfaceIPrompting
-
mdComment
Transfers a comment string into mark down format. A comment typically is less visible than normal response strings.
-