Skip to content

Commit

Permalink
Minor changes to the README
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarhane authored and willtai committed Apr 30, 2024
1 parent 0480051 commit e04c078
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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)
```
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/neo4j_genai/retrievers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Retriever(ABC):

def __init__(self, driver: Driver):
self.driver = driver
self._verify_version()

def _verify_version(self) -> None:
"""
Expand Down
4 changes: 1 addition & 3 deletions src/neo4j_genai/retrievers/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/neo4j_genai/retrievers/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion tests/test_retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit e04c078

Please sign in to comment.