vector_search_stage#

langchain_mongodb.pipelines.vector_search_stage(
query_vector: List[float],
search_field: str,
index_name: str,
top_k: int = 4,
filter: Dict[str, Any] | None = None,
oversampling_factor: int = 10,
**kwargs: Any,
) Dict[str, Any][source]#

Vector Search Stage without Scores.

Scoring is applied later depending on strategy. vector search includes a vectorSearchScore that is typically used. hybrid uses Reciprocal Rank Fusion.

Parameters:
  • query_vector (List[float]) – List of embedding vector

  • search_field (str) – Field in Collection containing embedding vectors

  • index_name (str) – Name of Atlas Vector Search Index tied to Collection

  • top_k (int) – Number of documents to return

  • oversampling_factor (int) – this times limit is the number of candidates

  • filter (Dict[str, Any] | None) – MQL match expression comparing an indexed field. Some operators are not supported. See vectorSearch filter docs

  • kwargs (Any)

Returns:

Dictionary defining the $vectorSearch

Return type:

Dict[str, Any]