From 0c9b4e4f82b8cdc732d1b5cfa02610ae28f81712 Mon Sep 17 00:00:00 2001 From: hsm207 Date: Wed, 7 Feb 2024 11:38:09 +0000 Subject: [PATCH] remove by_text parm --- langchain_weaviate/vectorstores.py | 5 ----- tests/integration_tests/test_vectorstores.py | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/langchain_weaviate/vectorstores.py b/langchain_weaviate/vectorstores.py index 19eca88..34b02ed 100644 --- a/langchain_weaviate/vectorstores.py +++ b/langchain_weaviate/vectorstores.py @@ -94,7 +94,6 @@ def __init__( relevance_score_fn: Optional[ Callable[[float], float] ] = _default_score_normalizer, - by_text: bool = True, use_multi_tenancy: bool = False, ): """Initialize with Weaviate client.""" @@ -110,7 +109,6 @@ def __init__( self._text_key = text_key self._query_attrs = [self._text_key] self.relevance_score_fn = relevance_score_fn - self._by_text = by_text if attributes is not None: self._query_attrs.extend(attributes) @@ -410,7 +408,6 @@ def from_texts( *, index_name: Optional[str] = None, text_key: str = "text", - by_text: bool = False, relevance_score_fn: Optional[ Callable[[float], float] ] = _default_score_normalizer, @@ -433,7 +430,6 @@ def from_texts( tenant: The tenant name. Defaults to None. index_name: Index name. text_key: Key to use for uploading/retrieving text to/from vectorstore. - by_text: Whether to search by text or by embedding. relevance_score_fn: Function for converting whatever distance function the vector store uses to a relevance score, which is a normalized similarity score (0 means dissimilar, 1 means similar). @@ -462,7 +458,6 @@ def from_texts( embedding=embedding, attributes=attributes, relevance_score_fn=relevance_score_fn, - by_text=by_text, use_multi_tenancy=tenant is not None, ) diff --git a/tests/integration_tests/test_vectorstores.py b/tests/integration_tests/test_vectorstores.py index 471adaf..c0c9f3e 100644 --- a/tests/integration_tests/test_vectorstores.py +++ b/tests/integration_tests/test_vectorstores.py @@ -165,7 +165,9 @@ def test_similarity_search_by_text( """Test end to end construction and search by text.""" docsearch = WeaviateVectorStore.from_texts( - texts, embedding_openai, client=weaviate_client, by_text=True + texts, + embedding_openai, + client=weaviate_client, ) output = docsearch.similarity_search("foo", k=1) @@ -361,7 +363,7 @@ def test_similarity_search_with_score( # now create an instance with an embedding docsearch = WeaviateVectorStore.from_texts( - texts, embedding_openai, client=weaviate_client, by_text=False + texts, embedding_openai, client=weaviate_client ) results = docsearch.similarity_search_with_score("kitty", k=1)