Interface StreamingChatResponseHandler

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract void onPartialResponse(String partialResponse) Invoked each time the model generates a partial response (usually a single token) in a textual response.
      abstract void onCompleteResponse(ChatResponse completeResponse) Invoked when the model has finished streaming a response.
      abstract void onError(Throwable error) This method is invoked when an error occurs during streaming.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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.
      • onError

         abstract void onError(Throwable error)

        This method is invoked when an error occurs during streaming.

        Parameters:
        error - The error that occurred