Interface ChatPhaseCallback


public interface ChatPhaseCallback
Callback interface for receiving notifications about chat processing phases. Used for SSE streaming to notify clients about the current processing state.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Phase name for answer generation
    static final String
    Phase name for result evaluation
    static final String
    Phase name for content retrieval
    static final String
    Phase name for intent detection
    static final String
    Phase name for document search
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a no-op callback implementation.
    void
    onChunk(String content, boolean done)
    Called when a chunk of the response is available during streaming.
    void
    onError(String phase, String error)
    Called when an error occurs during processing.
    void
    Called when a processing phase completes.
    void
    onPhaseStart(String phase, String message)
    Called when a processing phase starts.
    default void
    onPhaseStart(String phase, String message, String keywords)
    Called when a processing phase starts with additional context data.
  • Field Details

  • Method Details

    • onPhaseStart

      void onPhaseStart(String phase, String message)
      Called when a processing phase starts.
      Parameters:
      phase - the phase name (e.g., "intent", "search", "evaluate", "fetch", "answer")
      message - a human-readable message describing what's happening
    • onPhaseStart

      default void onPhaseStart(String phase, String message, String keywords)
      Called when a processing phase starts with additional context data.
      Parameters:
      phase - the phase name (e.g., "intent", "search", "evaluate", "fetch", "answer")
      message - a human-readable message describing what's happening
      keywords - the search keywords (for search phase)
    • onPhaseComplete

      void onPhaseComplete(String phase)
      Called when a processing phase completes.
      Parameters:
      phase - the phase name that completed
    • onChunk

      void onChunk(String content, boolean done)
      Called when a chunk of the response is available during streaming.
      Parameters:
      content - the content chunk
      done - true if this is the final chunk
    • onError

      void onError(String phase, String error)
      Called when an error occurs during processing.
      Parameters:
      phase - the phase where the error occurred
      error - the error message
    • noOp

      static ChatPhaseCallback noOp()
      Returns a no-op callback implementation.
      Returns:
      a callback that does nothing