1pub mod anthropic;
7pub mod factory;
8pub mod http;
9pub mod openai;
10mod types;
11pub mod zhipu;
12
13pub use anthropic::AnthropicClient;
15pub use factory::{create_client_with_config, LlmConfig};
16pub use http::{
17 clear_http_metrics_callback, default_http_client, set_http_metrics_callback, HttpClient,
18 HttpMetricsCallback, HttpMetricsRecord, HttpResponse, StreamingHttpResponse,
19};
20pub use openai::OpenAiClient;
21pub use types::*;
22pub use zhipu::ZhipuClient;
23
24use anyhow::Result;
25use async_trait::async_trait;
26use tokio::sync::mpsc;
27use tokio_util::sync::CancellationToken;
28
29#[async_trait]
31pub trait LlmClient: Send + Sync {
32 async fn complete(
34 &self,
35 messages: &[Message],
36 system: Option<&str>,
37 tools: &[ToolDefinition],
38 ) -> Result<LlmResponse>;
39
40 async fn complete_streaming(
44 &self,
45 messages: &[Message],
46 system: Option<&str>,
47 tools: &[ToolDefinition],
48 cancel_token: CancellationToken,
49 ) -> Result<mpsc::Receiver<StreamEvent>>;
50}
51
52#[cfg(test)]
54#[path = "tests.rs"]
55mod tests_file;