langchain-mongodb: 0.2.0#

Integrate your operational database and vector search in a single, unified, fully managed platform with full vector database capabilities on MongoDB Atlas.

Store your operational data, metadata, and vector embeddings in oue VectorStore, MongoDBAtlasVectorSearch. Insert into a Chain via a Vector, FullText, or Hybrid Retriever.

cache#

Classes

cache.MongoDBAtlasSemanticCache(...[, ...])

MongoDB Atlas Semantic cache.

cache.MongoDBCache(connection_string[, ...])

MongoDB Atlas cache

chat_message_histories#

Classes

chat_message_histories.MongoDBChatMessageHistory(...)

Chat message history that stores history in MongoDB.

langchain_mongodb_index#

Functions

index.create_fulltext_search_index(...[, ...])

Experimental Utility function to create an Atlas Search index

index.create_vector_search_index(collection, ...)

Experimental Utility function to create a vector search index

index.drop_vector_search_index(collection, ...)

Drop a created vector search index

index.update_vector_search_index(collection, ...)

Update a search index.

pipelines#

Functions

pipelines.combine_pipelines(pipeline, stage, ...)

Combines two aggregations into a single result set in-place.

pipelines.final_hybrid_stage(scores_fields, ...)

Sum weighted scores, sort, and apply limit.

pipelines.reciprocal_rank_stage(score_field)

Stage adds Reciprocal Rank Fusion weighting.

pipelines.text_search_stage(query, ...[, ...])

Full-Text search using Lucene's standard (BM25) analyzer

pipelines.vector_search_stage(query_vector, ...)

Vector Search Stage without Scores.

retrievers#

Classes

retrievers.full_text_search.MongoDBAtlasFullTextSearchRetriever

Hybrid Search Retriever performs full-text searches using Lucene's standard (BM25) analyzer.

retrievers.hybrid_search.MongoDBAtlasHybridSearchRetriever

Hybrid Search Retriever combines vector and full-text searches weighting them the via Reciprocal Rank Fusion (RRF) algorithm.

utils#

Functions

utils.cosine_similarity(X, Y)

Row-wise cosine similarity between two equal-width matrices.

utils.make_serializable(obj)

Recursively cast values in a dict to a form able to json.dump

utils.maximal_marginal_relevance(...[, ...])

Compute Maximal Marginal Relevance (MMR).

utils.oid_to_str(oid)

Convert MongoDB's internal BSON ObjectId into a simple str for compatibility.

utils.str_to_oid(str_repr)

Attempt to cast string representation of id to MongoDB's internal BSON ObjectId.

vectorstores#

Classes

vectorstores.MongoDBAtlasVectorSearch(...[, ...])

MongoDB Atlas vector store integration.