public interface StreamingResponseHandler<T>
| Modifier and Type | Method and Description |
|---|---|
default void |
onComplete(Response<T> response)
Invoked when the language model has finished streaming a response.
|
void |
onError(Throwable error)
This method is invoked when an error occurs during streaming.
|
void |
onNext(String token)
Invoked each time the language model generates a new token in a textual response.
|
void onNext(String token)
onComplete(dev.langchain4j.model.output.Response<T>) will be invoked instead.token - The newly generated token, which is a part of the complete response.default void onComplete(Response<T> response)
AiMessage.toolExecutionRequest().response - The complete response generated by the language model.
For textual responses, it contains all tokens from onNext(java.lang.String) concatenated.void onError(Throwable error)
error - The error that occurredCopyright © 2023. All rights reserved.