How I can load multiple folder into index query_engine

#1
by maulikkanani26 - opened

So I have multiple folders and now I want to load multiple folders into index query_engine with each mpep section
image.png

from llama_index import load_index_from_storage, StorageContext

root_dir = "preTrainData"

def ask_question(question):
storage_context = StorageContext.from_defaults(persist_dir=root_dir)
index = load_index_from_storage(storage_context)
query_engine = index.as_query_engine()

prompt_template = "Provide references to sections in the MPEP"
response = query_engine.query(question + " " + prompt_template )
return response.response

Sign up or log in to comment