Skip to content

Commit

Permalink
Added comment about Embedder type in docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
willtai committed Apr 22, 2024
1 parent 2a21e0d commit 7b5ac29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/similarity_search_for_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from random import random
from neo4j_genai.embedder import Embedder
from neo4j_genai.indexes import create_vector_index, drop_index
from neo4j_genai.indexes import create_vector_index

URI = "neo4j://localhost:7687"
AUTH = ("neo4j", "password")
Expand All @@ -15,7 +15,7 @@
driver = GraphDatabase.driver(URI, auth=AUTH)


# Create Embedder object
# Create CustomEmbedder object with the required Embedder type
class CustomEmbedder(Embedder):
def embed_query(self, text: str) -> list[float]:
return [random() for _ in range(DIMENSION)]
Expand Down
6 changes: 4 additions & 2 deletions src/neo4j_genai/retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def search(self, *args, **kwargs) -> Any:

class VectorRetriever(Retriever):
"""
Provides retrieval method using vector search over embeddings
Provides retrieval method using vector search over embeddings.
If an embedder is provided, it needs to have the required Embedder type.
"""

def __init__(
Expand Down Expand Up @@ -160,7 +161,8 @@ def search(

class VectorCypherRetriever(Retriever):
"""
Provides retrieval method using vector similarity and custom Cypher query
Provides retrieval method using vector similarity and custom Cypher query.
If an embedder is provided, it needs to have the required Embedder type.
"""

def __init__(
Expand Down

0 comments on commit 7b5ac29

Please sign in to comment.