Class ChatExchange

java.lang.Object
dev.langchain4j.guardrail.ChatExchange

@Experimental public final class ChatExchange extends Object
A request sent to a chat model and the response it returned. When a response is the result of a tool-calling loop, the request is the last one sent to the model: its messages include the tool calls and tool results of all rounds. The request is null when it is not known, for example when a ChatExecutor does not override ChatExecutor.exchange(List).
Since:
1.23.0
  • Constructor Details

    • ChatExchange

      public ChatExchange(ChatRequest request, ChatResponse response)
      Parameters:
      request - the request sent to the model, or null if it is not known
      response - the response of the model
  • Method Details

    • request

      public ChatRequest request()
      Returns:
      the request sent to the model, or null if it is not known
    • response

      public ChatResponse response()
      Returns:
      the response of the model
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object