model_gateway_rs/traits/core.rs
1use async_trait::async_trait;
2use toolcraft_request::ByteStream;
3
4use crate::error::Result;
5
6/// Trait for normal model inference
7#[async_trait]
8pub trait ModelClient<I, O> {
9 async fn infer(&self, input: I) -> Result<O>;
10}
11
12/// Trait for stream-based model inference
13#[async_trait]
14pub trait StreamModelClient<I> {
15 async fn infer_stream(&self, input: I) -> Result<ByteStream>;
16}