Expand description
Workflow execution simulator for dry-run testing
This module provides simulation capabilities for workflows, allowing users to:
- Test workflows without making real API calls
- Validate all execution paths including error handling
- Estimate costs and execution times
- Generate execution traces for debugging
- Test conditional branches and loops
§Example
use oxify_model::*;
use std::collections::HashMap;
let config = LlmConfig {
provider: "openai".to_string(),
model: "gpt-4".to_string(),
system_prompt: None,
prompt_template: "Generate: {{input}}".to_string(),
temperature: Some(0.7),
max_tokens: None,
tools: vec![],
images: vec![],
extra_params: serde_json::Value::Null,
};
let workflow = WorkflowBuilder::new("Test")
.start("start")
.llm("gen", config)
.end("end")
.build();
let mut context = HashMap::new();
context.insert("input".to_string(), serde_json::json!("hello"));
let result = WorkflowSimulator::new()
.with_mock_responses(vec![
("gen".to_string(), serde_json::json!("mock response"))
])
.simulate(&workflow, context);
assert!(result.is_ok());Structs§
- Coverage
Info - Branch coverage information
- Execution
Trace - Execution trace showing the path taken through the workflow
- Node
Execution Detail - Details of a single node execution in simulation
- Simulation
Error - Simulation error
- Simulation
Result - Result of a workflow simulation
- Workflow
Simulator - Workflow simulator for dry-run executions