(mut self, callback: F)
| 403 | } |
| 404 | |
| 405 | pub fn with_switch_agent<F, Fut>(mut self, callback: F) -> Self |
| 406 | where |
| 407 | F: Fn(String, Option<String>) -> Fut + Send + Sync + 'static, |
| 408 | Fut: std::future::Future<Output = Result<(), ToolError>> + Send + 'static, |
| 409 | { |
| 410 | self.switch_agent = Some(Arc::new(move |agent, model| { |
| 411 | Box::pin(callback(agent, model)) |
| 412 | })); |
| 413 | self |
| 414 | } |
| 415 | |
| 416 | pub async fn do_switch_agent( |
| 417 | &self, |