fix: change local db component input as required and tool method name (#8560)

* change input as required and tool method name

* [autofix.ci] apply automated fixes

* Delete uv.lock

* add uvlock back

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Yuqi Tang 2025-06-20 11:51:47 -07:00 committed by GitHub
commit 664cd9d7ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,5 @@
from copy import deepcopy
from pathlib import Path
from typing import TYPE_CHECKING
from langchain_chroma import Chroma
from loguru import logger
@ -11,11 +10,9 @@ from langflow.base.vectorstores.utils import chroma_collection_to_data
from langflow.inputs.inputs import MultilineInput
from langflow.io import BoolInput, DropdownInput, HandleInput, IntInput, MessageTextInput, TabInput
from langflow.schema.data import Data
from langflow.schema.dataframe import DataFrame
from langflow.template.field.base import Output
if TYPE_CHECKING:
from langflow.schema.dataframe import DataFrame
class LocalDBComponent(LCVectorStoreComponent):
"""Chroma Vector Store with search capabilities."""
@ -39,6 +36,7 @@ class LocalDBComponent(LCVectorStoreComponent):
name="collection_name",
display_name="Collection Name",
value="langflow",
required=True,
),
MessageTextInput(
name="persist_directory",
@ -58,7 +56,7 @@ class LocalDBComponent(LCVectorStoreComponent):
show=False,
combobox=True,
),
HandleInput(name="embedding", display_name="Embedding", input_types=["Embeddings"]),
HandleInput(name="embedding", display_name="Embedding", required=True, input_types=["Embeddings"]),
BoolInput(
name="allow_duplicates",
display_name="Allow Duplicates",
@ -102,7 +100,7 @@ class LocalDBComponent(LCVectorStoreComponent):
),
]
outputs = [
Output(display_name="DataFrame", name="dataframe", method="as_dataframe"),
Output(display_name="DataFrame", name="dataframe", method="perform_search"),
]
def get_vector_store_directory(self, base_dir: str | Path) -> Path:
@ -257,3 +255,6 @@ class LocalDBComponent(LCVectorStoreComponent):
vector_store.add_documents(documents)
else:
self.log("No documents to add to the Vector Store.")
def perform_search(self) -> DataFrame:
return DataFrame(self.search_documents())