GenAIHub
← Back to Technical Section

Weaviate

The AI-Native Vector Database with Integrated RAG & Hybrid Search

What is Weaviate?

Weaviate is an open-source, AI-native vector database that stores both objects and their vector embeddings. Built in Go for speed and reliability, it combines vector search with structured filtering, offering the fault tolerance and scalability of a cloud-native database. Weaviate stands out with its modular architecture, GraphQL API, and integrated RAG capabilities.

Key Advantage: Weaviate integrates vectorization, search, and generative AI (RAG) in a single query, eliminating the need for external orchestration. Its modular system lets you plug in transformers, OpenAI, Cohere, and more without code changes.

Weaviate powers these AI scenarios:

RAG

Built-in Generative

Hybrid

Vector + Keyword

Multimodal

Text + Image

Enterprise

Knowledge Bases

Architecture Overview

Weaviate exposes REST API, gRPC API, and GraphQL API for flexible communication. Its modular design allows plugging in vectorizers, generative models, and rerankers seamlessly.

Client REST/GraphQL/gRPC Weaviate Core HNSW Index BM25 Index Object Store Schema Multi-tenancy & Sharding Vectorizer Modules text2vec-openai text2vec-cohere img2vec-neural Generative Modules generative-openai generative-cohere generative-palm Storage LSM + HNSW

GraphQL API

Precise query control

Nested data, filters, certainty scores

Modular System

Plug-and-play modules

Vectorizers, generators, rerankers

HNSW + BM25

Dual indexing

Vector + keyword search combined

Core Concepts

Data Model

Weaviate organizes data into Collections (formerly Classes) containing Objects with properties and vectors:

Collection

Schema definition for objects

Object

Data entity with properties

Vector

Auto-generated or imported

Properties

Typed fields for filtering

Example collection schema:

{
  "class": "Article",
  "vectorizer": "text2vec-openai",
  "moduleConfig": {
    "generative-openai": {"model": "gpt-4"}
  },
  "properties": [
    {"name": "title", "dataType": ["text"]},
    {"name": "content", "dataType": ["text"]},
    {"name": "category", "dataType": ["text"]},
    {"name": "publishedAt", "dataType": ["date"]}
  ]
}

Vectorizer Module

Automatically generates vectors at import time using configured models (OpenAI, Cohere, HuggingFace, etc.) or accepts pre-computed vectors.

Generative Module

Enables RAG directly in queries - search results are passed to an LLM for generation without external orchestration.

Hybrid Search

Weaviate's hybrid search combines vector search (semantic) with BM25F keyword search (lexical) and fuses the results for superior accuracy.

Performance: Hybrid search boosts NDCG@10 by up to 42% over pure vector search, which is critical for RAG applications where both semantic understanding and exact term matching matter.

Vector Search

HNSW-based nearest neighbor search for semantic similarity.

Keyword Search (BM25F)

Traditional full-text search with term frequency scoring.

Fusion Algorithm

Combines results with configurable alpha weighting (0=keyword, 1=vector).

Integrated RAG (Generative Search)

Weaviate combines retrieval and generation in a single query, making RAG workflows simpler and more efficient:

RAG Query Flow

1️⃣

Search Query

Vector/Hybrid/Keyword

2️⃣

Retrieve Results

Context from Weaviate

3️⃣

Generate Response

LLM with context

Example RAG query (GraphQL):

{
  Get {
    Article(
      nearText: {concepts: ["machine learning trends"]}
      limit: 3
    ) {
      title
      content
      _additional {
        generate(
          singleResult: {
            prompt: "Summarize this article in 2 sentences: {content}"
          }
        ) {
          singleResult
        }
      }
    }
  }
}

Module Ecosystem

Weaviate's modular design lets you configure vectorizers, generators, and rerankers via schema without code changes:

Module Type Examples Purpose
Vectorizers (text2vec) openai, cohere, huggingface, transformers Generate embeddings from text
Vectorizers (img2vec) neural, clip Generate embeddings from images
Generative openai, cohere, palm, anthropic RAG response generation
Reranker cohere, transformers Re-score search results
QnA qna-transformers, qna-openai Direct question-answering

Deployment Options

Docker (Self-Hosted)

Full control, local development

docker run -p 8080:8080 \
  semitechnologies/weaviate

Weaviate Cloud

Fully managed, free tier available

console.weaviate.cloud - Zero maintenance

Kubernetes / Helm

Production clusters

Horizontal scaling, multi-tenancy

Getting Started

Python SDK Example

# Install: pip install weaviate-client

import weaviate
from weaviate.classes.config import Configure, Property, DataType

# Connect to Weaviate
client = weaviate.connect_to_local()  # or connect_to_wcs() for cloud

# Create collection with vectorizer
client.collections.create(
    name="Article",
    vectorizer_config=Configure.Vectorizer.text2vec_openai(),
    generative_config=Configure.Generative.openai(model="gpt-4"),
    properties=[
        Property(name="title", data_type=DataType.TEXT),
        Property(name="content", data_type=DataType.TEXT),
        Property(name="category", data_type=DataType.TEXT)
    ]
)

# Insert data (vectors generated automatically)
articles = client.collections.get("Article")
articles.data.insert({
    "title": "Introduction to RAG",
    "content": "RAG combines retrieval with generation...",
    "category": "AI"
})

# Hybrid search
response = articles.query.hybrid(
    query="machine learning applications",
    alpha=0.5,  # Balance between vector and keyword
    limit=5
)

# RAG query (generative search)
response = articles.generate.near_text(
    query="explain transformers",
    single_prompt="Summarize: {content}",
    limit=3
)

GraphQL Query Example

# Hybrid search with filtering
{
  Get {
    Article(
      hybrid: {
        query: "vector databases"
        alpha: 0.75
      }
      where: {
        path: ["category"]
        operator: Equal
        valueText: "AI"
      }
      limit: 5
    ) {
      title
      content
      _additional {
        score
        certainty
      }
    }
  }
}

Weaviate Ecosystem

Weaviate Database

Open-source vector database storing both objects and vectors.

Weaviate Cloud

Fully managed cloud deployment with automatic scaling.

Weaviate Agents

Pre-built agentic services for cloud users (query, transformation).

Weaviate Embeddings

Managed embedding inference service for seamless vectorization.

Weaviate vs Other Vector DBs

Feature Weaviate Pinecone Qdrant
Open Source Yes (BSD-3) No Yes (Apache 2.0)
Built-in RAG Yes (generative modules) No (external) No (external)
Auto Vectorization Yes (modules) Yes (integrated) No (external)
GraphQL API Yes No No
Language Go Unknown Rust

Integrations

LangChain

Vector Store

LlamaIndex

Index Backend

Haystack

Document Store

OpenAI

Embeddings & Gen

Cohere

Embeddings & Rerank

HuggingFace

Transformers

Anthropic

Claude Models

Google

PaLM / Gemini

Use Cases

🔍

Semantic Search

📚

RAG Applications

🤖

Q&A Chatbots

🏢

Enterprise Knowledge

🖼️

Image Search

💡

Recommendations

Learn More

Related Topics

Test Your Knowledge

Score 8/10 or higher to pass