Skip to content

Commit

Permalink
refactor: remove client type validation from WeaviateVectorStore init…
Browse files Browse the repository at this point in the history
…ialization

this is taken care by type hints now

Signed-off-by: hsm207 <[email protected]>
  • Loading branch information
hsm207 committed Dec 9, 2024
1 parent 6ba3a58 commit 8e49a46
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
5 changes: 0 additions & 5 deletions libs/weaviate/langchain_weaviate/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ def __init__(
):
"""Initialize with Weaviate client."""

if not isinstance(client, weaviate.WeaviateClient):
raise ValueError(
"client should be an instance of"
f" weaviate.WeaviateClient, got {type(client)}"
)
self._client = client
self._index_name = index_name or f"LangChain_{uuid4().hex}"
self._embedding = embedding
Expand Down
18 changes: 0 additions & 18 deletions libs/weaviate/tests/unit_tests/test_vectorstores_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,24 +611,6 @@ def test_search_with_multi_tenancy(
docsearch.similarity_search("foo", k=1)


def test_invalid_client_type() -> None:
with pytest.raises(ValueError) as excinfo:
invalid_client = "invalid_client"
index_name = "test_index"
text_key = "text"

WeaviateVectorStore(
client=invalid_client,
index_name=index_name,
text_key=text_key,
)

assert (
str(excinfo.value)
== "client should be an instance of weaviate.WeaviateClient, got <class 'str'>"
)


def test_embedding_property(
weaviate_client: Any, consistent_embedding: ConsistentFakeEmbeddings
) -> None:
Expand Down

0 comments on commit 8e49a46

Please sign in to comment.