Interface StreamingChatResponseHandler
-
- All Implemented Interfaces:
public interface StreamingChatResponseHandlerTODO review all javadoc in this class Represents a handler for streaming a response from a StreamingChatLanguageModel.
-
-
Method Summary
Modifier and Type Method Description abstract voidonPartialResponse(String partialResponse)Invoked each time the model generates a partial response (usually a single token) in a textual response. abstract voidonCompleteResponse(ChatResponse completeResponse)Invoked when the model has finished streaming a response. abstract voidonError(Throwable error)This method is invoked when an error occurs during streaming. -
-
Method Detail
-
onPartialResponse
abstract void onPartialResponse(String partialResponse)
Invoked each time the model generates a partial response (usually a single token) in a textual response. If the model decides to execute a tool instead, this method will not be invoked; onCompleteResponse will be invoked instead.
- Parameters:
partialResponse- The partial response (usually a single token), which is a part of the complete response.
-
onCompleteResponse
abstract void onCompleteResponse(ChatResponse completeResponse)
Invoked when the model has finished streaming a response. If the model requests the execution of one or multiple tools, this can be accessed via aiMessage ->toolExecutionRequests.
- Parameters:
completeResponse- The complete response generated by the model.
-
-
-
-