Skip to content

Commit

Permalink
community: Fixed schema discrepancy in from_texts function for weavia…
Browse files Browse the repository at this point in the history
…te vectorstore (langchain-ai#16693)

* Description: Fixed schema discrepancy in **from_texts** function for
weaviate vectorstore which created a redundant property "key" inside a
class.
* Issue: Fixed: langchain-ai#16692
* Twitter handle: @pashvamehta1
  • Loading branch information
pashva authored Jan 29, 2024
1 parent ba70630 commit 22d9080
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/community/langchain_community/vectorstores/weaviate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
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"],
}
],
Expand Down Expand Up @@ -460,7 +460,7 @@ def from_texts(
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)
Expand Down

0 comments on commit 22d9080

Please sign in to comment.