feat(Weaviate): Enforce capitalized index name (#3791)
feat(Weaviate): Enforce capitalized index name Checks if the index name is capitalized or not.
This commit is contained in:
parent
4eb6bd17bd
commit
0e80ebd3cd
1 changed files with 10 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import weaviate # type: ignore
|
||||
import weaviate
|
||||
from langchain_community.vectorstores import Weaviate
|
||||
|
||||
from langflow.base.vectorstores.model import LCVectorStoreComponent, check_cached_vector_store
|
||||
|
|
@ -17,7 +17,12 @@ class WeaviateVectorStoreComponent(LCVectorStoreComponent):
|
|||
inputs = [
|
||||
StrInput(name="url", display_name="Weaviate URL", value="http://localhost:8080", required=True),
|
||||
SecretStrInput(name="api_key", display_name="API Key", required=False),
|
||||
StrInput(name="index_name", display_name="Index Name", required=True),
|
||||
StrInput(
|
||||
name="index_name",
|
||||
display_name="Index Name",
|
||||
required=True,
|
||||
info="Requires capitalized index name.",
|
||||
),
|
||||
StrInput(name="text_key", display_name="Text Key", value="text", advanced=True),
|
||||
MultilineInput(name="search_query", display_name="Search Query"),
|
||||
DataInput(
|
||||
|
|
@ -44,6 +49,9 @@ class WeaviateVectorStoreComponent(LCVectorStoreComponent):
|
|||
else:
|
||||
client = weaviate.Client(url=self.url)
|
||||
|
||||
if self.index_name != self.index_name.capitalize():
|
||||
raise ValueError(f"Weaviate requires the index name to be capitalized. Use: {self.index_name.capitalize()}")
|
||||
|
||||
documents = []
|
||||
for _input in self.ingest_data or []:
|
||||
if isinstance(_input, Data):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue