OpenAIStream output
Unanswered
Craveri's Murrelet posted this in #help-forum
Craveri's MurreletOP
Hey I'm using the pages dir and making a chat bot using open ai chat completions. I've followed the documentation for the backend. It streams to my front end except it seems to add some sort of index that is prefixed to every chunk. Pattern matching doesn't really seem like a suitable fix to this as there are too many possibilities.
Here is an example output: "0:"Hello" 0:"!" 0:" I" 0:"'m" 0:" doing" 0:" well" 0:"," 0:" thank" 0:" you" 0:" for" 0:" asking" 0:"." 0:" How" 0:" can" 0:" I" 0:" assist" 0:" you" 0:" today" 0:"?""
Here is an example output: "0:"Hello" 0:"!" 0:" I" 0:"'m" 0:" doing" 0:" well" 0:"," 0:" thank" 0:" you" 0:" for" 0:" asking" 0:"." 0:" How" 0:" can" 0:" I" 0:" assist" 0:" you" 0:" today" 0:"?""
1 Reply
Stream using Vercel's AI sdk so you dont have to handle the boilerplate:
https://vercel.com/docs/recipes/streaming-from-llm
https://vercel.com/docs/recipes/streaming-from-llm