pub mod anthropic;
pub mod gemini;
pub mod ollama;
pub mod openai;
#[cfg(test)]
mod tool_events_tests;
use crate::error::Result;
use crate::types::{Event, ModelInfo, Response, ResponseRequest};
use std::future::Future;
pub trait ListModels {
fn list_models(
&self,
http: &reqwest::Client,
api_key: &str,
base_url: &str,
) -> impl Future<Output = Result<Vec<ModelInfo>>> + Send;
}
pub(crate) trait ProviderClient {
async fn send(
&self,
http: &reqwest::Client,
api_key: &str,
base_url: &str,
req: ResponseRequest,
) -> Result<Response>;
async fn stream<F>(
&self,
http: &reqwest::Client,
api_key: &str,
base_url: &str,
req: ResponseRequest,
on_event: &mut F,
) -> Result<Response>
where
F: FnMut(Event) + ?Sized;
}
#[async_trait::async_trait(?Send)]
pub trait ProviderApi: Send + Sync {
fn provider(&self) -> crate::types::Provider;
async fn send(&self, http: &reqwest::Client, req: ResponseRequest) -> Result<Response>;
async fn stream(
&self,
http: &reqwest::Client,
req: ResponseRequest,
on_event: &mut dyn FnMut(Event),
) -> Result<Response>;
async fn list_models(&self, http: &reqwest::Client) -> Result<Vec<ModelInfo>>;
}