telos_agent/model/provider/deepseek/
config.rs1use crate::error::AgentError;
2
3#[derive(Clone)]
5pub struct DeepSeekConfig {
6 pub api_key: String,
7 pub model: String,
8 pub base_url: String,
11}
12
13impl std::fmt::Debug for DeepSeekConfig {
14 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15 f.debug_struct("DeepSeekConfig")
16 .field("api_key", &"[REDACTED]")
17 .field("model", &self.model)
18 .field("base_url", &self.base_url)
19 .finish()
20 }
21}
22
23impl DeepSeekConfig {
24 pub fn new(api_key: impl Into<String>, model: impl Into<String>) -> Self {
26 Self {
27 api_key: api_key.into(),
28 model: model.into(),
29 base_url: "https://api.deepseek.com".into(),
30 }
31 }
32
33 pub fn from_env(model: impl Into<String>) -> Result<Self, AgentError> {
39 let api_key = std::env::var("DEEPSEEK_API_KEY")
40 .map_err(|_| AgentError::Config("missing DEEPSEEK_API_KEY".into()))?;
41
42 Ok(Self::new(api_key, model))
43 }
44}