Pipelines
Multi-stage ML pipeline definition and YAML DSL reference
A Pipeline is a sequence of stages that transform data. Pipelines are defined in YAML and executed by the SDK, enabling you to chain models together (ASR → LLM → TTS) with automatic routing between device and cloud execution.
How Pipelines Work
Basic Structure
name: "Voice Assistant"
registry: "http://localhost:8080"
input:
kind: "AudioRaw"
stages:
- whisper-tiny@1.0
- kokoro-82m@0.1Stage Formats
Simple Format
Reference a model by ID and version:
stages:
- wav2vec2-base-960h@1.0
- kokoro-82m@0.1Object Format
For more control, use the object format:
stages:
- name: whisper-tiny@1.0
target: device
registry: "http://other-registry:8080"Integration Stages
For cloud LLM execution:
stages:
- whisper-tiny@1.0
- target: integration
provider: openai
model: gpt-4o-mini
options:
system_prompt: "You are a helpful voice assistant."
max_tokens: 150
temperature: 0.7
- kokoro-82m@0.1Execution Targets
| Target | Description | Config Source |
|---|---|---|
device | On-device inference | .xyb bundle from registry |
integration | Third-party API | Provider config (OpenAI, Anthropic) |
auto | Framework decides | Resolved at runtime |
Input Types
Declare expected input type for validation:
input:
kind: "AudioRaw" # For ASR pipelinesinput:
kind: "Text" # For TTS or text pipelinesinput:
kind: "Embedding" # For vector searchData Flow
Each stage transforms an Envelope:
| Stage Type | Input | Output |
|---|---|---|
| ASR (Whisper) | AudioRaw | Text |
| LLM (GPT-4o) | Text | Text |
| TTS (Kokoro) | Text | AudioRaw |
The pipeline validates that outputs match the next stage's expected input.
Registry Configuration
Simple URL
registry: "http://localhost:8080"File Path (Local)
registry: "file:///Users/me/.xybrid/registry"Full Configuration
registry:
local_path: "/Users/me/.xybrid/registry"
remote:
base_url: "http://localhost:8080"
timeout_ms: 30000
retry_attempts: 3Integration Providers
Supported providers for cloud LLM stages:
| Provider | Models | Notes |
|---|---|---|
openai | gpt-4o, gpt-4o-mini | Requires OPENAI_API_KEY |
anthropic | claude-3-5-sonnet | Requires ANTHROPIC_API_KEY |
Example Pipelines
Voice Assistant (ASR → LLM → TTS)
name: "Voice Assistant"
registry: "http://localhost:8080"
input:
kind: "AudioRaw"
stages:
# Speech recognition (on-device)
- whisper-tiny@1.0
# Language model (cloud)
- target: integration
provider: openai
model: gpt-4o-mini
options:
system_prompt: "You are a helpful voice assistant. Keep responses brief."
max_tokens: 150
# Text-to-speech (on-device)
- kokoro-82m@0.1Speech-to-Text Only
name: "Transcription"
registry: "http://localhost:8080"
input:
kind: "AudioRaw"
stages:
- wav2vec2-base-960h@1.0Text-to-Speech Only
name: "TTS"
registry: "http://localhost:8080"
input:
kind: "Text"
stages:
- kitten-tts-nano@1.0Running Pipelines
Flutter SDK
final pipeline = Xybrid.pipeline(filePath: 'assets/pipelines/voice-assistant.yaml');
final result = await pipeline.run(
XybridEnvelope.audio(bytes: audioBytes, sampleRate: 16000),
);
print(result.text);Rust SDK
use xybrid_sdk::PipelineLoader;
let pipeline = PipelineLoader::from_yaml(yaml_content)?
.load()?;
let result = pipeline.run(&input_envelope)?;Pipeline Metadata
Query pipeline properties:
final pipeline = Xybrid.pipeline(filePath: 'pipeline.yaml');
pipeline.name; // "Voice Assistant"
pipeline.stageCount; // 3
pipeline.stageNames; // ["whisper-tiny@1.0", "gpt-4o-mini", "kokoro-82m@0.1"]Lifecycle
- Load - Parse YAML, resolve models from registry
- Validate - Check type compatibility between stages
- Execute - Run stages sequentially
- Unload - Release resources
// Load from YAML
final pipeline = Xybrid.pipeline(yaml: yamlContent);
// Or from file
final pipeline = Xybrid.pipeline(filePath: 'pipeline.yaml');
// Run
final result = await pipeline.run(XybridEnvelope.audio(bytes: audioBytes, sampleRate: 16000));