Here is the expression and the associated error dump:
db = WeaviateVectorStore.from_documents(docs, embeddings, client=client, index_name=“WikipediaLangChainMT”, tenant=“brazil”)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[11], line 1
----> 1 db = WeaviateVectorStore.from_documents(docs, embeddings, client=client, index_name="WikipediaLangChainMT", tenant="brazil")
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/langchain_core/vectorstores/base.py:835, in VectorStore.from_documents(cls, documents, embedding, **kwargs)
833 texts = [d.page_content for d in documents]
834 metadatas = [d.metadata for d in documents]
--> 835 return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/langchain_weaviate/vectorstores.py:487, in WeaviateVectorStore.from_texts(cls, texts, embedding, metadatas, tenant, client, index_name, text_key, relevance_score_fn, **kwargs)
475 attributes = list(metadatas[0].keys()) if metadatas else None
477 weaviate_vector_store = cls(
478 client,
479 index_name,
(...)
484 use_multi_tenancy=tenant is not None,
485 )
--> 487 weaviate_vector_store.add_texts(texts, metadatas, tenant=tenant, **kwargs)
489 return weaviate_vector_store
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/langchain_weaviate/vectorstores.py:167, in WeaviateVectorStore.add_texts(self, texts, metadatas, tenant, **kwargs)
164 if self._embedding:
165 embeddings = self._embedding.embed_documents(list(texts))
--> 167 with self._client.batch.dynamic() as batch:
168 for i, text in enumerate(texts):
169 data_properties = {self._text_key: text}
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/collections/batch/client.py:179, in _BatchClientWrapper.dynamic(self, consistency_level)
177 self._batch_mode: _BatchMode = _DynamicBatching()
178 self._consistency_level = consistency_level
--> 179 return self.__create_batch_and_reset()
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/collections/batch/client.py:135, in _BatchClientWrapper.__create_batch_and_reset(self)
133 def __create_batch_and_reset(self) -> _ContextManagerWrapper[_BatchClient]:
134 if self._vectorizer_batching is None or not self._vectorizer_batching:
--> 135 configs = self.__config.list_all(simple=True)
137 vectorizer_batching = False
138 for config in configs.values():
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/collections/collections/sync.py:286, in _Collections.list_all(self, simple)
265 def list_all(
266 self, simple: bool = True
267 ) -> Union[Dict[str, CollectionConfig], Dict[str, CollectionConfigSimple]]:
268 """List the configurations of the all the collections currently in the Weaviate instance.
269
270 Arguments:
(...)
284 If Weaviate reports a non-OK status.
285 """
--> 286 return self.__loop.run_until_complete(self.__collections.list_all, simple)
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/event_loop.py:40, in _EventLoop.run_until_complete(self, f, *args, **kwargs)
38 raise WeaviateClosedClientError()
39 fut = asyncio.run_coroutine_threadsafe(f(*args, **kwargs), self.loop)
---> 40 return fut.result()
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py:456, in Future.result(self, timeout)
454 raise CancelledError()
455 elif self._state == FINISHED:
--> 456 return self.__get_result()
457 else:
458 raise TimeoutError()
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py:401, in Future.__get_result(self)
399 if self._exception:
400 try:
--> 401 raise self._exception
402 finally:
403 # Break a reference cycle with the exception in self._exception
404 self = None
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/collections/collections/async_.py:304, in _CollectionsAsync.list_all(self, simple)
285 """List the configurations of the all the collections currently in the Weaviate instance.
286
287 Arguments:
(...)
301 If Weaviate reports a non-OK status.
302 """
303 _validate_input([_ValidateArgument(expected=[bool], name="simple", value=simple)])
--> 304 return await self._get_all(simple=simple)
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/collections/collections/base.py:76, in _CollectionsBase._get_all(self, simple)
74 assert res is not None
75 if simple:
---> 76 return _collection_configs_simple_from_json(res)
77 return _collection_configs_from_json(res)
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/collections/classes/config_methods.py:327, in _collection_configs_simple_from_json(schema)
323 def _collection_configs_simple_from_json(
324 schema: Dict[str, Any]
325 ) -> Dict[str, _CollectionConfigSimple]:
326 return {
--> 327 schema["class"]: _collection_config_simple_from_json(schema) for schema in schema["classes"]
328 }
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/collections/classes/config_methods.py:250, in _collection_config_simple_from_json(schema)
242 def _collection_config_simple_from_json(schema: Dict[str, Any]) -> _CollectionConfigSimple:
243 return _CollectionConfigSimple(
244 name=schema["class"],
245 description=schema.get("description"),
246 generative_config=__get_generative_config(schema),
247 properties=_properties_from_config(schema) if schema.get("properties") is not None else [],
248 references=_references_from_config(schema) if schema.get("properties") is not None else [],
249 reranker_config=__get_rerank_config(schema),
--> 250 vectorizer_config=__get_vectorizer_config(schema),
251 vectorizer=__get_vectorizer(schema),
252 vector_config=__get_vector_config(schema, simple=True),
253 )
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weaviate/collections/classes/config_methods.py:88, in __get_vectorizer_config(schema)
86 def __get_vectorizer_config(schema: Dict[str, Any]) -> Optional[_VectorizerConfig]:
87 if __is_vectorizer_present(schema) is not None and schema.get("vectorizer", "none") != "none":
---> 88 vec_config: Dict[str, Any] = schema["moduleConfig"].pop(schema["vectorizer"])
89 try:
90 vectorizer = Vectorizers(schema["vectorizer"])
KeyError: 'moduleConfig'