Transform Pipelines
Using transformations to clean, reshape, and enrich data as it flows through a pipeline — before, after, and around AI calls.
Simple Transformations
// Extract content from an AI response
pipeline = aiMessage()
.user( "Say hello" )
.toDefaultModel()
.transform( r => r.content )
// Chain multiple transforms
pipeline = aiMessage()
.user( "List 3 colors separated by commas" )
.toDefaultModel()
.transform( r => r.content ) // Extract
.transform( text => text.split( "," ) ) // Split into array
.transform( arr => arr.map( s => s.trim() ) ) // Trim each
.transform( arr => arr.filter( s => s.len() > 0 ) ) // Remove empties
result = pipeline.run()
// Result: ["Red", "Blue", "Green"]Pre-Processing
Post-Processing
Bidirectional Processing
Using Named Transformer Types
Related Pages
Last updated