Find answers from the community

Updated last year

I m using load index from storage and

At a glance

The community member is using load_index_from_storage and index.storage_context.persist(...) to dynamically load and save indexes in their API. They have created their own StorageService class to handle file/folder read/write operations, allowing them to switch from local storage to services like S3. However, they are unsure how to override the default behavior of persist and load_index_from_storage to use their custom StorageService class.

In the comments, another community member suggests that the issue can be resolved by passing an fsspec object to change the storage backend to S3 or Google Cloud Buckets. They also provide a link to the relevant documentation on using a remote backend.

Useful resources
I'm using load_index_from_storage and index.storage_context.persist(...) to dynamically load and save the indexes as they're created within my API. I already do my own preprocessing steps on the document and have created my own set of StorageService class that handles read/write file, folder etc so I can easily switch from localstorage (local dev) to e.g. S3 or something else - but not sure how this bit can work with that dependency injection approach - @Logan M any pointers πŸ˜„
L
R
4 comments
So what's the issue then? πŸ‘€
well persist & and load_index_from_storage just use the local fs - not sure how to override that behaviour to inject my own class
you can pass in an fsspec object to change it to use S3 or google cloud buckets, for example
Add a reply
Sign up and join the conversation on Discord