Skip to content

Commit 092e9ee

Browse files
authored
community[minor]: Neo4j Fixed similarity docs (#23913)
**Description:** There was missing some documentation regarding the `filter` and `params` attributes in similarity search methods. --------- Co-authored-by: rpereira <rafael.pereira@criticalsoftware.com>
1 parent 10d8c3c commit 092e9ee

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

libs/community/langchain_community/vectorstores/neo4j_vector.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,11 @@ def similarity_search(
909909
Args:
910910
query (str): Query text to search for.
911911
k (int): Number of results to return. Defaults to 4.
912+
params (Dict[str, Any]): The search params for the index type.
913+
Defaults to empty dict.
914+
filter (Optional[Dict[str, Any]]): Dictionary of argument(s) to
915+
filter on metadata.
916+
Defaults to None.
912917
913918
Returns:
914919
List of Documents most similar to the query.
@@ -936,6 +941,11 @@ def similarity_search_with_score(
936941
Args:
937942
query: Text to look up documents similar to.
938943
k: Number of Documents to return. Defaults to 4.
944+
params (Dict[str, Any]): The search params for the index type.
945+
Defaults to empty dict.
946+
filter (Optional[Dict[str, Any]]): Dictionary of argument(s) to
947+
filter on metadata.
948+
Defaults to None.
939949
940950
Returns:
941951
List of Documents most similar to the query and score for each
@@ -972,6 +982,11 @@ def similarity_search_with_score_by_vector(
972982
Args:
973983
embedding (List[float]): The embedding vector to compare against.
974984
k (int, optional): The number of top similar documents to retrieve.
985+
filter (Optional[Dict[str, Any]]): Dictionary of argument(s) to
986+
filter on metadata.
987+
Defaults to None.
988+
params (Dict[str, Any]): The search params for the index type.
989+
Defaults to empty dict.
975990
976991
Returns:
977992
List[Tuple[Document, float]]: A list of tuples, each containing
@@ -1077,19 +1092,25 @@ def similarity_search_by_vector(
10771092
embedding: List[float],
10781093
k: int = 4,
10791094
filter: Optional[Dict[str, Any]] = None,
1095+
params: Dict[str, Any] = {},
10801096
**kwargs: Any,
10811097
) -> List[Document]:
10821098
"""Return docs most similar to embedding vector.
10831099
10841100
Args:
10851101
embedding: Embedding to look up documents similar to.
10861102
k: Number of Documents to return. Defaults to 4.
1103+
filter (Optional[Dict[str, Any]]): Dictionary of argument(s) to
1104+
filter on metadata.
1105+
Defaults to None.
1106+
params (Dict[str, Any]): The search params for the index type.
1107+
Defaults to empty dict.
10871108
10881109
Returns:
10891110
List of Documents most similar to the query vector.
10901111
"""
10911112
docs_and_scores = self.similarity_search_with_score_by_vector(
1092-
embedding=embedding, k=k, filter=filter, **kwargs
1113+
embedding=embedding, k=k, filter=filter, params=params, **kwargs
10931114
)
10941115
return [doc for doc, _ in docs_and_scores]
10951116

0 commit comments

Comments
 (0)