Interface StreamObserver<R extends Response<?>>
- Type Parameters:
R- The type of Response in the stream.
public interface StreamObserver<R extends Response<?>>
A simple interface for observing a stream of values, typically used for
asynchronous token streaming from an AI model.
- Author:
- anahata-gemini-pro-2.5
-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when the stream has completed successfully.voidCalled when an error occurs in the stream.voidCalled when a new value is available in the stream.voidonStart(List<? extends AbstractModelMessage> candidates) Called when the stream starts, providing the initial candidate messages.
-
Method Details
-
onStart
Called when the stream starts, providing the initial candidate messages.- Parameters:
candidates- The list of candidate messages that will be updated.
-
onNext
Called when a new value is available in the stream.- Parameters:
value- The next value.
-
onComplete
void onComplete()Called when the stream has completed successfully. -
onError
Called when an error occurs in the stream.- Parameters:
t- The error that occurred.
-

