Find answers from the community

Home
Members
hajravasas
h
hajravasas
Offline, last seen 3 months ago
Joined September 25, 2024
Hello, I am attempting to add some metadata about my user to the documents I am uploading to mongo. I have access to the user's information, I just don't know how to add this information to the document. I imagine that I may be able to do this via the SimpleNodeParser. This what I have so far to store my data in mongo and create my index.
Plain Text
            if is_user():
                storage_context = StorageContext.from_defaults(
                    docstore=MongoDocumentStore.from_uri(uri=MONGO_URI),
                    index_store=MongoIndexStore.from_uri(uri=MONGO_URI),
                )

                parser = SimpleNodeParser()
                nodes = parser.get_nodes_from_documents(documents)

                storage_context.docstore.add_documents(nodes)

                index = VectorStoreIndex(
                    nodes, storage_context=storage_context)
6 comments
L
h
I have an app where I want to allow my users to create their own contexts and add documents to that context. I am using Pinecone. Am I understanding it right that I would need one index per user if I didn't want the contexts to comingle? Or is there a more cost efficient way of doing this?
10 comments
h
L