Skip to main content
A cluster groups the documents in one or more collections. A vector cluster groups by embedding similarity, so documents land together by meaning; use it to discover topics, visual styles or recurring faces. An attribute cluster groups by metadata values, like a GROUP BY; use it when a field such as category already holds the structure. Each run can name its groups with an LLM, and the results become documents you can filter, visualize, or promote into a taxonomy.

Create and run a cluster

A vector cluster needs collection_ids, vector_config.feature_uris and vector_config.clustering_method. clustering_method has no default. An attribute cluster needs only collection_ids and attribute_config (Attribute clusters).
  • collection_ids is a list, even for one collection. Replace col_products with your collection ID.
  • To name each group with an LLM, add llm_labeling (Label clusters with an LLM).
  • Each feature URI has the form mixpeek://{extractor}@{version}/{model}, and every collection in collection_ids must hold that feature. Copy it from the collection’s vector_indexes, as shown in Find the feature URI to search.
Creating a cluster runs nothing. Start a run:
cURL
The call answers at once with a task_id. Poll GET /v1/tasks/{task_id} until it is COMPLETED or FAILED. Each run has a run_id, listed by GET /v1/clusters/{cluster_id}/executions.

Read the results

Assignments are documents in the cluster’s output collections. GET /v1/clusters/{cluster_id} lists them in output_collection_ids. Each output collection holds two kinds of document: A member has its own document_id; source_document_id is the document you clustered. To find the cluster of document doc_abc123:
cURL
Filter on cluster_id instead to list the members of one cluster. The output collection holds the latest run only; export a run to keep it. With multi_feature_strategy: "independent" and several feature URIs, there is one output collection per URI.

Write groups onto your documents

Set enrich_source_collection: true on create to skip the output collection and write the group onto each source document instead, so retrievers can filter and facet on it. Each document gets cluster_id and cluster_label; source_enrichment_config.field_mappings renames them or adds more.
Cluster body excerpt
Available source fields: cluster_id, cluster_label, distance_to_centroid, member_count, keywords, the visualization coordinates x, y, z, and metadata.*. output_collection_ids then lists your source collections. To turn the groups into reusable labels for new documents, promote a run into a taxonomy with POST /v1/taxonomies/from-documents (Build a taxonomy from clusters).

Choose an algorithm

clustering_method takes one of these values. Set its parameters in vector_config.algorithm_params. The enum also accepts leiden, evoc, attribute_based and auto; see Create cluster. Start with hdbscan when you do not know the count, and kmeans when you do. A run needs at least 2 documents, at least n_clusters for K-Means and at least min_cluster_size for HDBSCAN. Below that, the run fails with Insufficient documents for clustering.

Attribute clusters

Attribute cluster body
With hierarchical_grouping: true, groups nest: Electronics contains Apple and Samsung. Without it, groups are flat: Electronics_Apple, Electronics_Samsung.

Options

Density-based algorithms over-fragment on embeddings with 1,000 or more dimensions. preprocessing_steps runs an ordered list first. Whitening followed by UMAP typically improves HDBSCAN cluster purity by 15 to 30% on those embeddings.
preprocessing_steps
With more than one feature URI, multi_feature_strategy decides how they combine.
effective_feature_method sets how a centroid is computed: mean (default), median (less sensitive to outliers) or medoid (the member closest to the center, so the centroid is a real document).
Set hierarchical: true and max_hierarchy_depth (default 3) to split broad clusters. A cluster with at least twice min_cluster_size members is split again with UMAP and HDBSCAN. Sub-cluster IDs look like cl_0_sub_1_sub_0.Filter on cluster_path to read every member under a top-level cluster. The agent search stage walks this tree.
vis_n_components is 2 (default) or 3. With 3, the z coordinate is filled and Studio draws it as dot size, from 10 to 50 px.
sample_size on the cluster or on one execute call clusters a subset, so you can tune parameters before a full run.

Label clusters with an LLM

llm_labeling sends representative documents from each cluster to a model and stores a label, a summary and keywords on each centroid. labeling_inputs.input_mappings picks which fields the model sees; without it the whole document payload is sent as JSON.
llm_labeling with text and an image
Send images or video only to a vision-capable model.

Label from a fixed list

candidate_labels makes every cluster take a label from your list: an array of labels, or a map of label to a one-line description, up to 255. This keeps labels stable across runs and across levels of a hierarchical run. With provider: "typesafe" and model_name: "jev-latest", Jev picks the label and returns a calibrated probability; it reads text only, writes no summary or keywords, and needs candidate_labels or a closed-set response_shape. Any other model answers the same question with its own confidence estimate.
candidate_labels
Each centroid then stores label_confidence, label_candidates (the top three with probabilities), label_model and label_calibrated (true for Jev).

Keep clusters current

mode on the execute call sets what a run does. A composite run is fast: a run of 10,000 documents in 50 clusters contributes 50 vectors. To run without calling execute yourself:
  • Triggers: POST /v1/clusters/triggers with trigger_type cron, interval, event or conditional and a schedule_config. See Create cluster trigger.
  • After each batch: set auto_execute_on_batch: true on the cluster. auto_execute_min_documents and auto_execute_cooldown_seconds (default 3600) bound how often it runs.

Check quality

Every run returns metrics. Check silhouette_score and noise_ratio after each run. Each member also stores cosine_similarity_to_centroid, and each centroid stores mean_cosine_similarity and min_cosine_similarity.

Clusters, taxonomies or alerts