Interface StreamingResponseHandler


public interface StreamingResponseHandler
Handler interface for processing streaming responses from Vertex AI Anthropic API.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onChunk(String jsonChunk)
    Called for each chunk of streaming response data.
    void
    Called when streaming completes successfully.
    void
    Called when an error occurs during streaming.
    default void
    Called with the complete response metadata (for token usage, etc.).
  • Method Details

    • onResponse

      default void onResponse(AnthropicResponse response)
      Called with the complete response metadata (for token usage, etc.).
      Parameters:
      response - The complete response with metadata
    • onChunk

      void onChunk(String jsonChunk)
      Called for each chunk of streaming response data.
      Parameters:
      jsonChunk - The JSON response chunk as a string
    • onComplete

      void onComplete()
      Called when streaming completes successfully.
    • onError

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