n8n icon indicating copy to clipboard operation
n8n copied to clipboard

OpenAI Assistant creating new thread everytime

Open yuri12344 opened this issue 1 year ago • 3 comments

Bug Description

When I chat open ai assistant, with chat + send message to assistant, it works fine, but when I try to use it without chat, even if I pass same variables as chat, he keep creating new threads, and never keep to the same thread.

To Reproduce

  1. Create send message to assistant, try use it with chat, it should works fine
  2. Create a set, and input the messages and variable, as it chat return, sessionId, action: sendMessage, and chatInput
  3. He will create a new thread every time you execute it manually, instead of keep in the same thread

Expected behavior

It should continue in same thread and keep conversation

Operating System

Ubuntu

n8n Version

Latest

Node.js Version

20

Database

PostgreSQL

Execution mode

main (default)

yuri12344 avatar May 14 '24 16:05 yuri12344

Hey @yuri12344,

I am not fully following what the issue is here, Are you able to provide an example workflow? I would kind of expect any thread history to only be available when using the chat option or memory which it sounds like is working as expected.

It would be interesting to see what you are actually doing so we can work out if it should use an existing thread or not.

Joffcom avatar May 15 '24 06:05 Joffcom

@Joffcom I have made a video about it, I think it shows better, just 3 mins videos, check it out please https://youtu.be/VayYhBoWWDM

yuri12344 avatar May 15 '24 14:05 yuri12344

Just simple workflow My_workflow.json

yuri12344 avatar May 15 '24 14:05 yuri12344

Agree. This is an issue. Same Chat should not create a new Thread in OpenAI. By using the same thread we do not need to resend all conversation again. This is already stored in the thread. https://platform.openai.com/docs/api-reference/threads/object

gvargas9 avatar May 16 '24 14:05 gvargas9

I have taken a quick look and I can see the issue, When using chat the node takes the inputs in a different way as we expect the session / thread to be stored / used but on manual messages we don't currently support passing in that input.

Technically this is a feature request not a bug as it is working as intended but I have created NODE-1357 as the internal dev ticket to have this added as it could be a fairly quick change when we next look to touch that node.

Joffcom avatar May 17 '24 09:05 Joffcom