@@richmond_a no i meant that we have a function called "load_index_from_storage" which we use if we don't want to re-index our embeddings. This is for local. Is there something similar so that I can query directly the mongodb database and extract the embeddings from there.
@@Raptor3Falcon This should be possible by following these steps: 1. Initialize a MongoDB vector store with LlamaIndex, specifying the database, collection and index name 2. Ensure that the embedding field in your database is named 'embedding' 3. Create an index from the loaded MongoDB vector store 4. Create a query engine from the index These steps should enable you to use preexisitng embeddings. And as usual ensure you have an appropriately set up vector index definition for your collection. Also ensure the same embedding model used in your existing development environment to embed user queries.
It should look something like this: from llama_index.vector_stores.mongodb import MongoDBAtlasVectorSearch from llama_index.core import VectorStoreIndex vector_store = MongoDBAtlasVectorSearch(mongo_client, db_name=DB_NAME, collection_name=COLLECTION_NAME, index_name="vector_index") index = VectorStoreIndex.from_vector_store(vector_store) query_engine = index.as_query_engine(similarity_top_k=3) query = "Recommend a romantic movie suitable for the christmas season and justify your selecton" response = query_engine.query(query) print(response)