Assistant API run status stucks

I am sending you the solution as it is structured at the moment and at the same time I will detail how the consumption has been done:

I have raised a series of endpoints to obtain step by step the different identifiers to articulate the chatbot, the consumption flow is:
Assistants (Creation)
Threads (Creation)
Messages (Creation)
Run (Creation)
Retrieve Run (Get the conversation)
Submit tool outputs to run (Get the response from the generative model - Problem here)

The problem occurs when trying to get the response to the request, where I must sense every “x” amount of milliseconds that the request goes from the status “in progress” to “requires_action” and required_action.type with the value “submit_tool_outputs” but I never get the mentioned status but I get “completed” and at that point according to the API documentation it is no longer possible to receive requests.

This is part of my code

//retrieve run using thread id and run id.
completedRun = await openai.beta.threads.runs.retrieve(run.thread_id, run.i

//while status is in_progress or queued continue to attempt to retrieve the
while(completedRun.status === 'in_progress' || completedRun.status === 'queued') {
  completedRun = await openai.beta.threads.runs.retrieve(run.thread_id, r
  await new Promise(resolve => setTimeout(resolve, 1000));
}

//If status is not completed Log the status
if (completedRun.status!== 'completed') {
  console.log(completeRun.status);
}

The error anwser is:

 2024-07-22 15:02:01,567 [13] ERROR TalentAiAPI.Controllers.OutputsToRunController.ProcessOutputsToRunResponse [106] - MESSAGE: Value cannot be null.
Parameter name: source
 2024-07-22 15:02:05,162 [6]  INFO TalentAiAPI.Controllers.OutputsToRunController.MoveNext [44] - MESSAGE: {
  "error": {
    "message": "Runs in status \"completed\" do not accept tool outputs.",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}

can you check if you are indeed getting requires_action status? it is possible that it might not be invoking your tools. in that case, you should check the messages at completed status. it will give you a hint what it is doing (either asking your to provide additional info for the tool or something else).

1 Like