public GenerateContentResponse sendMessage(Content content) throws IOException {
    checkLastResponseAndEditHistory();
    history.add(content);
    GenerateContentResponse response;
    try {
      response = model.generateContent(history);
      setCurrentResponse(Optional.of(response));
      return autoRespond(response);
    } catch (Exception e) {
      // If any step fails, reset the history and current response.
      checkLastResponseAndEditHistory();
      revertHistory();
      throw e;
    }
  }
Sends a message to the model and returns a response.

@param content the content to be sent.
@return a response.
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ChatSession.java