(
config: LlmConfig,
lightweight_mode: Option<bool>,
timeout_seconds: Option<u64>,
debug: Option<bool>,
)
| 102 | #[pyo3(signature = (config, lightweight_mode=None, timeout_seconds=None, debug=None))] |
| 103 | #[allow(unused_variables)] |
| 104 | fn new( |
| 105 | config: LlmConfig, |
| 106 | lightweight_mode: Option<bool>, |
| 107 | timeout_seconds: Option<u64>, |
| 108 | debug: Option<bool>, |
| 109 | ) -> PyResult<Self> { |
| 110 | // Validate inputs |
| 111 | if let Some(timeout) = timeout_seconds { |
| 112 | if timeout == 0 || timeout > 3600 { |
| 113 | return Err(validation_error( |
| 114 | "timeout_seconds", |
| 115 | Some(&timeout.to_string()), |
| 116 | "Timeout must be between 1 and 3600 seconds", |
| 117 | )); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | let mut exec_config = ExecutionConfig::default(); |
| 122 | |
| 123 | // Set timeout if specified |
| 124 | if let Some(timeout) = timeout_seconds { |
| 125 | exec_config.timeout = Duration::from_secs(timeout); |
| 126 | } |
| 127 | |
| 128 | // Set debug mode - defaults to false |
| 129 | exec_config.enable_tracing = debug.unwrap_or(false); |
| 130 | |
| 131 | if exec_config.enable_tracing { |
| 132 | info!( |
| 133 | "Created executor with mode: {:?}, timeout: {:?}", |
| 134 | exec_config.mode, exec_config.timeout |
| 135 | ); |
| 136 | } |
| 137 | |
| 138 | Ok(Self { |
| 139 | config: exec_config, |
| 140 | llm_config: config, |
| 141 | stats: ExecutionStats::default(), |
| 142 | }) |
| 143 | } |
| 144 | |
| 145 | /// Execute a workflow with comprehensive error handling and monitoring. |
| 146 | /// |
nothing calls this directly
no test coverage detected