Skip to main content

InferenceEngine

Trait InferenceEngine 

Source
pub trait InferenceEngine: Send + Sync {
Show 14 methods // Required methods fn infer<'life0, 'async_trait>( &'life0 self, request: InferenceRequest, ) -> Pin<Box<dyn Future<Output = Result<InferenceResponse>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn infer_stream<'life0, 'async_trait>( &'life0 self, request: InferenceRequest, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamChunk>> + Send>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = EngineStatus> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn config(&self) -> &EngineConfig; fn metrics(&self) -> EngineMetrics; fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn embed_text<'life0, 'life1, 'async_trait>( &'life0 self, _text: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn embed_image<'life0, 'life1, 'async_trait>( &'life0 self, _image: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn embedding_dim(&self) -> usize { ... } fn transcribe_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _path: &'life1 str, _language: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn transcribe_bytes<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _data: &'life1 [u8], _language: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn synthesize_speech<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _text: &'life1 str, _language: Option<&'life2 str>, _chunk_frames: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn tts_sample_rate(&self) -> u32 { ... }
}
Expand description

Core inference engine trait

Required Methods§

Source

fn infer<'life0, 'async_trait>( &'life0 self, request: InferenceRequest, ) -> Pin<Box<dyn Future<Output = Result<InferenceResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute single inference request

Source

fn infer_stream<'life0, 'async_trait>( &'life0 self, request: InferenceRequest, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamChunk>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute streaming inference request

Source

fn status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = EngineStatus> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get current engine status

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Shutdown engine gracefully

Source

fn config(&self) -> &EngineConfig

Get engine configuration

Source

fn metrics(&self) -> EngineMetrics

Get engine metrics

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Health check

Provided Methods§

Source

fn embed_text<'life0, 'life1, 'async_trait>( &'life0 self, _text: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Embed raw text string → float vector (engine handles tokenization).

Source

fn embed_image<'life0, 'life1, 'async_trait>( &'life0 self, _image: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Embed image (file path or base64) → float vector. Default: not supported.

Source

fn embedding_dim(&self) -> usize

Get embedding dimension. Default: 0 (not an embedding model).

Source

fn transcribe_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _path: &'life1 str, _language: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Transcribe audio file → text. Default: not supported.

Source

fn transcribe_bytes<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _data: &'life1 [u8], _language: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Transcribe audio bytes (WAV) → text. Default: not supported.

Source

fn synthesize_speech<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _text: &'life1 str, _language: Option<&'life2 str>, _chunk_frames: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Synthesize speech → PCM audio chunks (streaming). Returns Vec of (chunk_index, PCM f32 samples). Default: not supported.

Source

fn tts_sample_rate(&self) -> u32

Get TTS sample rate (default 24000).

Implementors§