private void setPreviousHistorySize(int historySize) {
    previousHistorySize = historySize;
    if (rootChatSession.isPresent()) {
      rootChatSession.get().previousHistorySize = historySize;
    }
  }
Sets 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