---
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.  Multimodal Content Moderation

Back to code examples

# Multimodal Content Moderation

Automated content moderation pipeline that analyzes text, images, and video for policy violations. Uses hierarchical taxonomy classification to label content as safe, sensitive, or prohibited across multiple categories simultaneously.

text

image

video

Multi-Stage

[Run in Builder](/build?recipe=multimodal-content-moderation)

Python

cURL

import requests

from mixpeek import Mixpeek

client \= Mixpeek(api\_key\="YOUR\_API\_KEY", namespace\="moderation")

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

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

\# 1. Policy exemplars: images labeled safe, sensitive or prohibited

example\_bucket \= client.buckets.create(

    bucket\_name\="policy-examples",

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

)

examples \= client.collections.create(

    collection\_name\="policy-examples",

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

    feature\_extractor\={

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

        "version": "v1",

    },

)

client.buckets.upload(

    example\_bucket\["bucket\_id"\],

    blobs\=\[{"property": "image", "type": "image", "data": "s3://your-bucket/policy/prohibited-weapons-01.jpg"}\],

)

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

\# 2. The retriever the taxonomy uses to find the closest exemplar

matcher \= client.retrievers.create(

    retriever\_name\="policy-matcher",

    collection\_identifiers\=\["policy-examples"\],

    input\_schema\={"query": {"type": "text", "required": True}},

    stages\=\[

        {

            "stage\_name": "search",

            "stage\_id": "feature\_search",

            "parameters": {

                "searches": \[

                    {

                        "feature\_uri": "mixpeek://multimodal\_extractor@v1/vertex\_multimodal\_embedding",

                        "query": {"input\_mode": "text", "value": "{{INPUT.query}}"},

                        "top\_k": 3,

                    },

                \],

                "final\_top\_k": 3,

            },

        },

    \],

)

\# A flat taxonomy matches each document, through a retriever, against a

\# collection of labeled examples. The SDK has no taxonomies resource, so this is REST.

taxonomy \= requests.post(API + "/taxonomies", headers\=HEADERS, json\={

    "taxonomy\_name": "content\_moderation",

    "config": {

        "taxonomy\_type": "flat",

        "retriever\_id": matcher\["retriever\_id"\],

        "input\_mappings": \[{"input\_key": "query", "source\_type": "payload", "path": "description"}\],

        "source\_collection": {"collection\_id": examples\["collection\_id"\]},

    },

}).json()

\# 3. User content, labeled at query time, with an LLM check for the borderline cases

bucket \= client.buckets.create(

    bucket\_name\="user-content",

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

)

uploads \= client.collections.create(

    collection\_name\="user-content",

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

    feature\_extractor\={

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

        "version": "v1",

        "parameters": {

            "run\_video\_description": True,

        },

    },

)

moderation \= client.retrievers.create(

    retriever\_name\="moderation-review",

    collection\_identifiers\=\["user-content"\],

    input\_schema\={"image": {"type": "image", "required": True}},

    stages\=\[

        {

            "stage\_name": "search",

            "stage\_id": "feature\_search",

            "parameters": {

                "searches": \[

                    {

                        "feature\_uri": "mixpeek://multimodal\_extractor@v1/vertex\_multimodal\_embedding",

                        "query": {"input\_mode": "content", "value": "{{INPUT.image}}"},

                        "top\_k": 20,

                    },

                \],

                "final\_top\_k": 20,

            },

        },

        {"stage\_name": "label", "stage\_id": "taxonomy\_enrich", "parameters": {"taxonomy\_id": taxonomy\["taxonomy\_id"\], "top\_k": 1}},

        {"stage\_name": "borderline", "stage\_id": "llm\_filter", "parameters": {"criteria": "Keep content that shows weapons, nudity or hate symbols.", "provider": "google", "model\_name": "gemini-2.5-flash-lite"}},

    \],

)

results \= client.retrievers.execute(moderation\["retriever\_id"\], inputs\={"image": "https://example.com/user-upload.jpg"})

for doc in results\["documents"\]:

    print(doc\["document\_id"\], doc\["score"\])

### Feature Extractors

Multimodal Extractor

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

### Retriever Stages

feature search

Search and filter documents by vector similarity using feature embeddings

filter

taxonomy enrich

Classify documents against taxonomy nodes via vector similarity

apply

llm filter

Filter documents using LLM-based semantic evaluation

filter

## Frequently asked questions

### How do I train the moderation categories?

Create collections of exemplar content for each category (safe, sensitive, prohibited). The taxonomy uses these as reference embeddings for classification. No model training is required.

### Can I customize moderation rules per region?

Yes. Create multiple taxonomies with region-specific exemplars and apply the appropriate one based on the content origin or target region.

### How does video moderation work?

Videos are decomposed into scenes and frames. Each segment is independently classified, and results are aggregated to produce a per-video verdict with timestamps for flagged segments.

## 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

### Document Classification Pipeline

Classify documents into custom business categories using layout-aware extraction and taxonomy enrichment. Handles invoices, contracts, reports, forms, and correspondence by analyzing both textual content and visual document structure.

Learn more





](/recipes/document-classification)[

Recipe

### Multimodal Hybrid Search Pipeline

Combine vector search with keyword search (BM25) across text, images, and video for the most comprehensive multimodal retrieval system.

Learn more





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

Recipe

### 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.

Learn more





](/recipes/multimodal-rag-pipeline)[

Recipe

### Taxonomy Enrichment Pipeline

Automatically classify and tag content using custom taxonomies. Map your content to IAB categories, custom hierarchies, or industry-specific classifications.

Learn more





](/recipes/taxonomy-enrichment-pipeline)[

Recipe

### Content Clustering Pipeline

Automatically group similar content together using embedding-based clustering. Discover themes, identify duplicates, and organize large content libraries.

Learn more





](/recipes/clustering-pipeline)