Crate llm_orchestrator_core

Crate llm_orchestrator_core 

Source
Expand description

LLM Orchestrator Core - Workflow orchestration engine for LLM pipelines.

This crate provides the core functionality for defining, validating, and executing multi-step LLM workflows with support for DAG-based execution, parallel processing, and fault tolerance.

§Example

use llm_orchestrator_core::{Workflow, ExecutionContext};
use serde_json::json;

// Load workflow from YAML
let yaml = r#"
name: "simple-workflow"
steps:
  - id: "step1"
    type: "llm"
    provider: "openai"
    model: "gpt-4"
    prompt: "Say hello to {{ name }}"
    output: ["greeting"]
"#;

let workflow = Workflow::from_yaml(yaml)?;

// Validate workflow
workflow.validate()?;

// Create execution context
let mut inputs = std::collections::HashMap::new();
inputs.insert("name".to_string(), json!("World"));
let ctx = ExecutionContext::new(inputs);

// Render template with context
let prompt = ctx.render_template("Say hello to {{ name }}")?;
assert_eq!(prompt, "Say hello to World");

Re-exports§

pub use context::ExecutionContext;
pub use dag::WorkflowDAG;
pub use error::OrchestratorError;
pub use error::Result;
pub use executor::StepResult;
pub use executor::StepStatus;
pub use executor::WorkflowExecutor;
pub use retry::RetryExecutor;
pub use retry::RetryPolicy;
pub use workflow::Workflow;
pub use workflow::Step;
pub use workflow::StepType;
pub use workflow::StepConfig;
pub use workflow::LlmStepConfig;
pub use workflow::EmbedStepConfig;
pub use workflow::VectorSearchConfig;
pub use workflow::TransformConfig;
pub use workflow::ActionConfig;
pub use workflow::ParallelConfig;
pub use workflow::BranchConfig;
pub use workflow::RetryConfig;
pub use workflow::BackoffStrategy;

Modules§

context
Execution context management for workflows.
dag
DAG (Directed Acyclic Graph) builder and validator for workflows.
error
Error types for the LLM Orchestrator core.
executor
Workflow execution engine with async Tokio runtime.
executor_state
State persistence integration for WorkflowExecutor.
health
Health check functionality for monitoring system status.
metrics
Prometheus metrics instrumentation for workflow orchestration.
providers
Provider trait definitions (re-exported from llm-orchestrator-providers).
retry
Retry logic with exponential backoff.
workflow
Workflow definition types.

Structs§

CompletionRequest
Completion request.
CompletionResponse
Completion response.

Enums§

ProviderError
Provider error.

Constants§

NAME
Library name.
VERSION
Library version.

Traits§

LLMProvider
LLM provider trait.