Skip to content

Commit ce139bf

Browse files
authored
Merge pull request #2 from barnuri/copilot/sub-pr-1
[WIP] Add docstring as suggested in review for patch 1
2 parents bea064a + c46ded3 commit ce139bf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

libs/langchain-mongodb/langchain_mongodb/vectorstores.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,26 @@ def similarity_search_by_vector(
877877
*args: Any,
878878
**kwargs: Any,
879879
) -> list[Document]:
880+
"""Return MongoDB documents most similar to the given query vector.
881+
882+
Atlas Vector Search eliminates the need to run a separate
883+
search system alongside your database.
884+
885+
Args:
886+
query_vector: Embedding vector to search for.
887+
k: (Optional) number of documents to return. Defaults to 4.
888+
pre_filter: List of MQL match expressions comparing an indexed field
889+
post_filter_pipeline: (Optional) Pipeline of MongoDB aggregation stages
890+
to filter/process results after $vectorSearch.
891+
oversampling_factor: Multiple of k used when generating number of candidates
892+
at each step in the HNSW Vector Search.
893+
include_embeddings: If True, the embedding vector of each result
894+
will be included in metadata.
895+
kwargs: Additional arguments are specific to the search_type
896+
897+
Returns:
898+
List of documents most similar to the query vector.
899+
"""
880900
tuple_list = self.vector_store._similarity_search_with_score(
881901
query_vector,
882902
*args,

0 commit comments

Comments
 (0)