oxicode_ai/providers/
trait_def.rs1use crate::error::ProviderError;
4use crate::{Context, Model, ProviderEvent, StreamOptions};
5use futures::Stream;
6use std::future::Future;
7use std::pin::Pin;
8
9pub type StreamResult = Result<Pin<Box<dyn Stream<Item = ProviderEvent> + Send>>, ProviderError>;
11
12pub trait Provider: Send + Sync + 'static {
16 fn stream<'a>(
18 &'a self,
19 model: &'a Model,
20 context: &'a Context,
21 options: Option<StreamOptions>,
22 ) -> Pin<Box<dyn Future<Output = StreamResult> + Send + 'a>>;
23}