Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

938 B
Raw Blame
use std::{convert::Infallible, pin::Pin};

use crate::{
    traits::backend::{Error, Instance as InstanceTrait},
    types::basic::PcmBatch,
};

pub type Config = ();
pub type StreamConfig = ();
pub type StreamInput = String;
pub type StreamOutput = PcmBatch;
pub type StreamMetrics = Option<Infallible>;

pub trait Backend: Send + Sync {
    fn instance(
        &self,
        reference: String,
        config: Config,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Instance>, Error>> + Send + '_>>;
}

pub trait Instance:
    InstanceTrait<
        StreamConfig = StreamConfig,
        StreamInput = StreamInput,
        StreamOutput = StreamOutput,
        StreamMetrics = StreamMetrics,
    >
{
}

impl<T> Instance for T where
    T: InstanceTrait<
            StreamConfig = StreamConfig,
            StreamInput = StreamInput,
            StreamOutput = StreamOutput,
            StreamMetrics = StreamMetrics,
        >
{
}