from_texts(texts, embedding[, metadatas, ...])
Construct a MongoDB Atlas Vector Search vector store from raw documents.
max_marginal_relevance_search(query[, k, ...])
Return documents selected using the maximal marginal relevance.
max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, pre_filter, ...])
Return MongoDB documents most similar to the given query.
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k, ...])
Return MongoDB documents most similar to the given query and their scores.
__init__(collection: Collection[MongoDBDocumentType], embedding: Embeddings, *, index_name: str = 'default', text_key: str = 'text', embedding_key: str = 'embedding', relevance_score_fn: str = 'cosine')[source]¶
Parameters
collection – MongoDB collection to add the texts to.
embedding – Text embedding model to use.
text_key – MongoDB field that will contain the text for each
document.
embedding_key – MongoDB field that will contain the embedding for
each document.
index_name – Name of the Atlas Search index.
relevance_score_fn – The similarity score used for the index.
supported (Currently) – Euclidean, cosine, and dot product.
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Run more documents through the embeddings and add to the vectorstore.
Parameters