Is it possible we support stream? #3169
Replies: 11 comments 3 replies
-
Can you elaborate what you mean? |
Beta Was this translation helpful? Give feedback.
-
Can we stream partial responses like in this case I am working with openai sdk and it supports this streaming const res = await openai.createCompletion({
model: "text-davinci-002",
prompt: "Say this is a test",
max_tokens: 6,
temperature: 0,
stream: true,
}, { responseType: 'stream' });
res.on('data', console.log) How can we achieve this in trpc ? |
Beta Was this translation helpful? Give feedback.
-
Any updates on this? |
Beta Was this translation helpful? Give feedback.
-
I've already tackled it by using subscriptions https://trpc.io/docs/subscriptions. It's just what I need @johnmasonwilliams |
Beta Was this translation helpful? Give feedback.
-
Subscriptions are still not ideal, as that rules out deployment on Vercel. SSE can be implemented on Vercel using the Edge runtime, but the edge runtime seems to break the tRPC api handler. |
Beta Was this translation helpful? Give feedback.
-
Thinking about this too. Dealing with some large JSON files I'd like to stream through the backend. Haven't dug into this codebase but at face value it seems like something that could be supported by a flag like proposed and the client would handle reading the stream and returning the fully resolved response. |
Beta Was this translation helpful? Give feedback.
-
is there any update on this? |
Beta Was this translation helpful? Give feedback.
-
Yo! Sorry for the radio silence - I had a priority project come up that I had to focus on, but this is now back on my plate! 🚧👷♂️ |
Beta Was this translation helpful? Give feedback.
-
Is there any updated on this? |
Beta Was this translation helpful? Give feedback.
-
Is there any update on this? |
Beta Was this translation helpful? Give feedback.
-
@tgdn @yaminagile @joseph-mccombs @cyrus-za Quick update: Seeing good progress; Most tests passing currently. A few semantics to work out still. If you'd like to help get it over the hump check out this draft pr (where I've added more information) and see if you can get any of the last few tests passing 😉 |
Beta Was this translation helpful? Give feedback.
-
https://github.com/trpc/trpc/search?q=stream
It's really useful and we could provide an option to specify the implementation.
Beta Was this translation helpful? Give feedback.
All reactions