From f8bca156d4b602b4e1fd65182cf32c031f28957d Mon Sep 17 00:00:00 2001 From: Arpan Pokharel Date: Sat, 2 Sep 2023 04:54:19 +0545 Subject: [PATCH] Add where filter in weaviate similarity search with score (#9978) - Description: Add where filter in weaviate similarity search with score - Issue: #9853 - Dependencies: - - Tag maintainer: - - Twitter handle: - --- libs/langchain/langchain/vectorstores/weaviate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/langchain/langchain/vectorstores/weaviate.py b/libs/langchain/langchain/vectorstores/weaviate.py index 5f09a785d4..200ffedc6e 100644 --- a/libs/langchain/langchain/vectorstores/weaviate.py +++ b/libs/langchain/langchain/vectorstores/weaviate.py @@ -343,6 +343,8 @@ class Weaviate(VectorStore): if kwargs.get("search_distance"): content["certainty"] = kwargs.get("search_distance") query_obj = self._client.query.get(self._index_name, self._query_attrs) + if kwargs.get("where_filter"): + query_obj = query_obj.with_where(kwargs.get("where_filter")) embedded_query = self._embedding.embed_query(query) if not self._by_text: