Skip to content

Commit

Permalink
remove by_text parm
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm207 committed Feb 7, 2024
1 parent 0826695 commit 0c9b4e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 0 additions & 5 deletions langchain_weaviate/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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)

Expand Down Expand Up @@ -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,
Expand All @@ -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).
Expand Down Expand Up @@ -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,
)

Expand Down
6 changes: 4 additions & 2 deletions tests/integration_tests/test_vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0c9b4e4

Please sign in to comment.