🚀 feat(vectorstores.py): add support for Chroma vector store type
🐛 fix(vectorstores.py): add persist field to Weaviate vector store type
The `VectorStoreFrontendNode` class now supports the Chroma vector store type. A new boolean field `persist` has been added to the Chroma vector store type. The `add_extra_fields` method has been updated to add the `persist` field to the Chroma vector store type. The `format_field` method has been updated to include the `persist` field in the basic fields. Additionally, the `add_extra_fields` method has been updated to add the `weaviate_url` field to the Weaviate vector store type.
This commit is contained in:
parent
b6c10206e2
commit
b7eab50672
1 changed files with 21 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ from langflow.template.frontend_node.base import FrontendNode
|
|||
|
||||
class VectorStoreFrontendNode(FrontendNode):
|
||||
def add_extra_fields(self) -> None:
|
||||
extra_field = None
|
||||
if self.template.type_name == "Weaviate":
|
||||
extra_field = TemplateField(
|
||||
name="weaviate_url",
|
||||
|
|
@ -18,6 +19,18 @@ class VectorStoreFrontendNode(FrontendNode):
|
|||
value="http://localhost:8080",
|
||||
)
|
||||
|
||||
elif self.template.type_name == "Chroma":
|
||||
# New bool field for persist parameter
|
||||
extra_field = TemplateField(
|
||||
name="persist",
|
||||
field_type="bool",
|
||||
required=False,
|
||||
show=True,
|
||||
advanced=False,
|
||||
value=True,
|
||||
display_name="Persist",
|
||||
)
|
||||
if extra_field is not None:
|
||||
self.template.add_field(extra_field)
|
||||
|
||||
def add_extra_base_classes(self) -> None:
|
||||
|
|
@ -27,7 +40,14 @@ class VectorStoreFrontendNode(FrontendNode):
|
|||
def format_field(field: TemplateField, name: Optional[str] = None) -> None:
|
||||
FrontendNode.format_field(field, name)
|
||||
# Define common field attributes
|
||||
basic_fields = ["work_dir", "collection_name", "api_key", "location"]
|
||||
basic_fields = [
|
||||
"work_dir",
|
||||
"collection_name",
|
||||
"api_key",
|
||||
"location",
|
||||
"persist_directory",
|
||||
"persist",
|
||||
]
|
||||
advanced_fields = [
|
||||
"n_dim",
|
||||
"key",
|
||||
|
|
@ -78,5 +98,3 @@ class VectorStoreFrontendNode(FrontendNode):
|
|||
field.advanced = True
|
||||
if "key" in field.name:
|
||||
field.password = False
|
||||
# TODO: Weaviate requires weaviate_url to be passed as it is not part of
|
||||
# the class or from_texts method. We need the add_extra_fields to fix this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue