Xybrid

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.1

Stage Formats

Simple Format

Reference a model by ID and version:

stages:
  - wav2vec2-base-960h@1.0
  - kokoro-82m@0.1

Object 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.1

Execution Targets

TargetDescriptionConfig Source
deviceOn-device inference.xyb bundle from registry
integrationThird-party APIProvider config (OpenAI, Anthropic)
autoFramework decidesResolved at runtime

Input Types

Declare expected input type for validation:

input:
  kind: "AudioRaw"   # For ASR pipelines
input:
  kind: "Text"       # For TTS or text pipelines
input:
  kind: "Embedding"  # For vector search

Data Flow

Each stage transforms an Envelope:

Stage TypeInputOutput
ASR (Whisper)AudioRawText
LLM (GPT-4o)TextText
TTS (Kokoro)TextAudioRaw

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: 3

Integration Providers

Supported providers for cloud LLM stages:

ProviderModelsNotes
openaigpt-4o, gpt-4o-miniRequires OPENAI_API_KEY
anthropicclaude-3-5-sonnetRequires 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.1

Speech-to-Text Only

name: "Transcription"
registry: "http://localhost:8080"

input:
  kind: "AudioRaw"

stages:
  - wav2vec2-base-960h@1.0

Text-to-Speech Only

name: "TTS"
registry: "http://localhost:8080"

input:
  kind: "Text"

stages:
  - kitten-tts-nano@1.0

Running 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

  1. Load - Parse YAML, resolve models from registry
  2. Validate - Check type compatibility between stages
  3. Execute - Run stages sequentially
  4. 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));

On this page