langchain-weaviate
raw JSON → 0.0.6 verified Fri May 01 auth: no python
An integration package connecting Weaviate vector database with LangChain, providing vector store, retriever, and document loader. Current version 0.0.6 supports Python >=3.10,<4.0. Release cadence is monthly.
pip install langchain-weaviate Common errors
error ModuleNotFoundError: No module named 'langchain_weaviate' ↓
cause Package not installed or installed in wrong environment.
fix
pip install langchain-weaviate
error AttributeError: 'str' object has no attribute 'get' ↓
cause Passing a Weaviate client instance instead of URL string to `weaviate_url`.
fix
Use
weaviate_url="http://localhost:8080" instead of passing a client. error weaviate.exceptions.WeaviateClosedError: Failed to connect ↓
cause Weaviate server not running or wrong URL/port.
fix
Start Weaviate via Docker:
docker run -p 8080:8080 semitechnologies/weaviate:1.25.0 and verify URL. Warnings
breaking Version 0.0.6 requires langchain-core>=0.3.0, which is a breaking change from langchain<0.3. Ensure you upgrade langchain-core. ↓
fix pip install "langchain-core>=0.3.0"
gotcha The `weaviate_url` parameter expects a string like 'http://localhost:8080', not a Weaviate client instance. Using client instance will raise AttributeError. ↓
fix Pass the URL as a string; client is created internally.
gotcha When connecting to Weaviate Cloud (WCD), you must provide `auth_client_secret` in `client_kwargs`, not as a top-level parameter. Common mistake: passing `auth_client_secret` as a separate argument. ↓
fix vectorstore = WeaviateVectorStore(..., client_kwargs={"auth_client_secret": weaviate.auth.AuthApiKey(api_key="your-key")})
Imports
- WeaviateVectorStore wrong
from langchain.vectorstores import Weaviatecorrectfrom langchain_weaviate import WeaviateVectorStore - WeaviateHybridSearchRetriever wrong
from langchain.retrievers import WeaviateHybridSearchRetrievercorrectfrom langchain_weaviate import WeaviateHybridSearchRetriever - WeaviateDocumentLoader wrong
from langchain.document_loaders import WeaviateDocumentLoadercorrectfrom langchain_weaviate.document_loaders import WeaviateDocumentLoader
Quickstart
import os
from langchain_weaviate import WeaviateVectorStore
from langchain_community.embeddings import FakeEmbeddings
embeddings = FakeEmbeddings(size=512)
vectorstore = WeaviateVectorStore.from_documents(
documents=[],
embedding=embeddings,
weaviate_url=os.environ.get("WEAVIATE_URL", "http://localhost:8080"),
index_name="MyDocument",
client_kwargs={"auth_client_secret": None},
)
print(vectorstore._client.is_ready())