接口 ChatModelListener


public interface ChatModelListener
A ChatLanguageModel listener that listens for requests, responses and errors.
  • 方法概要

    修饰符和类型
    方法
    说明
    default void
    This method is called when an error occurs during interaction with the model.
    default void
    This method is called before the request is sent to the model.
    default void
    This method is called after the response is received from the model.
  • 方法详细资料

    • onRequest

      default void onRequest(ChatModelRequestContext requestContext)
      This method is called before the request is sent to the model.
      参数:
      requestContext - The request context. It contains the ChatModelRequest and attributes. The attributes can be used to pass data between methods of this listener or between multiple listeners.
    • onResponse

      default void onResponse(ChatModelResponseContext responseContext)
      This method is called after the response is received from the model.
      参数:
      responseContext - The response context. It contains ChatModelResponse, corresponding ChatModelRequest and attributes. The attributes can be used to pass data between methods of this listener or between multiple listeners.
    • onError

      default void onError(ChatModelErrorContext errorContext)
      This method is called when an error occurs during interaction with the model.
      参数:
      errorContext - The error context. It contains the error, corresponding ChatModelRequest, partial ChatModelResponse (if available) and attributes. The attributes can be used to pass data between methods of this listener or between multiple listeners.