How to send data to your client via the Layercode stream
Sometimes you will want your Layercode stream to include additional data.For example, you might want to update the user that the LLM is thinking or looking something up.To do this, you can use the stream.data method. For example:
Copy
stream.data({ status: 'thinking'})
And on the client side, you can receive the data you send: