Output
Output Stream
Passing stream: true
to the message.create
method will return an async iterator that yields response objects.
Response object
No matter the provider
used the response object will stay consistent to the following schema
The response object is the same as the one used in the static output. The only
difference is that the id
and model
fields are optional.
This is because the streaming response object is not the final response object.
It’s a partial response object that will be updated as the model generates more
tokens. So the id
and model
fields might be generated at any step in the
stream.
👉 Static response object