Meera
(Meera Datey)
3
Thanks!
I am working with Langchain, and the resource you provided worked for filtering the results for retrieval.
Followup question is:
How do I populate the vector database with custom metadata field ?
This is how I am adding the metadata
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
docs = text_splitter.split_documents(data)
# Help me find a better way than iterating over all the documents
for i, doc in enumerate(docs):
doc.metadata["user_id"] = user_id
MongoDBAtlasVectorSearch.from_documents(
documents=docs,
embedding=OpenAIEmbeddings(disallowed_special=()),
collection=MONGODB_COLLECTION,
index_name=self.config.search_index_name,
)
Now for the retriever