There is an interactive version of this guide embedded in your studio portal.

Getting Started

First, install the required libraries:

pip install mixpeek

https://pypi.org/project/mixpeek

Initialize the Mixpeek client:

import os
from mixpeek import Mixpeek

client = Mixpeek(token="MIXPEEK_API_KEY")

Indexing Content

You can index various types of content including images, videos, and text:

Image Indexing

# Index an image from URL
response = client.ingest.image_url(
    url="https://example.com/sample-image.jpg",
    collection="quickstart",
    metadata={
        "title": "Sample Image",
        "category": "demo"
    },
    feature_extractors=client.ImageSettings(
        embed=[
            {
                "type": client.InputType.URL,
                "embedding_model": client.EmbeddingModel.IMAGE
            }
        ],
        describe={
            "enabled": True
        }
    )
)

Video Indexing

# Index a video from URL
response = client.ingest.video_from_url(
    url="https://example.com/sample-video.mp4",
    collection="quickstart",
    metadata={
        "title": "Sample Video",
        "category": "demo"
    },
    feature_extractors=[
        client.VideoSettings(
            interval_sec=15,
            embed=[
                {
                    "type": client.InputType.URL,
                    "embedding_model": client.EmbeddingModel.MULTIMODAL
                }
            ],
            transcribe={"enabled": True},
            describe={"enabled": True}
        )
    ]
)

Text Indexing

# Index text content
response = client.ingest.text(
    collection="quickstart",
    metadata={
        "title": "Sample Text",
        "category": "demo"
    },
    feature_extractors={
        "embed": [
            {
                "type": client.InputType.TEXT,
                "embedding_model": client.EmbeddingModel.TEXT,
                "value": "Your text content here"
            }
        ]
    }
)

Searching Content

Now you can perform both text and vector searches across your collections:

response = mixpeek.features.search(
    queries=[
        # Text vector search
        {
            "embedding_model": "text",
            "value": "dog jumping in the park",
            "type": "text",
        },
        # Image vector search
        {
            "embedding_model": "image",
            "value": "https://example.com/sample-image.jpg",
            "type": "url"
        }
    ],
    collections=["quickstart"],
    page_size=10,
    filters={
        "case_sensitive": True,
        "and_": [
            {
                "key": "metadata.category",
                "value": "demo",
                "operator": "eq"
            }
        ]
    }
)

Next Steps