Brian
Brian7d ago

"undefined's stream has ended" in OpenAI Assistant (Stream Response)

Is the attached log just an error if the thread_id does not exist yet? Because at the end of the long error code you can read that the Assistant ID could not be found, though after that it creates a new thread_id? If that's the case, it would be nice if you could catch this error and instead just log something like "no thread_id detected....creating a new one", so it does not look like we made a mistake with the input variables of that node.
No description
5 Replies
AI Support
AI Support7d ago
AI Support Bot Information
<@112676328783802368> you can react on the relevant answer (message) with a ✅ in this thread when you think it has been solved, by the bot or by a human! Anyone can react on this message with a ❌ if the GPT bot is unhelpful or hallucinating answers. Please note: Team members will review and answer the questions on best efforts basis.
AI Support
AI Support7d ago
AI Response
Yes, your assertion is correct. The log you observed appears to indicate an error when the thread_id does not initially exist. This error is followed by the creation of a new thread_id. The error message is indicating that the Assistant ID could not be found, which leads to the creation of a new thread_id. To handle this scenario better and avoid confusion, it would indeed be beneficial to catch this specific error and replace it with a more informative log message such as "No thread_id detected... creating a new one." This approach will make the logs more user-friendly and reduce confusion regarding input variables of the node. You can find more details on handling thread IDs and managing assistant interactions in the BuildShip documentation .
BuildShip AI Support
nithinrdy
nithinrdy7d ago
Hey @Brian, sorry about the confusion, this error isn't because of a missing/non-existent thread ID. As for why a thread is created despite the assistant not having been found, it's simply because the assistant is designed to first generate a thread, and then plug it into an assistant instance to generate responses/conversations. So, to clarify, the assistant creating a new thread is normal when you do not supply a thread ID of your own, and the error that you see is simply because the assistant ID you provided for the node does not correspond to an existing assistant instance (over on platform.openai.com). Could you please double-check and make sure that you're using the right assistant ID? Could you also make sure that your assistant instance is that of the V2 Assistant (that's what the node is designed to work with)?
Brian
Brian7d ago
The Assistant that I setup in Playground is definitely V2 and it's also definitely the right Assistant ID. The ID always starts with "asst_", right? If this is an actual error, then why is the Node not failing? Okay, I just created a new OpenAI API key and a new Assistant and it suddenly works. 🤷‍♂️ Nevertheless I would still suggest that the node should fail if the id was wrong. You could even directly print that on the node if that happens
nithinrdy
nithinrdy7d ago
gotcha, we'll look into this