pipelines icon indicating copy to clipboard operation
pipelines copied to clipboard

Handling Dynamic File Uploads in LlamaIndex RAG Pipeline

Open jeekdata opened this issue 8 months ago • 4 comments

hello , I’m using the LlamaIndex RAG pipeline in a web UI and following the llamaindex_pipeline example. In the example, the document path is hardcoded like this:

python

self.documents = SimpleDirectoryReader("./data").load_data()
self.index = VectorStoreIndex.from_documents(self.documents)

However, in my case, users will upload files dynamically, so I don’t know in advance where the files will be stored. Because of that, I’m not sure how to reference the uploaded file path in the pipeline to load the document properly.

Has anyone dealt with this before or have any suggestions on how to handle dynamic file uploads with LlamaIndex? Any pointers would be appreciated!

Thanks!

jeekdata avatar Apr 15 '25 12:04 jeekdata

same question as i

Saber-xxf avatar May 06 '25 04:05 Saber-xxf

If this is relevant, files are stored within "UPLOAD_DIR" from open_webui.config

How i do it:

from open_webui.config import UPLOAD_DIR
import os 

for file in body['files']:
  for f in file['files']:
    if 'meta' in f:
      meta = f['meta']
      path = os.path.join(UPLOAD_DIR, f"{f['id']}_{meta['name']}")

And then you read them from there directly.

torisetxd avatar May 06 '25 07:05 torisetxd

There might be a better way to do it but thats how i do it.

torisetxd avatar May 06 '25 07:05 torisetxd

@jeekdata could you please provide details of the script you are using for LLamaIndex RAG

Another thing I want to know whether we can completely externalise the RAG pipeline instead of using OpenWebUIs backend RAG

arunbugkiller avatar Jun 12 '25 05:06 arunbugkiller