scouter_settings/
llm.rs

1use potato_head::{GoogleAuth, OpenAIAuth};
2use serde::Serialize;
3
4#[derive(Debug, Clone, Serialize, Default)]
5pub struct LLMSettings {
6    is_configured: bool,
7}
8
9impl LLMSettings {
10    pub async fn new() -> Self {
11        // Check if either OpenAI or Google authentication is configured
12        let openai_configured = !matches!(OpenAIAuth::from_env(), OpenAIAuth::NotSet);
13        let google_configured = !matches!(GoogleAuth::from_env().await, GoogleAuth::NotSet);
14
15        Self {
16            is_configured: openai_configured || google_configured,
17        }
18    }
19    /// Used by server to check if the LLM settings are configured.
20    pub fn is_configured(&self) -> bool {
21        self.is_configured
22    }
23}