private int getPreviousHistorySize() {
    if (rootChatSession.isPresent()) {
      return rootChatSession.get().previousHistorySize;
    }
    return previousHistorySize;
  }
Returns the previous history size of the root chat session (if exists) or the current chat
session.
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ChatSession.java