public void setMaxFunctionCalls(int maxFunctionCalls) {
    this.maxFunctionCalls = maxFunctionCalls;
    this.remainingFunctionCalls = this.maxFunctionCalls;
  }
Sets the maximum number of function calls to make in a row.
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/AutomaticFunctionCallingResponder.java