This is the function
# TODO: cache index (only the index struct from storage_context)
def load_index_folder (idx_folder, service_context):
print ("Loading indices from [" + idx_folder + "]");
# rebuild storage context
storage_context = StorageContext.from_defaults(persist_dir=idx_folder)
# load index
index = load_index_from_storage(storage_context, service_context=service_context)
return index
The comment I wrote is after several tests ... I noticed I can
st.cache_data
the
index_struct
before it's converted into a class in
load_*indices*_from_storage()
... but it would be simpler if I could just cache the returned
index
... The error I got is something like this:
https://github.com/jerryjliu/llama_index/issues/886