Content Clustering Pipeline
Automatically group similar content together using embedding-based clustering. Discover themes, identify duplicates, and organize large content libraries.
import requestsfrom mixpeek import Mixpeekclient = Mixpeek(api_key="YOUR_API_KEY", namespace="clusters")API = "https://api.mixpeek.com/v1"HEADERS = {"Authorization": "Bearer YOUR_API_KEY", "X-Namespace": "clusters"}# 1. A bucket for articles, and a collection that embeds each onebucket = client.buckets.create(bucket_name="articles",bucket_schema={"properties": {"article": {"type": "text"}}},)collection = client.collections.create(collection_name="articles",source={"type": "bucket", "bucket_ids": [bucket["bucket_id"]]},feature_extractor={"feature_extractor_name": "text_extractor","version": "v1",},)client.buckets.upload(bucket["bucket_id"],blobs=[{"property": "article", "type": "text", "data": "s3://your-bucket/articles/cloud-costs.md"}],)client.collections.trigger(collection["collection_id"])# 2. A k-means cluster over the embeddings, with LLM-written labels. The SDK has no# clusters resource, so this is REST.cluster = requests.post(API + "/clusters", headers=HEADERS, json={"cluster_name": "article-themes","collection_ids": [collection["collection_id"]],"cluster_type": "vector","vector_config": {"feature_uris": ["mixpeek://text_extractor@v1/multilingual_e5_large_instruct_v1"],"clustering_method": "kmeans","algorithm_params": {"n_clusters": 20},},"llm_labeling": {"enabled": True, "provider": "openai", "model_name": "gpt-4o-mini-2024-07-18"},}).json()requests.post(API + "/clusters/" + cluster["cluster_id"] + "/execute", headers=HEADERS, json={})# 3. Once the execution finishes, read the groupsgroups = requests.get(API + "/clusters/" + cluster["cluster_id"] + "/groups", headers=HEADERS).json()for group in groups["groups"]:print(group)
Feature Extractors
Text Embedding
Extract semantic embeddings from documents, transcripts and text content
Retriever Stages
Frequently asked questions
How do I choose the number of clusters?
Start with 10-20 clusters and adjust based on your content volume. Mixpeek can also auto-detect the optimal number using silhouette analysis.
Can I cluster across modalities?
Yes. If documents have multimodal embeddings, clustering works across text, images, and video using shared embedding spaces.
How are cluster labels generated?
Mixpeek uses an LLM to analyze representative documents from each cluster and generate descriptive labels automatically.
Related Recipes & Resources
Explore these related resources to deepen your understanding and discover more powerful features
Text Embedding
Extract semantic embeddings from documents, transcripts and text content
Multimodal RAG Pipeline
Build a retrieval-augmented generation system that works with text, images, and video. Feed relevant multimodal context to LLMs for grounded responses.
Taxonomy Enrichment Pipeline
Automatically classify and tag content using custom taxonomies. Map your content to IAB categories, custom hierarchies, or industry-specific classifications.
Metadata Enrichment Pipeline
Automatically enrich your data with extracted metadata: entities, topics, sentiment, language, and custom attributes. Transform raw content into structured, queryable data.
Multimodal Hybrid Search Pipeline
Combine vector search with keyword search (BM25) across text, images, and video for the most comprehensive multimodal retrieval system.
Clinical Documentation Structuring
Production-grade pipeline for ingesting clinical documents, scanned charts, EHR exports, wound photos, and therapy notes, and structuring them into coded fields aligned with MDS 3.0, PDPM, and CMS audit requirements. Combines OCR, clinical NER, taxonomy classification, and hybrid retrieval to turn unstructured bedside documentation into queryable, auditable data.