Weaviate: Multimodal Vector Search With Built-In Vectorizers

Updated
7 min read
Weaviate: Multimodal Vector Search With Built-In Vectorizers
TL;DR

Weaviate vectorizes text and images automatically with pluggable vectorizer modules, and combines BM25 keyword search with vector search in a single hybrid query.

What Makes Weaviate Different

Most vector databases store pre-computed vectors - you embed content yourself and hand the vector to the DB. Weaviate goes further: it ships built-in vectorizer modules that embed content automatically at ingest time. Define your schema once with a vectorizer configured, and Weaviate handles the rest. This is especially powerful for multimodal apps where you want to embed both text and images in the same collection.

Schema and Data Classes

Weaviate uses a schema of "data classes" (analogous to collections):

python
import weaviate

client = weaviate.connect_to_local()

client.collections.create(
    name="Article",
    vectorizer_config=weaviate.classes.config.Configure.Vectorizer.text2vec_openai(),
    properties=[
        weaviate.classes.config.Property(name="title", data_type=weaviate.classes.config.DataType.TEXT),
        weaviate.classes.config.Property(name="body", data_type=weaviate.classes.config.DataType.TEXT),
    ],
)

With text2vec_openai configured, inserting a document triggers automatic embedding via the OpenAI embeddings API.

Built-In Vectorizer Modules

5 rows · Click column to sort
text2vec-openaiTextCalls OpenAI embeddings API
text2vec-cohereTextCohere embed API
text2vec-transformersTextLocal HuggingFace model
multi2vec-clipText + ImagesCLIP embeddings, multimodal
img2vec-neuralImagesResNet-50, self-hosted

Batch Import

python
articles = client.collections.get("Article")

with articles.batch.dynamic() as batch:
    for item in my_data:
        batch.add_object({"title": item["title"], "body": item["body"]})

Weaviate handles batching, rate limiting, and retries automatically.

Hybrid Search (BM25 + Vector)

python
results = articles.query.hybrid(
    query="LLM memory management techniques",
    alpha=0.5,  # 0 = pure BM25, 1 = pure vector
    limit=5,
)
for r in results.objects:
    print(r.properties["title"])

alpha=0.5 gives equal weight to keyword and semantic similarity. Tune based on your dataset.

GraphQL Query API

Weaviate also exposes a GraphQL API for complex queries:

bash
{
  Get {
    Article(
      nearText: {concepts: ["memory management"]}
      limit: 3
    ) {
      title
      body
      _additional { certainty }
    }
  }
}

Docker Self-Host

bash
version: "3.8"
services:
  weaviate:
    image: semitechnologies/weaviate:latest
    ports:
      - "8080:8080"
    environment:
      QUERY_DEFAULTS_LIMIT: 20
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "true"
      DEFAULT_VECTORIZER_MODULE: text2vec-openai
      ENABLE_MODULES: text2vec-openai,multi2vec-clip
      OPENAI_APIKEY: "${OPENAI_API_KEY}"

Weaviate Cloud

Weaviate Cloud offers a managed service with a free sandbox tier. Connect with:

python
client = weaviate.connect_to_weaviate_cloud(
    cluster_url="https://your-cluster.weaviate.network",
    auth_credentials=weaviate.classes.init.Auth.api_key("YOUR_KEY"),
)

Full documentation at weaviate.io/developers/weaviate.

#weaviate#multimodal#vector-search#graphql#hybrid-search

One AI engineering post, weekly

LLM benchmarks, prompt techniques, and token-cost breakdowns, delivered to your inbox.

What should we test or explain next?

Comments

Have a question or something to add? Sign in to join the discussion.

Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

Software architect, full-stack engineer, and machine learning practitioner. Founder & CEO of Pristren, CTO at Venture Kick-backed PIN Sport Application GmbH (Basel, Switzerland), Software Development Lead at DailyFrame GmbH (building Dimetra patient transport software), and creator of Zlyqor. Focused on custom workflow automation, scalable web and mobile applications, and production AI/ML systems.