Replies: 4 comments 3 replies
-
I like this. We need an end-to-end way to give to developers so they can build great interfaces. Currently, when using Livewire, I am basically abstracting a way to pass through chunks to the frontend to then process them in JS. It makes a lot of sense to give the dev an end-to-end way of consuming the events in the frontend. I've struggled myself moving from just streaming the text to streaming whole events. I tried to keep the frontend processing to a minimum, which was wrong. Today, with thinking and tool calls, you really have to process the full stream in the frontend. There is no good in-between imo. I'd also like to see a default frontend implementation for people to reference in different stacks, kind of like @pushpak1300 or my starter kits. |
Beta Was this translation helpful? Give feedback.
-
That's an excellent proposal. I completely agree that an event-based system makes a lot more sense and would provide a solid, standardized architecture. |
Beta Was this translation helpful? Give feedback.
-
Streaming-focused feedback from production use I’m squarely focused on production apps in Laravel, not cloning OpenRouter/LiteLLM in PHP. Prism was a great starting point—I built a small lib on top that focuses only on Streaming and Structured Outputs (kept structured outputs unchanged from Prism). A few lessons from running this at scale in PHP/Laravel:
On the proposal itself: it feels closer to TS/Python streaming patterns than to PHP’s operational constraints. That’s not a knock—just a note that production-ready PHP may need adapted patterns vs. ports. Questions that would help validate the design for PHP/Laravel:
If the design can lock down the above (especially canonical usage and resumability) and provide Laravel-first guidance (queues/events/persistence), it’ll land much closer to what PHP teams need in production. |
Beta Was this translation helpful? Give feedback.
-
Great work @sixlive! The proposed
For example, just this week this was released: https://streamdown.ai/, which is built on those streaming standards and AI Elements (https://ai-sdk.dev/elements/overview/usage). If Prisms default worked out of the box with all of those packages I think that would be a boon to all. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey Prism community! 👋
I've been thinking a lot about our streaming implementation lately, and I want to share a proposal for a pretty significant refactor that could make building real-time AI applications way better. But first, I need your feedback.
The Current State (And Why I Think We Can Do Better)
Right now, our streaming system works around "Chunks" – objects that contain mixed data types. If you've built streaming UIs with Prism, you've probably written code like this:
This works, but I've been hearing from developers that it creates some challenges:
Question for you: Does this match your experience? What other pain points have you hit with the current streaming approach?
The Proposal: Event-Driven Streaming
What I'm proposing is a complete refactor to an event-based system. Instead of chunks with mixed data, you'd get specific events for specific things happening in the stream.
Here's what a typical conversation would look like:
Key Changes
event:
fields and snake_case namingThe Magic: asEventStreamResponse()
The part I'm most excited about is this new method:
This automatically handles all the SSE formatting, headers, and streaming mechanics.
Tool Calls Get First-Class Treatment
For those of you building tool-enabled apps, tool calls would get proper event sequences:
You can watch tool arguments being built incrementally and handle the execution lifecycle properly.
Thinking Events for Reasoning Models
With reasoning models becoming more common, we'd have dedicated events for chain-of-thought:
The Developer Experience
On the frontend, you could build UIs like this:
No more weird state management or hunting for usage data across different chunk types.
Backward Compatibility
I want to be transparent: this would be a breaking change. The
asStream()
method would returnStreamEvent
objects instead ofChunk
objects. However, the method signature stays the same, and the migration path is pretty straightforward:The Vision
My goal is to make Prism the best way to build streaming AI applications. This event system would give you:
But I don't want to build this in a vacuum. Your feedback will shape how this actually works.
This is a proposal, not a commitment. Based on community feedback, the actual implementation might look different. But I wanted to share the direction I'm thinking and get your input before diving in.
Beta Was this translation helpful? Give feedback.
All reactions