use deepseek_recipe_core::multimodal::ImageInfo;
mod error;
#[cfg(feature = "reqwest-fetch")]
mod fetcher;
mod limits;
#[cfg(feature = "opencv-preprocess")]
mod opencv;
mod resolver;
mod retry;
pub use error::ImageError;
#[cfg(feature = "reqwest-fetch")]
pub use fetcher::ReqwestImageFetcher;
pub use limits::{ImageByteBudget, ImageLimits, ImageQuota, PreprocessOptions};
#[cfg(feature = "opencv-preprocess")]
pub use opencv::OpenCvImagePreprocessor;
pub use resolver::ImageResolver;
pub use retry::RetryPolicy;
use std::future::Future;
pub trait ImageFetcher: Send + Sync {
fn fetch(
&self,
url: &str,
budget: &ImageByteBudget,
) -> impl Future<Output = Result<Vec<u8>, ImageError>> + Send {
let _ = (url, budget);
async {
Err(ImageError::Unsupported(
"image fetching requires an ImageFetcher implementation",
))
}
}
}
pub trait ImagePreprocessor: Send + Sync {
fn preprocess(
&self,
data: Vec<u8>,
options: PreprocessOptions,
) -> impl Future<Output = Result<ImageInfo, ImageError>> + Send {
let _ = (data, options);
async {
Err(ImageError::Unsupported(
"image preprocessing requires an ImagePreprocessor implementation",
))
}
}
}