pub mod anthropic;
pub mod factory;
pub mod http;
pub mod openai;
mod types;
pub mod zhipu;
pub use anthropic::AnthropicClient;
pub use factory::{create_client_with_config, LlmConfig};
pub use http::{
clear_http_metrics_callback, default_http_client, set_http_metrics_callback, HttpClient,
HttpMetricsCallback, HttpMetricsRecord, HttpResponse, StreamingHttpResponse,
};
pub use openai::OpenAiClient;
pub use types::*;
pub use zhipu::ZhipuClient;
use anyhow::Result;
use async_trait::async_trait;
use tokio::sync::mpsc;
use tokio_util::sync::CancellationToken;
#[async_trait]
pub trait LlmClient: Send + Sync {
async fn complete(
&self,
messages: &[Message],
system: Option<&str>,
tools: &[ToolDefinition],
) -> Result<LlmResponse>;
async fn complete_streaming(
&self,
messages: &[Message],
system: Option<&str>,
tools: &[ToolDefinition],
cancel_token: CancellationToken,
) -> Result<mpsc::Receiver<StreamEvent>>;
}
#[cfg(test)]
#[path = "tests.rs"]
mod tests_file;