I created an index for each file that is uploaded to my server. Now, I'd like users to be able to select multiple files and query them as 1 unified index. I did, this:
# Create index from requested docs
indices = []
summaries = []
service_context = _create_service_context()
for index_id in data["indexes"]:
persist_dir = f"/az/indexes/{index_id}" # test index
storage_context = StorageContext.from_defaults(persist_dir=persist_dir)
index = load_index_from_storage(
storage_context=storage_context,
service_context=service_context,
)
summaries.append("")
indices.append(index)
graph = ComposableGraph.from_indices(GPTListIndex, indices, summaries, service_context=service_context)
query_engine = graph.as_query_engine()
response = str(query_engine.query(data['query'])).replace("\n", " ")
It appears to call open ai multiple times when I expect it to call once on the merged index. Am I combining the indexes incorrectly to create a merged index?