@@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)
Im building an MVP for my startup and was on my way to building this as a way to search a database and this is a great start.
🧾 Article:
mdblink.com/polm_ai_stack
💻 Code:
bit.ly/3UJVbOc
📈 Hugging Face Dataset:
huggingface.co/datasets/AIatM...
Very concise and informative. Good stuff. Link to github repo is broken !! Please fix it. Thanks and keep up the good work.
Thanks for watching.
And the link is updateted now.
@2:30 I vote AI Engineers. A nice simple title (not to be confused with ML engineers)
4:13 PALM stack? Ok I can dig that terminology
It's POLM stack, the O for OpenAI
But PALM stack does work for Anthropic.
That might just be the next video I do 😉
@@richmond_a true haha.
A MongoDB vector database isnt as widely covered with RAG. Well done
Where are you from Sir? I like your accent and the vid is great too
At the second step of the article has problems
Thanks for bringing this up.
The dataset in Step 2 of the article is located here: huggingface.co/datasets/MongoDB/embedded_movies
hey, iam doing the same thing. can i ask you specific questions ?
how to reuse these embeddings so that we don't have to recreate them?
You can access the dataset with the embeddings here: huggingface.co/datasets/MongoDB/embedded_movies
@@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.
@@richmond_a can u write a small sample code ?
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)