aiAI TOOLS.
THE ARTIFICIAL INTELLIGENCE DIRECTORY
Top 100
◎  EN
Build a workflow

Streaming: progressive responses

Find out about the pieced reception and the necessary controls before you act on the content.

Receive without waiting for the end

Streaming allows you to receive events or songs during the production of the result. An interface can display the text as it goes. This may reduce the perceived expectation, but does not mean that total production is shorter or that the answer is already finished when the first words appear.

The event format depends on the API. Some messages contain text, others contain status or tool information. Do not treat all events as a sentence to display. Consult the documentation of the route used.

Manage incomplete response

A connection can be interrupted before the end. Your application must distinguish a complete response from an extract. For a JSON document or object, do not apply an operation on the first part only received. Keep a statement indicating whether the production has been completed normally.

Check the actual route

Test a short request, a long one and an interruption. Check any overlaps and duplicates. Errors may occur during the flow, not just before it is opened. Keep the identifiers useful for understanding an execution without unnecessarily recording sensitive data.

Streaming must also remain accessible: the user must understand the state of work and be able to read without being forced to follow every change. Provide a stable final version and a possibility to restart according to the rules of your application.

Questions before you start

Does Streaming mean that the result is over from the first word?

No. End events and full status must be checked.

Can a partial JSON be used immediately?

Wait for full content and validate its structure before a dependent operation.

Do all APIs use the same events?

No. Consult the format and types documented by the supplier.

Continue learning

Official documentation