diff --git a/src/backend/base/langflow/components/vectorstores/Upstash.py b/src/backend/base/langflow/components/vectorstores/Upstash.py index 108bd272f..70a371fe0 100644 --- a/src/backend/base/langflow/components/vectorstores/Upstash.py +++ b/src/backend/base/langflow/components/vectorstores/Upstash.py @@ -11,7 +11,7 @@ from langflow.schema import Data class UpstashVectorStoreComponent(LCVectorStoreComponent): display_name = "Upstash" description = "Upstash Vector Store with search capabilities" - documentation = "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/upstash" + documentation = "https://python.langchain.com/v0.2/docs/integrations/vectorstores/upstash/" icon = "Upstash" inputs = [ @@ -26,23 +26,18 @@ class UpstashVectorStoreComponent(LCVectorStoreComponent): value="text", advanced=True, ), + MultilineInput(name="search_query", display_name="Search Query"), + DataInput( + name="ingest_data", + display_name="Ingest Data", + is_list=True, + ), HandleInput( name="embedding", display_name="Embedding", input_types=["Embeddings"], info="To use Upstash's embeddings, don't provide an embedding.", ), - DataInput( - name="vector_store_inputs", - display_name="Vector Store Inputs", - is_list=True, - ), - BoolInput( - name="add_to_vector_store", - display_name="Add to Vector Store", - info="If true, the Vector Store Inputs will be added to the Vector Store.", - ), - MultilineInput(name="search_input", display_name="Search Input"), IntInput( name="number_of_results", display_name="Number of Results", @@ -58,34 +53,26 @@ class UpstashVectorStoreComponent(LCVectorStoreComponent): def _build_upstash(self) -> UpstashVectorStore: use_upstash_embedding = self.embedding is None - if self.add_to_vector_store: - documents = [] - for _input in self.vector_store_inputs or []: - if isinstance(_input, Data): - documents.append(_input.to_lc_document()) - else: - documents.append(_input) - - if documents: - if use_upstash_embedding: - upstash_vs = UpstashVectorStore( - embedding=use_upstash_embedding, - text_key=self.text_key, - index_url=self.index_url, - index_token=self.index_token, - ) - upstash_vs.add_documents(documents) - else: - upstash_vs = UpstashVectorStore.from_documents( - documents=documents, - embedding=self.embedding, - text_key=self.text_key, - index_url=self.index_url, - index_token=self.index_token, - ) + documents = [] + for _input in self.ingest_data or []: + if isinstance(_input, Data): + documents.append(_input.to_lc_document()) else: + documents.append(_input) + + if documents: + if use_upstash_embedding: upstash_vs = UpstashVectorStore( - embedding=self.embedding or use_upstash_embedding, + embedding=use_upstash_embedding, + text_key=self.text_key, + index_url=self.index_url, + index_token=self.index_token, + ) + upstash_vs.add_documents(documents) + else: + upstash_vs = UpstashVectorStore.from_documents( + documents=documents, + embedding=self.embedding, text_key=self.text_key, index_url=self.index_url, index_token=self.index_token, @@ -103,9 +90,9 @@ class UpstashVectorStoreComponent(LCVectorStoreComponent): def search_documents(self) -> List[Data]: vector_store = self._build_upstash() - if self.search_input and isinstance(self.search_input, str) and self.search_input.strip(): + if self.search_query and isinstance(self.search_query, str) and self.search_query.strip(): docs = vector_store.similarity_search( - query=self.search_input, + query=self.search_query, k=self.number_of_results, )