Assistant api function call streaming w/ node lib in nextjs

Thank you for you answer!
Unfortunately, I’ve already read that part of the documentation but it’s not clear to me how can i do it whitout OOP, and most important to me, it’s not clear how can I return the “stream.toReadableStream()” to the client inside the API handler on nextjs, even if i use “submitToolOutputsStream” like:

...
	let stream = openai.beta.threads.runs.stream(thread_id, { assistant_id })
       .on("event", async ({ event, data }) => {
			if (
				event === "thread.run.requires_action" &&
				data.status === "requires_action" &&
				data.required_action?.type === "submit_tool_outputs"
			) {
				const tool_outputs = await Promise.all(	... );

				stream = openai.beta.threads.runs.submitToolOutputsStream(thread_id, data.id, {
					tool_outputs,
				});
			}
		});
	return new Response(stream.toReadableStream());
	...