Skip to content

The agent engineering platform.

community: Fixed schema discrepancy in from_texts function for weaviate vectorstore (#16693)

Pashva Mehta22d90800c867
diff --git a/libs/community/langchain_community/vectorstores/weaviate.py b/libs/community/langchain_community/vectorstores/weaviate.py
index 119e7bc0d7..8d4e6e472b 100644
--- a/libs/community/langchain_community/vectorstores/weaviate.py
+++ b/libs/community/langchain_community/vectorstores/weaviate.py
@@ -25,12 +25,12 @@ if TYPE_CHECKING:
import weaviate
-def _default_schema(index_name: str) -> Dict:
+def _default_schema(index_name: str, text_key: str) -> Dict:
return {
"class": index_name,
"properties": [
{
- "name": "text",
+ "name": text_key,
"dataType": ["text"],
}
],
@@ -460,7 +460,7 @@ class Weaviate(VectorStore):
client.batch.configure(batch_size=batch_size)
index_name = index_name or f"LangChain_{uuid4().hex}"
- schema = _default_schema(index_name)
+ schema = _default_schema(index_name, text_key)
# check whether the index already exists
if not client.schema.exists(index_name):
client.schema.create_class(schema)