Returns
List of Documents most similar to the query and score for each
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Perform a similarity search in the Neo4j database using a
given vector and return the top k similar documents with their scores.
This method uses a Cypher query to find the top k documents that
are most similar to a given embedding. The similarity is measured
using a vector index in the Neo4j database. The results are returned
as a list of tuples, each containing a Document object and
its similarity score.
Parameters
embedding (List[float]) – The embedding vector to compare against.
k (int, optional) – The number of top similar documents to retrieve.
Returns
A list of tuples, each containinga Document object and its similarity score.
Return type
List[Tuple[Document, float]]
verify_version() → None[source]¶
Check if the connected Neo4j database version supports vector indexing.
Queries the Neo4j database to retrieve its version and compares it
against a target version (5.11.0) that is known to support vector
indexing. Raises a ValueError if the connected Neo4j version is
not supported.
Examples using Neo4jVector¶
Neo4j
Neo4j Vector Index