I have solved it like this:
const run = await this.openai.beta.threads.runs.create(thread, {
assistant_id: assistant.id,
stream: true,
});
for await (const event of run) {
if (event.event === 'thread.run.requires_action') {
const action =
event.data.required_action.submit_tool_outputs.tool_calls[0];
await this.openai.beta.threads.runs.submitToolOutputs(
thread,
event.data.id,
{
tool_outputs: [
{
tool_call_id: action.id,
output: 'true',
},
],
},
);
}
}```