use async_trait::async_trait;
use serde_json::Value;
use super::config::OnnxInferenceConfig;
use crate::core::exceptions::OperonError;
#[async_trait]
pub trait OnnxInferenceBackend: Send + Sync {
async fn run(&self, inputs: Value) -> Result<Value, OperonError>;
}
pub struct OnnxBackend {
pub config: OnnxInferenceConfig,
}
impl OnnxBackend {
pub fn new(config: OnnxInferenceConfig) -> Self {
Self { config }
}
}
#[async_trait]
impl OnnxInferenceBackend for OnnxBackend {
async fn run(&self, _inputs: Value) -> Result<Value, OperonError> {
#[cfg(feature = "onnx")]
{
return Err(OperonError::Provider(format!(
"OnnxBackend::run not yet implemented (Phase 5b) — model_path={}",
self.config.model_path
)));
}
#[cfg(not(feature = "onnx"))]
{
Err(OperonError::Provider(
"operonx built without the `onnx` feature — rebuild with --features onnx".into(),
))
}
}
}