Interface ChatModelListener
public interface ChatModelListener
A
ChatLanguageModel
listener that listens for requests, responses and errors.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
onError
(ChatModelErrorContext errorContext) This method is called when an error occurs during interaction with the model.default void
onRequest
(ChatModelRequestContext requestContext) This method is called before the request is sent to the model.default void
onResponse
(ChatModelResponseContext responseContext) This method is called after the response is received from the model.
-
Method Details
-
onRequest
This method is called before the request is sent to the model.- Parameters:
requestContext
- The request context. It contains theChatModelRequest
and attributes. The attributes can be used to pass data between methods of this listener or between multiple listeners.
-
onResponse
This method is called after the response is received from the model.- Parameters:
responseContext
- The response context. It containsChatModelResponse
, correspondingChatModelRequest
and attributes. The attributes can be used to pass data between methods of this listener or between multiple listeners.
-
onError
This method is called when an error occurs during interaction with the model.- Parameters:
errorContext
- The error context. It contains the error, correspondingChatModelRequest
, partialChatModelResponse
(if available) and attributes. The attributes can be used to pass data between methods of this listener or between multiple listeners.
-