private void revertHistory() {
    history.subList(getPreviousHistorySize(), history.size()).clear();
  }
Reverts the history to the previous state.
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ChatSession.java