Interface LlmStreamCallback

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface LlmStreamCallback
Callback interface for receiving streaming chat responses from LLM.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onChunk(String chunk, boolean done)
    Called for each chunk of the streaming response.
    default void
    Called when an error occurs during streaming.
  • Method Details

    • onChunk

      void onChunk(String chunk, boolean done)
      Called for each chunk of the streaming response.
      Parameters:
      chunk - the text chunk from the LLM response
      done - true if this is the final chunk
    • onError

      default void onError(Throwable error)
      Called when an error occurs during streaming.
      Parameters:
      error - the error that occurred