---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://mixpeek.com/.well-known/search?q={query}"
  method: GET
  documentation: "https://mixpeek.com/llms.txt"
---

1.  [](/)
2.  [Code examples](/recipes)
3.  Clustering & Theme Discovery

Back to code examples

Themes

# Clustering & Theme Discovery

Unsupervised clustering that groups content into semantic themes using HDBSCAN. Surfaces hidden patterns, content variants, and outliers without requiring predefined labels.

video

image

text

audio

Multi-Stage

[Run in Builder](/build?recipe=clustering-theme-discovery)

"Discover hidden themes in unlabeled user-generated content and identify outliers"

### Why This Matters

You can't search for what you don't know exists. Clustering reveals the natural structure in your content-themes, duplicates, and anomalies-before you even ask.

Python

cURL

import time

import requests

from mixpeek import Mixpeek

client \= Mixpeek(api\_key\="YOUR\_API\_KEY", namespace\="content-themes")

API \= "https://api.mixpeek.com/v1"

HEADERS \= {"Authorization": "Bearer YOUR\_API\_KEY", "X-Namespace": "content-themes"}

\# 1. A collection that embeds every image

bucket \= client.buckets.create(

    bucket\_name\="content",

    bucket\_schema\={"properties": {"image": {"type": "image"}}},

)

collection \= client.collections.create(

    collection\_name\="content",

    source\={"type": "bucket", "bucket\_ids": \[bucket\["bucket\_id"\]\]},

    feature\_extractor\={

        "feature\_extractor\_name": "multimodal\_extractor",

        "version": "v1",

    },

)

client.buckets.upload(

    bucket\["bucket\_id"\],

    blobs\=\[{"property": "image", "type": "image", "data": "s3://your-bucket/content/post-0001.jpg"}\],

)

client.collections.trigger(collection\["collection\_id"\])

\# 2. HDBSCAN finds dense groups without a preset count, and an LLM names each one.

\#    The SDK has no clusters resource, so this part is REST.

cluster \= requests.post(API + "/clusters", headers\=HEADERS, json\={

    "cluster\_name": "content-themes",

    "collection\_ids": \[collection\["collection\_id"\]\],

    "cluster\_type": "vector",

    "vector\_config": {

        "feature\_uris": \["mixpeek://multimodal\_extractor@v1/vertex\_multimodal\_embedding"\],

        "clustering\_method": "hdbscan",

        "algorithm\_params": {"min\_cluster\_size": 15},

    },

    "llm\_labeling": {"enabled": True, "provider": "openai", "model\_name": "gpt-4o-mini-2024-07-18"},

}).json()

task \= requests.post(API + "/clusters/" + cluster\["cluster\_id"\] + "/execute", headers\=HEADERS, json\={}).json()

while client.tasks.get(task\["task\_id"\])\["status"\] not in ("COMPLETED", "COMPLETED\_WITH\_ERRORS", "FAILED"):

    time.sleep(15)

\# 3. Each group carries its label, size and keywords

groups \= requests.get(API + "/clusters/" + cluster\["cluster\_id"\] + "/groups", headers\=HEADERS).json()

for group in groups\["groups"\]:

    print(group\["label"\], group\["member\_count"\], ", ".join(group.get("keywords") or \[\]))

### Feature Extractors

Multimodal Extractor

Unified embeddings for video, audio, image, and text: scene/silence chunking, Whisper transcription, thumbnails, and Gemini vision.

### Retriever Stages

### Resources Used

Clustering

[

Semantic Clusters

HDBSCAN clustering with outlier detection

HDBSCAN clustering with outlier detection



](https://mixpeek.com/docs/enrichment/clusters)

Analytics

[

Cluster Metrics

Cluster centroids and statistics

Cluster centroids and statistics



](https://mixpeek.com/docs/enrichment/clusters)

### Documentation

[Clusters](https://mixpeek.com/docs/enrichment/clusters)

## Use Cases Using This Recipe

Intermediate

Coming Soon

8 min

### Multimodal Lead Intelligence

Enrich leads with visual and behavioral signals from their content

Video, audio, decks and site pages

Lead scoring inputs

[

advertising

](/solutions/advertising)[

ecommerce

](/solutions/ecommerce)

Who It's For

B2B sales teams, demand gen marketers, and ABM platforms enriching 10K+ leads monthly

[View Details](/use-cases/multimodal-lead-intelligence)

Intermediate

Coming Soon

7 min

### Talent Intelligence & Casting

Match talent to roles using multimodal portfolio analysis

Search headshots, reels and audio by description

Casting search

[

advertising

](/solutions/advertising)[

entertainment

](/solutions/entertainment)

Who It's For

Casting directors, talent agencies, and production companies managing 10K+ talent profiles

[View Details](/use-cases/talent-intelligence-casting)

Intermediate

Coming Soon

7 min

### Social Media Content Intelligence

Analyze and optimize social content performance with multimodal AI

Creative traits searchable beside performance data

Why content performed

[

advertising

](/solutions/advertising)

Who It's For

Social media managers, content strategists, and brand teams publishing 100+ posts monthly across platforms

[View Details](/use-cases/social-media-content-intelligence)

Beginner

### Fashion Visual Product Discovery

Search for fashion by style, not just by name or brand

3x more products viewed per session

Product discovery engagement

[

ecommerce

](/solutions/ecommerce)

Who It's For

Fashion e-commerce platforms, apparel retailers, and personal styling services managing catalogs of 100K+ products where visual style drives purchase decisions

[View Details](/use-cases/fashion-visual-discovery)

Intermediate

### AI-Powered Stock Media Search

Find the perfect stock asset by describing what you envision, not what keywords to try

+45% more purchases per search session

Search-to-license conversion rate

media

Who It's For

Stock media platforms, content licensing marketplaces, and enterprise media libraries serving creative professionals who need to find specific visual and audio assets quickly

[View Details](/use-cases/stock-media-search)

## Related code examples and resources

Pages on the same stages, extractors and patterns.

[

Extractor

### Multimodal Extractor

Unified embeddings for video, audio, image, and text: scene/silence chunking, Whisper transcription, thumbnails, and Gemini vision.

Learn more





](/extractors/multimodal)[

Recipe

### Dataset Versioning

Treat versioned object storage as your dataset's source of truth. Capture complete snapshots-raw assets, embeddings, and cluster assignments-for deterministic reconstruction at any point in time.

Learn more





](/recipes/dataset-versioning)[

Recipe

### Semantic Multimodal Search

Unified semantic search across all content types. Query by natural language and retrieve relevant video clips, images, audio segments, and documents based on meaning-not keywords or manual tags.

Learn more





](/recipes/semantic-multimodal-search)[

Recipe

### Feature Extraction

Multi-tier feature extraction that decomposes content into searchable components: embeddings, transcripts, detected objects, OCR text, scene boundaries, and more. The foundation for all downstream retrieval and analysis.

Learn more





](/recipes/feature-extraction)[

Recipe

### Anomaly Detection

Identify outliers and anomalous content using embedding distance from cluster centroids. Flag quality issues, novel content, or items that don't match expected patterns.

Learn more





](/recipes/anomaly-detection)[

Recipe

### Semantic Drift Detection

Monitor distribution shifts between baseline and current data using cluster comparison. Detect when new content diverges from training data or when content mix changes unexpectedly.

Learn more





](/recipes/semantic-drift)