From cd8e574f79f13c855b4b764d525b4315d34a4b94 Mon Sep 17 00:00:00 2001 From: Dao Hoang Son Date: Sat, 20 Jul 2024 16:07:23 +0700 Subject: [PATCH] Also force new thread in case of incomplete run --- packages/openai/src/agent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/openai/src/agent.ts b/packages/openai/src/agent.ts index f8230f8..16017eb 100644 --- a/packages/openai/src/agent.ts +++ b/packages/openai/src/agent.ts @@ -72,7 +72,7 @@ class AgentStreamer { const { ctx, threadId, tools } = this; if (functionToolCalls.length === 0) { - if (run.status === "failed") { + if (run.status === "failed" || run.status === "incomplete") { for (const tool of tools) { if (tool.name === "new_thread") { // force new thread in case of run failure