Skip to main content
Memvid supports CLIP (Contrastive Language-Image Pre-training) embeddings for visual search. This enables searching documents, PDFs, and images by visual content, including charts, diagrams, photos, and visual elements using natural language queries.

Overview

CLIP models learn to associate images with text descriptions, enabling:
  • Text-to-image search: Find images using natural language (“sustainability charts”, “team photos”)
  • Visual document search: Search PDF pages by their visual content, not just text
  • Cross-modal retrieval: Query with text, retrieve visual content

Quick Start

Python SDK

Node.js SDK


Providers

Local CLIP (MobileCLIP-S2)

The default provider uses MobileCLIP-S2, a lightweight CLIP model optimized for mobile and edge devices. Characteristics:
  • Dimensions: 512
  • Size: ~200 MB (downloaded on first use)
  • Inference: CPU-based, no GPU required
  • Privacy: All processing happens locally
  • Offline: Works without internet after initial download
Local CLIP is supported in memvid-core and the Python SDK. In Node.js, LocalClip requires a native build that exports ClipModel (the prebuilt npm binaries may not include it). Cloud providers work out of the box.

OpenAI CLIP

OpenAI’s embedding models provide excellent quality for visual search queries. Setup:
Usage:
Model Comparison:

Gemini CLIP

Google’s Gemini provides multimodal embeddings for visual search. Setup:
Usage:

Complete Example

Here’s a full workflow for visual document search:

API Reference

ClipProvider Interface

All CLIP providers implement this interface:

Factory Function


Environment Variables


Use Cases

Search PDFs by their visual content (charts, diagrams, tables):
Build searchable image galleries with natural language:

Multimodal RAG

Combine visual and text search for richer retrieval:

Best Practices

  1. Choose the right provider: Use local CLIP for privacy/offline, OpenAI for quality
  2. Batch embeddings: Use embed_images() for multiple images to reduce API calls
  3. Cache embeddings: Store visual embeddings in metadata for reuse
  4. Consistent models: Use the same model for indexing and querying
  5. Dimension matching: Ensure query and document embeddings have same dimensions

Limitations

  • Local CLIP (Node.js): Requires a native build with CLIP support; prebuilt npm binaries may be cloud-only
  • Image formats: Supports JPEG, PNG, WebP, GIF
  • PDF visual search: Requires extracting page images first
  • Model size: Local CLIP downloads ~200 MB on first use

Next Steps

Embedding Models

Configure text embedding models for semantic search

Entity Extraction

Extract entities and build knowledge graphs

Indexes and Tracks

Learn about lexical, vector, and time indices

Python SDK

Complete Python SDK reference