Skip to main content
MongoDB Atlas is a fully-managed cloud database available in AWS, Azure, and GCP. It now has support for native Vector Search on the MongoDB document data.

Installation and setup

See detail configuration instructions. We need to install langchain-mongodb python package.

Vector store

See a usage example.

Retrievers

Full text search retriever

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

Hybrid search retriever

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

Model caches

MongoDBCache

An abstraction to store a simple cache in MongoDB. This does not use Semantic Caching, nor does it require an index to be made on the collection before generation. To import this cache:
To use this cache with your LLMs:

MongoDBAtlasSemanticCache

Semantic caching allows users to retrieve cached prompts based on semantic similarity between the user input and previously cached results. Under the hood it blends MongoDBAtlas as both a cache and a vectorstore. The MongoDBAtlasSemanticCache inherits from MongoDBAtlasVectorSearch and needs an Atlas Vector Search Index defined to work. Please look at the usage example on how to set up the index. To import this cache:
To use this cache with your LLMs: