pub(crate) mod candle_engine;
pub mod factory;
pub use factory::EngineFactory;
pub(crate) mod impl_;
#[cfg(feature = "onnx")]
pub(crate) mod onnx_engine;
use crate::config::model::{ModelConfig, Precision};
use crate::error::VecboostError;
use async_trait::async_trait;
#[async_trait]
pub trait InferenceEngine: Send + Sync {
fn embed(&self, text: &str) -> Result<Vec<f32>, VecboostError>;
fn embed_batch(&self, texts: &[String]) -> Result<Vec<Vec<f32>>, VecboostError>;
fn precision(&self) -> &Precision;
fn supports_mixed_precision(&self) -> bool;
fn is_fallback_triggered(&self) -> bool {
false
}
async fn try_fallback_to_cpu(&mut self, config: &ModelConfig) -> Result<(), VecboostError>;
}
#[allow(clippy::large_enum_variant)]
pub enum AnyEngine {
Candle(candle_engine::CandleEngine),
#[cfg(feature = "onnx")]
Onnx(onnx_engine::OnnxEngine),
}