Run the full clustering pipeline.
Clustering configuration.
Adapter that fetches the vectors to cluster.
OptionalcontextUser: UserInfoUser context (required for server-side LLM naming).
A complete ClusterResult.
Persist a ClusterResult as a MJ: Cluster Analysis row plus child
MJ: Cluster Analysis Clusters rows.
The result to persist.
The config the result was produced with.
Display name + ID of the owning user.
OptionalcontextUser: UserInfoUser context for the save (required server-side).
Optionalprovider: IMetadataProviderPer-request metadata provider — REQUIRED on a multi-user server so the save uses the caller's connection/security context, not the process global. Falls back to the global only for single-provider callers (e.g. CLI).
The saved analysis ID, or null on failure.
Suggest an optimal number of clusters (K) for the given vectors using the elbow method (largest second-difference in inertia).
Vectors to analyze.
Minimum K to test (default 2).
Maximum K to test (default 10, capped at vector count - 1).
The suggested K, or 1 when there are too few vectors.
Framework-agnostic clustering engine. Instantiate directly:
const engine = new ClusteringEngine();