Skip to main content

Crate vil_ai_compiler

Crate vil_ai_compiler 

Source
Expand description

§vil_ai_compiler

AI pipeline compiler — compile RAG/agent workflows to optimized execution plans at build time.

§Overview

This crate provides:

  • PipelineNode — the set of node types (Embed, Search, Rerank, Generate, …)
  • PipelineDag / DagBuilder — DAG construction with cycle detection
  • compile() — topological sort, parallel-group identification, transform fusion, redundant-cache elimination
  • execute() / dry_run() — tier-by-tier execution with pluggable handlers

§Quick start

use vil_ai_compiler::dag::DagBuilder;
use vil_ai_compiler::node::PipelineNode;
use vil_ai_compiler::compiler::compile;
use vil_ai_compiler::executor::dry_run;

let dag = DagBuilder::new()
    .node("embed", PipelineNode::Embed { model: "ada".into(), dimensions: 1536 })
    .node("search", PipelineNode::Search { index: "docs".into(), top_k: 10 })
    .edge("embed", "search")
    .build()
    .unwrap();

let plan = compile(&dag).unwrap();
assert_eq!(plan.step_count(), 2);

let report = dry_run(&plan);
assert!(report.all_ok());

Re-exports§

pub use handlers::CompilerStats;
pub use plugin::AiCompilerPlugin;
pub use semantic::CompileEvent;
pub use semantic::CompileFault;
pub use semantic::CompilerState;

Modules§

compiler
Compiler: optimize a PipelineDag into a CompiledPlan.
config
Configuration types for the AI pipeline compiler.
dag
DAG representation and builder for AI pipelines.
executor
Executor: run a CompiledPlan.
handlers
HTTP handlers for the AI compiler plugin — wired to real PipelineDag state.
node
Pipeline node types for AI workflow DAGs.
pipeline_sse
plugin
semantic
Semantic types for AI compiler operations.