Find answers from the community

Updated 3 months ago

Hi, I have multiple documents that

Hi, I have multiple documents that uploaded by a user, then I persist them in a S3 storage. As I know it would be OK to persist indices in the same persist_dir with the same storage context. But I can't have the same storage context because users don't upload documents as the same time => indices will be override when new document arrives.
I'm thinking about create a folder for each document, like {s3_bucket}/{doc_id}, maybe it will work. Although, in loading state, I have to use a loop to load all documents' index.

Is it the correct way to handle such situation? Do you guys have any suggestion for improvement? Thanks in advance.
L
s
13 comments
hmm, I think having a storage context for each user would make sense right? Or you want users to share documents?
How can I keep/save the storage context for later?
In my current code, I create a new instance everytime a user upload a document
And no, I don't want share documents
Wait, I think I'm mistaking something
Does calling StorageContext.from_defaults with a persist_dir (each directory for each user) will eventually avoid overriding?
I just tried and it works!
Omg so sorry for your time
no worries! Happy to help :dotsCATJAM:
Add a reply
Sign up and join the conversation on Discord