aagt_core/agent/
provider.rs1use async_trait::async_trait;
4
5use crate::error::Result;
6use crate::agent::message::Message;
7use crate::agent::streaming::StreamingResponse;
8use crate::skills::tool::ToolDefinition;
9
10mod resilient;
11
12pub use resilient::{ResilientProvider, CircuitBreakerConfig};
13
14#[derive(Debug, Clone, Default)]
16pub struct ChatRequest {
17 pub model: String,
19 pub system_prompt: Option<String>,
21 pub messages: Vec<Message>,
23 pub tools: Vec<ToolDefinition>,
25 pub temperature: Option<f64>,
27 pub max_tokens: Option<u64>,
29 pub extra_params: Option<serde_json::Value>,
31 pub enable_cache_control: bool,
33}
34
35#[async_trait]
39pub trait Provider: Send + Sync {
40 async fn stream_completion(
42 &self,
43 request: ChatRequest,
44 ) -> Result<StreamingResponse>;
45
46 fn name(&self) -> &'static str;
48
49 fn supports_streaming(&self) -> bool {
51 true
52 }
53
54 fn supports_tools(&self) -> bool {
56 true
57 }
58}