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

* Description: Fixed schema discrepancy in **from_texts** function for
weaviate vectorstore which created a redundant property "key" inside a
class.
* Issue: Fixed: https://github.com/langchain-ai/langchain/issues/16692
* Twitter handle: @pashvamehta1
pull/16498/head^2
Pashva Mehta 5 months ago committed by GitHub
parent ba70630829
commit 22d90800c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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)

Loading…
Cancel
Save