use crate::{InvokeError, PythonOwned}; use litellm_host::protocol::Protocol; use pyo3::prelude::*; pub trait PythonHostCalls: PythonOwned { fn handle_host_call( &mut self, py: Python<'_>, call: P::HostCall, ) -> Result<(), InvokeError>; fn begin_host_call( &mut self, py: Python<'_>, call: P::HostCall, ) -> Result>, InvokeError> { self.handle_host_call(py, call).map(|()| None) } fn resume_host_call( &mut self, _: Python<'_>, result: PyResult>, ) -> Result>, InvokeError> { result.map(|_| None).map_err(InvokeError::Python) } }