| """Application settings using pydantic-settings.""" |
| from pydantic_settings import BaseSettings, SettingsConfigDict |
| from typing import Optional, Dict |
|
|
|
|
| class Settings(BaseSettings): |
| """Application settings loaded from environment variables.""" |
| |
| |
| openai_api_key: str |
| mistralai_api_key: str |
| |
| |
| jwt_secret_key: str |
| jwt_algorithm: str = "HS256" |
| jwt_expiration_minutes: int = 60 |
| |
| |
| api_title: str = "CAPL Routeur IA API" |
| api_version: str = "1.0.0" |
| environment: str = "development" |
| |
| |
| langchain_tracing_v2: bool = False |
| langchain_api_key: Optional[str] = None |
| langchain_project: str = "routeur-ia" |
|
|
| |
| supabase_url: Optional[str] = None |
| supabase_key: Optional[str] = None |
| supabase_table: str = "documents" |
| supabase_match_fn: str = "match_documents" |
| rag_top_k: int = 5 |
|
|
| |
| |
| vector_indexes: Dict[str, Dict[str, str]] = { |
| "default": {"table": "documents", "query_name": "match_documents"}, |
| |
| "projects": {"table": "project_documents", "query_name": "match_project_documents"}, |
| |
| } |
| |
| |
| max_upload_mb_pdf: int = 50 |
| chunk_size: int = 1000 |
| chunk_overlap: int = 100 |
| doc_default_type: str = "project_doc" |
| |
| |
| postprocessors_enabled: list[str] = [ |
| "carbon_impact", |
| "pricing", |
| "equivalences", |
| ] |
| |
| currency: str = "USD" |
|
|
| |
| pricing: dict = { |
| |
| "mistral-medium-latest": {"input_per_1m": 0.40, "output_per_1m": 2.00}, |
| "mistral-small-latest": {"input_per_1m": 0.10, "output_per_1m": 0.30}, |
| "mistral-large-latest": {"input_per_1m": 2.00, "output_per_1m": 6.00}, |
| "magistral-small-latest": {"input_per_1m": 0.50, "output_per_1m": 1.50}, |
| "magistral-medium-latest": {"input_per_1m": 2.00, "output_per_1m": 5.00}, |
| } |
|
|
| |
| equivalence_ratios: dict = { |
| |
| |
| |
| "smartphone_per_kgCO2eq": 0.011643, |
| |
| "car_km_per_kgCO2eq": 4.566210, |
| |
| "tgv_km_per_kgCO2eq": 341.296928, |
| |
| "water_l_per_kgCO2eq": 3.115265, |
| } |
| |
| |
| voice_enabled: bool = True |
| voice_stt_model: str = "whisper-1" |
| voice_stt_language: str = "fr" |
| voice_tts_voice: str = "alloy" |
| voice_tts_model: str = "tts-1" |
| voice_default_model: str = "mistral-large-latest" |
| voice_max_response_length: int = 500 |
|
|
| |
| voice_vad_stop_secs: float = 0.2 |
| voice_vad_start_secs: float = 0.2 |
| voice_vad_confidence: float = 0.7 |
| voice_vad_min_volume: float = 0.6 |
|
|
| |
| |
| voice_ice_servers: Optional[str] = None |
| |
| twilio_account_sid: Optional[str] = None |
| twilio_auth_token: Optional[str] = None |
| |
| metered_app_name: Optional[str] = None |
| metered_api_key: Optional[str] = None |
|
|
| |
| daily_api_key: Optional[str] = None |
|
|
| model_config = SettingsConfigDict( |
| env_file=".env", |
| env_file_encoding="utf-8", |
| case_sensitive=False, |
| extra="ignore" |
| ) |
|
|
|
|
| |
| settings = Settings() |
|
|
|
|