1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use serde_json::{Map, Value};
/// Internal configuration struct bridging [`Request`](crate::Request) to raw
/// provider functions. Not part of the public API.
#[derive(Debug, Clone)]
pub struct AgentConfig {
/// Provider API base URL (e.g. `"https://api.deepseek.com"`).
pub base_url: String,
/// Model identifier (e.g. `"deepseek-chat"`, `"gpt-4o"`).
pub model: String,
/// Optional system prompt prepended to every request.
pub system_prompt: Option<String>,
/// Maximum tokens to generate. `None` = provider default.
pub max_tokens: Option<u32>,
/// Sampling temperature. `None` = provider default.
pub temperature: Option<f32>,
/// Extra JSON fields merged into the request body (provider-specific).
pub extra_body: Map<String, Value>,
/// Response format constraint (provider support varies).
pub response_format: Option<crate::request::ResponseFormat>,
/// Maximum number of retries for transient errors. Default: 3.
pub max_retries: u32,
/// Initial delay between retries in milliseconds. Default: 1000ms.
pub retry_delay_ms: u64,
}
impl Default for AgentConfig {
fn default() -> Self {
Self {
base_url: String::new(),
model: String::new(),
system_prompt: None,
max_tokens: None,
temperature: None,
extra_body: Map::new(),
response_format: None,
max_retries: 3,
retry_delay_ms: 1000,
}
}
}