Files
smart-support/backend/app/config.py
Yaojia Wang 1050df780d feat: complete phase 2 -- multi-agent routing, interrupt TTL, escalation, templates
- Intent classification with LLM structured output (single/multi/ambiguous)
- Discount agent with apply_discount and generate_coupon tools
- Interrupt manager with 30-min TTL auto-expiration and retry prompts
- Webhook escalation module with exponential backoff retry (max 3)
- Three vertical industry templates (e-commerce, SaaS, fintech)
- Template loading in AgentRegistry
- Enhanced supervisor prompt with dynamic agent descriptions
- 153 tests passing, 90.18% coverage
2026-03-30 21:04:39 +02:00

53 lines
1.4 KiB
Python

"""Centralized application configuration via pydantic-settings."""
from __future__ import annotations
from typing import Literal
from pydantic import model_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
extra="ignore",
)
database_url: str
llm_provider: Literal["anthropic", "openai", "google"] = "anthropic"
llm_model: str = "claude-sonnet-4-6"
session_ttl_minutes: int = 30
interrupt_ttl_minutes: int = 30
ws_host: str = "0.0.0.0"
ws_port: int = 8000
webhook_url: str = ""
webhook_timeout_seconds: int = 10
webhook_max_retries: int = 3
template_name: str = ""
anthropic_api_key: str = ""
openai_api_key: str = ""
google_api_key: str = ""
@model_validator(mode="after")
def validate_provider_key(self) -> Settings:
key_map = {
"anthropic": self.anthropic_api_key,
"openai": self.openai_api_key,
"google": self.google_api_key,
}
key = key_map.get(self.llm_provider, "")
if not key:
raise ValueError(
f"API key for provider '{self.llm_provider}' is required. "
f"Set the corresponding environment variable."
)
return self