Skip to main content
Streaming sends live output from a model over a server-sent event (SSE) stream. It works with any Python object that implements the iterator or generator protocol. The generator/iterator must yield data, which is sent downstream via the text/event-stream Content-Type. Data can be sent in JSON format and decoded on the client side. A minimal example:
Deploy this snippet and call the endpoint. SSE events appear progressively, one per second:
This should output:
The remaining data streams in every second:
Postman also supports SSE streams natively. Streaming For a Falcon-7B streaming example, see the streaming endpoint example.