pub trait PredictHandler:
Send
+ Sync
+ 'static {
// Required methods
fn setup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), SetupError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn predict<'life0, 'async_trait>(
&'life0 self,
slot: SlotId,
id: String,
input: Value,
slot_sender: Arc<SlotSender>,
context: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = PredictResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn cancel(&self, slot: SlotId);
// Provided method
fn healthcheck<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthcheckResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait for the prediction handler - abstracts the Python integration.
Required Methods§
Sourcefn setup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), SetupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn setup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), SetupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the predictor (load model, run setup).
Provided Methods§
Sourcefn healthcheck<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthcheckResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn healthcheck<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthcheckResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run user-defined healthcheck. Default: healthy.