use std::future::Future; use pyo3::prelude::*; use serde::Serialize; pub(crate) fn run_sync( py: Python<'_>, future: F, map_error: fn(E) -> PyErr, ) -> PyResult> where T: Serialize + Send + 'static, E: Send + 'static, F: Future> + Send + 'static, { litellm_host_python::run_sync(py, crate::logger::capture(py).instrument(future), map_error) } pub(crate) fn run_async( py: Python<'_>, future: F, map_error: fn(E) -> PyErr, ) -> PyResult> where T: Serialize + Send + 'static, E: Send + 'static, F: Future> + Send + 'static, { litellm_host_python::run_async(py, crate::logger::capture(py).instrument(future), map_error) } pub(crate) fn run_sync_value(py: Python<'_>, future: F) -> PyResult where T: Send + 'static, F: Future> + Send + 'static, { litellm_host_python::run_sync_value(py, crate::logger::capture(py).instrument(future)) } pub(crate) fn run_async_value(py: Python<'_>, future: F) -> PyResult> where T: for<'py> IntoPyObject<'py> + Send + 'static, F: Future> + Send + 'static, { litellm_host_python::run_async_value(py, crate::logger::capture(py).instrument(future)) }