Skip to content

AI Streaming result #12195

@gerhardcit

Description

@gerhardcit

Which Cloudflare product(s) does this pertain to?

Workers AI

Subject Matter

How to get hold of the ai.run results streamed to the client.

Content Location

https://developers.cloudflare.com/workers-ai

Additional information

ai.run has an option to stream. This stream can be sent to the client.
Please provide a clear example of how one would catch the full result of the stream on the server side in order to log the result, size of the result or anything else about it.

It's very probable that you would want to keep track of answers given to clients, and therefore having the full result is important. this is easily logged in a blocking result, but not when streaming.

the stream produced by ai.stream does not have a .on('data') event which would be what you would expect.

Metadata

Metadata

Labels

content:newRequest for new/missing contentdocumentationDocumentation editsexampleproduct:workers-aiWorkers AI: https://developers.cloudflare.com/workers-ai/

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions