diff --git a/README.md b/README.md index a6507970..8272e13c 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ The purpose of this package is to provide a first party package to developers, where Neo4j can guarantee long term commitment and maintenance as well as being fast to ship new features and high performing patterns and methods. +Docs are coming soon! + # Usage ## Installation @@ -22,7 +24,7 @@ pip install neo4j-genai While the library has more retrievers than shown here, the following examples should be able to get you started. -### Performing a simple similarity search +### Performing a similarity search Assumption: Neo4j running with populated vector index in place. @@ -41,7 +43,7 @@ driver = GraphDatabase.driver(URI, auth=AUTH) # Initialize the retriever retriever = VectorRetriever(driver, INDEX_NAME) -# Perform the similarity search for a vector query +# Run the similarity search query_text = "How do I do similarity search in Neo4j?" response = retriever.search(query_text=query_text, top_k=5) ``` diff --git a/src/neo4j_genai/queries.py b/src/neo4j_genai/neo4j_queries.py similarity index 100% rename from src/neo4j_genai/queries.py rename to src/neo4j_genai/neo4j_queries.py diff --git a/src/neo4j_genai/retrievers/base.py b/src/neo4j_genai/retrievers/base.py index ee12ad68..dc483eb6 100644 --- a/src/neo4j_genai/retrievers/base.py +++ b/src/neo4j_genai/retrievers/base.py @@ -25,6 +25,7 @@ class Retriever(ABC): def __init__(self, driver: Driver): self.driver = driver + self._verify_version() def _verify_version(self) -> None: """ diff --git a/src/neo4j_genai/retrievers/hybrid.py b/src/neo4j_genai/retrievers/hybrid.py index fe3827b2..a9311d06 100644 --- a/src/neo4j_genai/retrievers/hybrid.py +++ b/src/neo4j_genai/retrievers/hybrid.py @@ -20,7 +20,7 @@ from neo4j_genai.embedder import Embedder from neo4j_genai.retrievers.base import Retriever from neo4j_genai.types import HybridSearchModel, SearchType, HybridCypherSearchModel -from neo4j_genai.queries import get_search_query +from neo4j_genai.neo4j_queries import get_search_query class HybridRetriever(Retriever): @@ -33,7 +33,6 @@ def __init__( return_properties: Optional[list[str]] = None, ) -> None: super().__init__(driver) - self._verify_version() self.vector_index_name = vector_index_name self.fulltext_index_name = fulltext_index_name self.embedder = embedder @@ -98,7 +97,6 @@ def __init__( embedder: Optional[Embedder] = None, ) -> None: super().__init__(driver) - self._verify_version() self.vector_index_name = vector_index_name self.fulltext_index_name = fulltext_index_name self.retrieval_query = retrieval_query diff --git a/src/neo4j_genai/retrievers/vector.py b/src/neo4j_genai/retrievers/vector.py index 1b404643..771ce352 100644 --- a/src/neo4j_genai/retrievers/vector.py +++ b/src/neo4j_genai/retrievers/vector.py @@ -25,7 +25,7 @@ VectorCypherSearchModel, SearchType, ) -from neo4j_genai.queries import get_search_query +from neo4j_genai.neo4j_queries import get_search_query class VectorRetriever(Retriever): @@ -42,7 +42,6 @@ def __init__( return_properties: Optional[list[str]] = None, ) -> None: super().__init__(driver) - self._verify_version() self.index_name = index_name self.return_properties = return_properties self.embedder = embedder @@ -121,7 +120,6 @@ def __init__( embedder: Optional[Embedder] = None, ) -> None: super().__init__(driver) - self._verify_version() self.index_name = index_name self.retrieval_query = retrieval_query self.embedder = embedder diff --git a/tests/test_queries.py b/tests/test_queries.py index fdc32e8a..555388ae 100644 --- a/tests/test_queries.py +++ b/tests/test_queries.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from neo4j_genai.queries import get_search_query +from neo4j_genai.neo4j_queries import get_search_query from neo4j_genai.types import SearchType diff --git a/tests/test_retrievers.py b/tests/test_retrievers.py index e6346334..2f7a6113 100644 --- a/tests/test_retrievers.py +++ b/tests/test_retrievers.py @@ -21,7 +21,7 @@ from neo4j_genai import VectorRetriever, VectorCypherRetriever, HybridRetriever from neo4j_genai.retrievers.hybrid import HybridCypherRetriever from neo4j_genai.types import VectorSearchRecord, SearchType -from neo4j_genai.queries import get_search_query +from neo4j_genai.neo4j_queries import get_search_query def test_vector_retriever_supported_aura_version(driver):