code: def test_index_clustering(
      ndim, metric, quantization, dtype, batch_size
  ):
      index = Index(
          ndim=ndim, metric=metric, dtype=quantization, multi=False
      )
      keys = np.arange(batch_size)
      vectors = random_vectors(count=batch_size, ndim=ndim, dtype=dtype)
      index.add(keys, vectors, threads=threads)
  
      clusters: Clustering = index.cluster(
          vectors=vectors, threads=threads
      )
      assert len(clusters.matches.keys) == batch_size
  
      # If no argument is provided, we cluster the present entries
      clusters: Clustering = index.cluster(threads=threads)
      assert len(clusters.matches.keys) == batch_size
  
      # If no argument is provided, we cluster the present entries
      clusters: Clustering = index.cluster(
          keys=keys[:50], threads=threads
      )
      assert len(clusters.matches.keys) == 50
  
      # If no argument is provided, we cluster the present entries
      clusters: Clustering = index.cluster(
          min_count=3, max_count=10, threads=threads
      )
      unique_clusters = set(clusters.matches.keys.flatten().tolist())
      assert len(unique_clusters) >= 3 and len(unique_clusters) <= 10
  
file_path: usearch/python/scripts/test_index.py
imports: import os
  import pytest
  import numpy
  from usearch.io import load_matrix, save_matrix
  from usearch.eval import random_vectors
  from usearch.index import search
  from usearch.index import Index, MetricKind, ScalarKind, Match, Matches, BatchMatches, Clustering
  from usearch.index import DEFAULT_CONNECTIVITY
label_desc: Use image node_id 8 for calling a global function with example usage: test_index_clustering(ndim, metric, quantization, dtype, batch_size) without return types