LlamaIndex Vector Stores Weaviate

raw JSON →
1.6.0 verified Fri May 01 auth: no python

LlamaIndex integration for Weaviate vector database. Supports hybrid search, vector indexing, filtering, and metadata storage. Version 1.6.0 requires Python >=3.10, <4.0. Active development.

pip install llama-index-vector-stores-weaviate
error ModuleNotFoundError: No module named 'llama_index.vector_stores.weaviate'
cause Package not installed or wrong import path for older versions.
fix
Install with 'pip install llama-index-vector-stores-weaviate' and use correct import: 'from llama_index.vector_stores.weaviate import WeaviateVectorStore'.
error TypeError: WeaviateVectorStore.__init__() got an unexpected keyword argument 'client'
cause Parameter name is 'weaviate_client', not 'client'.
fix
Use 'WeaviateVectorStore(weaviate_client=client, ...)'.
error weaviate.exceptions.WeaviateClosedError: Weaviate is closed or not responding
cause Weaviate server not running or incorrect URL.
fix
Ensure Weaviate is running (e.g., 'docker run -p 8080:8080 semitechnologies/weaviate:latest') and use correct URL like 'http://localhost:8080'.
error ValueError: Could not find class 'LlamaIndex' in Weaviate schema
cause Class name does not exist; Weaviate supports automatic schema creation but may require explicit creation if settings disallow auto-schema.
fix
Ensure 'auto_schema.enabled' is true in Weaviate configuration, or manually create the class with 'client.schema.create_class(...)'.
breaking In version 0.9+, the import path changed from 'llama_index.vector_stores.weaviate' to 'llama_index.vector_stores.weaviate' (the package was restructured). Old code using 'from llama_index.vector_stores.weaviate import WeaviateVectorStore' will break unless you downgrade.
fix Update import to 'from llama_index.vector_stores.weaviate import WeaviateVectorStore'.
deprecated The 'from llama_index import VectorStoreIndex' pattern is deprecated in favor of 'from llama_index.core import VectorStoreIndex' since version 0.10.
fix Use 'from llama_index.core import VectorStoreIndex'.
gotcha WeaviateVectorStore expects a 'weaviate_client' parameter (not 'client'). Passing 'client' will raise a TypeError.
fix Use keyword argument 'weaviate_client=client'.
gotcha The 'index_name' parameter must match an existing class in Weaviate, or Weaviate will create one automatically. Ensure it is a valid CamelCase name.
fix Use proper CamelCase (e.g., 'LlamaIndex' not 'llama_index').

Basic usage: connect to Weaviate, store documents, and query.

import weaviate
from llama_index.core import VectorStoreIndex, StorageContext
from llama_index.vector_stores.weaviate import WeaviateVectorStore
# Connect to Weaviate (e.g., local Docker)
client = weaviate.Client("http://localhost:8080")
# Create vector store
vector_store = WeaviateVectorStore(weaviate_client=client, index_name="LlamaIndex")
# Create index from documents
documents = [Document(text="llama-index is awesome")]
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex.from_documents(documents, storage_context=storage_context)
# Query
query_engine = index.as_query_engine()
response = query_engine.query("What is llama-index?")
print(response)