From 048c0509589ddb8fec6f22ad756f316724a7d971 Mon Sep 17 00:00:00 2001 From: Ivo Schaper Date: Wed, 24 Apr 2024 14:49:33 +0200 Subject: [PATCH] remove asymmetric search convenience function --- .../connectors/document_index/document_index.py | 17 ----------------- .../retrievers/document_index_retriever.py | 4 ++-- .../document_index/test_document_index.py | 4 ++-- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/intelligence_layer/connectors/document_index/document_index.py b/src/intelligence_layer/connectors/document_index/document_index.py index efac7014b..d38f469b6 100644 --- a/src/intelligence_layer/connectors/document_index/document_index.py +++ b/src/intelligence_layer/connectors/document_index/document_index.py @@ -570,23 +570,6 @@ def search( self._raise_for_status(response) return [DocumentSearchResult._from_search_response(r) for r in response.json()] - def asymmetric_search( - self, - collection_path: CollectionPath, - search_query: SearchQuery, - ) -> Sequence[DocumentSearchResult]: - """Search through a collection with a `search_query` using the asymmetric search configuration. - - Args: - collection_path: Path to the collection of interest. - search_query: The query to search with. - - Returns: - Result of the search operation. Will be empty if nothing was retrieved. - """ - - return self.search(collection_path, "asymmetric", search_query) - def _raise_for_status(self, response: requests.Response) -> None: try: response.raise_for_status() diff --git a/src/intelligence_layer/connectors/retrievers/document_index_retriever.py b/src/intelligence_layer/connectors/retrievers/document_index_retriever.py index b0562fea8..629adda97 100644 --- a/src/intelligence_layer/connectors/retrievers/document_index_retriever.py +++ b/src/intelligence_layer/connectors/retrievers/document_index_retriever.py @@ -71,8 +71,8 @@ def get_relevant_documents_with_scores( search_query = SearchQuery( query=query, max_results=self._k, min_score=self._threshold ) - response = self._document_index.asymmetric_search( - self._collection_path, search_query + response = self._document_index.search( + self._collection_path, "asymmetric", search_query ) relevant_chunks = [ SearchResult( diff --git a/tests/connectors/document_index/test_document_index.py b/tests/connectors/document_index/test_document_index.py index 80a27b636..1fa164d9a 100644 --- a/tests/connectors/document_index/test_document_index.py +++ b/tests/connectors/document_index/test_document_index.py @@ -101,8 +101,8 @@ def test_document_index_searches_asymmetrically( document_name="test_document_index_searches_asymmetrically", # is always there ) search_query = SearchQuery(query="Who likes pizza?", max_results=1, min_score=0.0) - search_result = document_index.asymmetric_search( - document_path.collection_path, search_query + search_result = document_index.search( + document_path.collection_path, "asymmetric", search_query ) assert "Mark" in search_result[0].section