Loop Over Items to process PDFs files

Hi,

I am new user of N8N. I have read that there was no stupid question … and really hope so.

I am trying to write a program which list all PDF files in a directory, reads them and inject them in a Qdrant Vectore Store, ultimately to use it by an AI Agent. Bascially, this is a “simple” RAG solution for my colleagues (and myself) as we have to read many long regulation and interpret them…

This is the content of my input directory:

/data/shared $ ls -al
total 3988
drwxrwxrwx 1 root root 4096 Nov 6 19:55 .
drwxr-xr-x 3 root root 4096 Oct 27 11:23 …
-rwxrwxrwx 1 root root 2583319 Nov 6 19:55 AIACT.pdf
-rwxrwxrwx 1 root root 1493241 Nov 2 17:16 DORA.pdf

and this is my workflow (I have removed the vectore store object)

it loops well twice but processes twice the first file of the directory (AIACT.pdf) … while I ideally want it to loop twice and process each file only once.

Is there something wrong in the “Loop Over Items” definition? Or something wrong in the output of previous node?

Thanks in advance for your help and support,

Vincent

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

n8n EXECUTION_PROCESS settings : hem would be more than happy to answer you :frowning:

  • n8nVersion: 1.64.3
  • platform: docker (self-hosted)
  • nodeJsVersion: 20.18.0
  • database: postgres
  • executionMode: regular
  • concurrency: -1
  • license: community

OS : Windows 11 Pro

Hope this helps and is sufficient …

I finally have found a solution to my problem but had to remove the loop node.

I however would still like to understand why initial design was failing. Thanks for any suggestion …

To be honest, I cannot see this scenario happening. Perhaps you are misreading the output. The output of Read Binary File should have two iterations.

image

Could you show the screenshots for each indicating this behaviour, please?

Though, indeed, you do not need Loop for it.

you might indeed be right. I can not reproduce the “problem” so it is likely that I wrongly interpreted the output message.
For info. I had another problem wher PDF file I wanted to upload were too heavy. I split them up into several smaller files.
My final (and working solution) is this one:

witht a vector Db containing a bit more than 53K points. The whole solutions sounds to be ok.

Thanks to you all for your support and patience.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.