Could not convert to IterableReadableStream from stream of type IterableReadableStream
or
Could not send entire stream object over Next.js response from route.tsx since response object are not stream object in Next.js by default
Additional: I am not getting redirected using redirect() from route.tsx to a server component neither client component. I haven’t used redirect(‘/’) inside try{}catch{} block but used it inside an if{} block. I have tried to route to ‘/’ by keeping out the redirect(‘/’) from the if{} block to test but still nothing happened.
I was developing a Web App on next.js using Langchain js. I wanted to stream the response to the UI component. Thanks to vercel’s ai sdk, I got StreamingTextResponse
. However the stream I am getting from retrievalChain has chunks of type object and not string.
enter image description here
I want a way either generating an IterableReadableStream from stream of type IterableReadableStream having only data i.e. chunk.answer field or a way where i can send this entire stream to frontEnd where I can destructure the chunked value.
I would love if the first way is preferred and looked into deeply.
thank you to all of you in advance.
Niladri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.