nasirus / llama_index

MIT License
1 stars 0 forks source link

How can merge multi index file #9

Open nasirus opened 1 year ago

nasirus commented 1 year ago

Hi,

For example I have 2 folder, folder 1 I use GPTTreeIndex and save to index1.json. And folder 2 I save to index2.json. So, now I want to load 2 index files. Ho can I do it?

nasirus commented 1 year ago

You can use the GPTListIndex to merge multiple indices. The GPTListIndex takes a list of indices as an argument and merges them into a single index.

from llama_index import GPTListIndex

index = GPTListIndex([index1, index2])

You can then save and load the merged index as you would any other index.

Best, Llama Index Team