How to connect vector search pipeline to RAG stack (with langchain)?

Hi Raju and Vishnu,

Looking closely at the error, it says: “embedding is not indexed as knnVector”. However, in the index-definition, it specifies the field as “embeddings” (not the “s” at the end"). The default name of the embedding field taken while creating the MongoDBAtlasVectorSearch vector store, is “embedding”. I see that there was no “embeddingKey” explicitly specified here:

const vectorStore = new MongoDBAtlasVectorSearch(embeddings, { collection, indexName: options.indexName })

If the name of the field is something other than “embedding” (for instance, it seems to be “embeddings” in your case), then you should specify the field name explicitly with “embeddingKey” param. For an example of this, please refer to the code bit in the documentation here.

Hope this helps.

Thanks,
Harshad