I just created a simple workflow consisting of a Chat Trigger and an AI Agent (just for testing). In the Chat Trigger, I enabled the toggle “Allow File Uploads”, and connected the node to the AI Agent node. See the screenshot:
In the Agent node, I specified “Source for Prompt” as “Connected Chat Trigger Node”, which pre-fills the value for “Prompt (User Message)” with “{{ $json.chatInput }}”.
Now something strange is going on: When I send a chat message together with an uploaded file and look at the json of the execution, I can see, that even though in the input JSON the “chatInput” is just a string, and the prompt is defined to just use that $json.chatInput, the image is passed to the prompt anyways, resulting in an error “Bad request - please check your parameters
400 JSON format issue: expected string at field messages.content got instead array”.
This is really unintuitive. Passing the image to the LLM should not happen automatically, if it is not specified in the user prompt field.
Question: Is this correct, or am I doing something wrong?
thank you for your reply! Yes, I am using another LLM provider, which has an OpenAI compatible API.
But anyways, it should not depend on the model used whether the image is passed into the prompt or not. I am just wondering, why n8n passes the image to the LLM without me having this specified anywhere? It just says it should pass $json.chatInput, which according to the trigger output json contains just a string. But somehow, the image ends up in the LLM prompt as well…
Thank you, this looks like a workaround. However, I still think this behavior is rather a bug, because it is unexpected and feels wrong. Not sure if I should open an issue on GitHub
Edit: Nevermind, I found that the Agent node has an option “automatically pass through binary images”…