Streaming responses from HttpApi of my own schema types
The
Let's say I have this piece of code:
Now, this works great, if I convert everything using
Of course it works fine like that, if I convert it, but in order to materialise it on the client side, I would have to perhaps add a discriminator, like
Is there a baked-in way to have effect encode and decode automatically when streaming?
HttpApi streaming stuff appears to have improved greatly since I looked last a few months ago. Or maybe I got that wrong and I just understand it better!Let's say I have this piece of code:
Now, this works great, if I convert everything using
TextEncoder, even my own schema types. But I would like to know if the above code can be augmented to support my own schemas, like this:Of course it works fine like that, if I convert it, but in order to materialise it on the client side, I would have to perhaps add a discriminator, like
type: 'AIMessage', or something like that.Is there a baked-in way to have effect encode and decode automatically when streaming?
