From 154b705261648cb307de476e1b81f037109f1403 Mon Sep 17 00:00:00 2001 From: torbenw <torbenw@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:55:12 +0100 Subject: [PATCH] Weaviate vector store kwargs (#16954) --- .../llama_index/vector_stores/weaviate/base.py | 1 + .../pyproject.toml | 2 +- .../tests/test_vector_stores_weaviate.py | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/llama_index/vector_stores/weaviate/base.py b/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/llama_index/vector_stores/weaviate/base.py index 18ae4bc7d9..50c017efcf 100644 --- a/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/llama_index/vector_stores/weaviate/base.py +++ b/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/llama_index/vector_stores/weaviate/base.py @@ -354,6 +354,7 @@ class WeaviateVectorStore(BasePydanticVectorStore): return_metadata=return_metatada, return_properties=all_properties, include_vector=True, + **kwargs, ) except weaviate.exceptions.WeaviateQueryError as e: raise ValueError(f"Invalid query, got errors: {e.message}") diff --git a/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/pyproject.toml b/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/pyproject.toml index 5f8434d92c..7a8d9561f2 100644 --- a/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/pyproject.toml +++ b/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/pyproject.toml @@ -27,7 +27,7 @@ exclude = ["**/BUILD"] license = "MIT" name = "llama-index-vector-stores-weaviate" readme = "README.md" -version = "1.1.3" +version = "1.1.4" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" diff --git a/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/tests/test_vector_stores_weaviate.py b/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/tests/test_vector_stores_weaviate.py index 335a6e5a1d..6cbbeef89c 100644 --- a/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/tests/test_vector_stores_weaviate.py +++ b/llama-index-integrations/vector_stores/llama-index-vector-stores-weaviate/tests/test_vector_stores_weaviate.py @@ -61,3 +61,18 @@ def test_hybrid_search(vector_store): assert results.nodes[1].text == "This is a test." assert results.similarities[0] > results.similarities[1] + + +def test_query_kwargs(vector_store): + query = VectorStoreQuery( + query_embedding=[0.0, 0.3, 0.0], + similarity_top_k=2, + query_str="world", + mode=VectorStoreQueryMode.HYBRID, + ) + + results = vector_store.query( + query, + max_vector_distance=0.0, + ) + assert len(results.nodes) == 0 -- GitLab