Pipeline Streaming
Stream data through AI pipelines in real-time for responsive applications.
🚀 Basic Streaming
🔄 Streaming Flow
Stream Through Pipeline
pipeline = aiMessage()
.user( "Tell me a story" )
.toDefaultModel()
pipeline.stream( ( chunk ) => {
content = chunk.choices?.first()?.delta?.content ?: ""
print( content )
} )With Bindings
pipeline = aiMessage()
.system( "You are ${style}" )
.user( "Write about ${topic}" )
.toDefaultModel()
// stream( onChunk, input, params, options )
pipeline.stream(
( chunk ) => print( chunk.choices?.first()?.delta?.content ?: "" ),
{ style: "poetic", topic: "nature" } // input bindings
)With Options
Options in Streaming
Default Options
Runtime Options Override
Message Streaming
Collecting Stream Data
Full Response Collection
Structured Collection
Streaming Patterns
Progress Indicator
Real-Time Display
Chunk Processing
Web Streaming
Server-Sent Events (SSE)
WebSocket Streaming
JSON Streaming
Advanced Streaming
Stream with Transforms
Conditional Streaming
Stream with Timeout
Practical Examples
Interactive Chat
Markdown Renderer
Progress Tracker
Stream Multiplexer
Error Handling
Stream Error Handling
Graceful Degradation
Best Practices
Performance Tips
Next Steps
Last updated