🚀 feat(vectorstores.py): add support for FAISS vector store type
The FAISS vector store type is now supported and can be configured with the folder_path and index_name fields. The folder_path field specifies the local path to the FAISS index, while the index_name field specifies the name of the index. Additionally, a new client_kwargs field has been added to support additional client configuration options.
This commit is contained in:
parent
f3e6db4df1
commit
935b85a218
1 changed files with 37 additions and 1 deletions
|
|
@ -18,7 +18,18 @@ class VectorStoreFrontendNode(FrontendNode):
|
||||||
multiline=False,
|
multiline=False,
|
||||||
value="http://localhost:8080",
|
value="http://localhost:8080",
|
||||||
)
|
)
|
||||||
extra_fields.append(extra_field)
|
# Add client_kwargs field
|
||||||
|
extra_field2 = TemplateField(
|
||||||
|
name="client_kwargs",
|
||||||
|
field_type="code",
|
||||||
|
required=False,
|
||||||
|
placeholder="",
|
||||||
|
show=True,
|
||||||
|
advanced=True,
|
||||||
|
multiline=False,
|
||||||
|
value="{}",
|
||||||
|
)
|
||||||
|
extra_fields.extend((extra_field, extra_field2))
|
||||||
|
|
||||||
elif self.template.type_name == "Chroma":
|
elif self.template.type_name == "Chroma":
|
||||||
# New bool field for persist parameter
|
# New bool field for persist parameter
|
||||||
|
|
@ -55,6 +66,29 @@ class VectorStoreFrontendNode(FrontendNode):
|
||||||
value="",
|
value="",
|
||||||
)
|
)
|
||||||
extra_fields.extend((extra_field, extra_field2))
|
extra_fields.extend((extra_field, extra_field2))
|
||||||
|
elif self.template.type_name == "FAISS":
|
||||||
|
extra_field = TemplateField(
|
||||||
|
name="folder_path",
|
||||||
|
field_type="str",
|
||||||
|
required=False,
|
||||||
|
placeholder="",
|
||||||
|
show=True,
|
||||||
|
advanced=True,
|
||||||
|
multiline=False,
|
||||||
|
display_name="Local Path",
|
||||||
|
value="",
|
||||||
|
)
|
||||||
|
extra_field2 = TemplateField(
|
||||||
|
name="index_name",
|
||||||
|
field_type="str",
|
||||||
|
required=False,
|
||||||
|
show=True,
|
||||||
|
advanced=False,
|
||||||
|
value="",
|
||||||
|
display_name="Index Name",
|
||||||
|
)
|
||||||
|
extra_fields.extend((extra_field, extra_field2))
|
||||||
|
|
||||||
if extra_fields:
|
if extra_fields:
|
||||||
for field in extra_fields:
|
for field in extra_fields:
|
||||||
self.template.add_field(field)
|
self.template.add_field(field)
|
||||||
|
|
@ -76,6 +110,7 @@ class VectorStoreFrontendNode(FrontendNode):
|
||||||
"weaviate_url",
|
"weaviate_url",
|
||||||
"index_name",
|
"index_name",
|
||||||
"namespace",
|
"namespace",
|
||||||
|
"folder_path",
|
||||||
]
|
]
|
||||||
advanced_fields = [
|
advanced_fields = [
|
||||||
"n_dim",
|
"n_dim",
|
||||||
|
|
@ -94,6 +129,7 @@ class VectorStoreFrontendNode(FrontendNode):
|
||||||
"grpc_port",
|
"grpc_port",
|
||||||
"pinecone_api_key",
|
"pinecone_api_key",
|
||||||
"pinecone_env",
|
"pinecone_env",
|
||||||
|
"client_kwargs",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Check and set field attributes
|
# Check and set field attributes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue