Hey, I’ve been playing around with n8n-ai using the Assistant node. You can select a new or existing Assistant from your OpenAI account, however it doesn’t have a way to remember conversations.
I’m using n8n’s official chat front-end (https://cdn.jsdelivr.net/npm/@n8n/chat/chat.bundle.es.js), as I wanted to implement this on a 3rd party site.
I could use the AI agent, which has a memory, but it doesn’t support document retrieval.
So in a nutshell, how do I use an agent that’s capable of “retrieval” and “chat memory” at the same time?
n8n version:1.19.0 ai beta
Database (default: SQLite): default
n8n EXECUTIONS_PROCESS setting (default: own, main): not sure what this is
Running n8n via (Docker, npm, n8n cloud, desktop app): via docker on ubuntu host
Just for context, what I tried is using a normal chat agent that can use an assistant as an “external tool” to have access to files.
That way I had both memory and file access. However, this didn’t work, because for some unknown reason the main chat agent kept on calling multiple times the assistant agent with empty requests, or called it multiple times when it didn’t get the expected response.
It’s like trying to control 2 kids lol…
It would definitely be a great feature. I am trying to achieve this using multiple HTTP requests to the OpenAI API but the API itself is buggy (it will not always process multiple messages sent to the queue) and this makes the hole thing very complex, with lots of checks and loops, and the workflow becomes a mess. At least in my case since I use very complex Assistants using GPT4 model that do a very very specific task.
At this moment the available node in N8N will execute a different thread on each message, and currently OpenAI Assistants using GPT4 model are buggy too, they need ‘training’, so as soon as I start a new thread, the Assistant makes terrible mistakes.
If I could make the node use same the thread ID that would be enough feature to enable memory.
Yes that’s how I do it, with the small difference that after the Node ‘Check Run Status’ if it is false I have a Wait Node to avoid hammering the API. If you look in OpenAI Playground, they too run the ‘Check Run’ at approx. 3 seconds interval.
But also in my case I ask the AI to generate a very specific information, and to be able to differentiate each type of information that the AI generates, I must send 9 different messages. The theory says that I can add each message to the queue and just Run once the Assistant. The problem is that the API will 80% of the times process only the first message in the queue, the other 8 are simply ignored.
So I have to do a Run Assistant for each message, wait for each reply, check for error responses, store the data, and this makes the Workflow a bit more complex.
If I could use the currently available Node in N8N for OpenAI Assistant using always the same Thread it would make the Workflow a lot cleaner.