From 6e88eab7f531631fd44d7fac25794e2f861108fd Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sat, 22 Jun 2024 13:52:33 -0300 Subject: [PATCH] chore: Remove unused vector search component and update vector store parameters format --- src/backend/base/langflow/components/__init__.py | 1 - .../base/langflow/custom/custom_component/component.py | 5 +++-- tests/integration/astra/test_astra_component.py | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/backend/base/langflow/components/__init__.py b/src/backend/base/langflow/components/__init__.py index fdd1144c9..24855d42f 100644 --- a/src/backend/base/langflow/components/__init__.py +++ b/src/backend/base/langflow/components/__init__.py @@ -12,6 +12,5 @@ __all__ = [ "textsplitters", "toolkits", "tools", - "vectorsearch", "vectorstores", ] diff --git a/src/backend/base/langflow/custom/custom_component/component.py b/src/backend/base/langflow/custom/custom_component/component.py index 73938fb6c..1f6693f5f 100644 --- a/src/backend/base/langflow/custom/custom_component/component.py +++ b/src/backend/base/langflow/custom/custom_component/component.py @@ -221,5 +221,6 @@ class Component(CustomComponent): return [field.name for field in inputs] except KeyError: return [] - return [] - return [] + + def build(self, **kwargs): + self.set_attributes(kwargs) diff --git a/tests/integration/astra/test_astra_component.py b/tests/integration/astra/test_astra_component.py index 2a67924c4..2a8319230 100644 --- a/tests/integration/astra/test_astra_component.py +++ b/tests/integration/astra/test_astra_component.py @@ -4,7 +4,6 @@ import pytest from langchain_core.documents import Document from langflow.components.memories.AstraDBMessageReader import AstraDBMessageReaderComponent from langflow.components.memories.AstraDBMessageWriter import AstraDBMessageWriterComponent -from langflow.components.vectorsearch.AstraDBSearch import AstraDBSearchComponent from langflow.components.vectorstores.AstraDB import AstraVectorStoreComponent from langflow.schema.data import Data @@ -78,10 +77,11 @@ def test_astra_embeds_and_search(astra_fixture): collection_name=SEARCH_COLLECTION, embedding=embedding, inputs=records, + add_to_vector_store=True, ) + component.build_vector_store() - component = AstraDBSearchComponent() - records = component.build( + component.build( token=application_token, api_endpoint=api_endpoint, collection_name=SEARCH_COLLECTION, @@ -89,6 +89,7 @@ def test_astra_embeds_and_search(astra_fixture): input_value="test1", number_of_results=1, ) + records = component.search_documents() assert len(records) == 1