55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
|
|
"""
|
||
|
|
Configuration management for AI Service.
|
||
|
|
[AC-AISVC-01] Centralized configuration with environment variable support.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from functools import lru_cache
|
||
|
|
|
||
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||
|
|
|
||
|
|
|
||
|
|
class Settings(BaseSettings):
|
||
|
|
model_config = SettingsConfigDict(env_prefix="AI_SERVICE_", env_file=".env", extra="ignore")
|
||
|
|
|
||
|
|
app_name: str = "AI Service"
|
||
|
|
app_version: str = "0.1.0"
|
||
|
|
debug: bool = False
|
||
|
|
|
||
|
|
host: str = "0.0.0.0"
|
||
|
|
port: int = 8080
|
||
|
|
|
||
|
|
request_timeout_seconds: int = 20
|
||
|
|
sse_ping_interval_seconds: int = 15
|
||
|
|
|
||
|
|
log_level: str = "INFO"
|
||
|
|
|
||
|
|
llm_provider: str = "openai"
|
||
|
|
llm_api_key: str = ""
|
||
|
|
llm_base_url: str = "https://api.openai.com/v1"
|
||
|
|
llm_model: str = "gpt-4o-mini"
|
||
|
|
llm_max_tokens: int = 2048
|
||
|
|
llm_temperature: float = 0.7
|
||
|
|
llm_timeout_seconds: int = 30
|
||
|
|
llm_max_retries: int = 3
|
||
|
|
|
||
|
|
database_url: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/ai_service"
|
||
|
|
database_pool_size: int = 10
|
||
|
|
database_max_overflow: int = 20
|
||
|
|
|
||
|
|
qdrant_url: str = "http://localhost:6333"
|
||
|
|
qdrant_collection_prefix: str = "kb_"
|
||
|
|
qdrant_vector_size: int = 1536
|
||
|
|
|
||
|
|
rag_top_k: int = 5
|
||
|
|
rag_score_threshold: float = 0.7
|
||
|
|
rag_min_hits: int = 1
|
||
|
|
rag_max_evidence_tokens: int = 2000
|
||
|
|
|
||
|
|
confidence_threshold_low: float = 0.5
|
||
|
|
max_history_tokens: int = 4000
|
||
|
|
|
||
|
|
|
||
|
|
@lru_cache
|
||
|
|
def get_settings() -> Settings:
|
||
|
|
return Settings()
|