diff --git a/dlplus/config/settings.py b/dlplus/config/settings.py index 77b4dcf..d42ee8e 100644 --- a/dlplus/config/settings.py +++ b/dlplus/config/settings.py @@ -10,39 +10,45 @@ from pydantic_settings import BaseSettings except ImportError: from pydantic import BaseSettings -from pydantic import Field +from pydantic import Field, ConfigDict class Settings(BaseSettings): """Main system settings / الإعدادات الرئيسية للنظام""" + model_config = ConfigDict( + env_file=".env", + env_file_encoding="utf-8", + case_sensitive=False + ) + # API Keys - openrouter_api_key: str = Field(default="", env="OPENROUTER_API_KEY") - openai_api_key: str = Field(default="", env="OPENAI_API_KEY") - anthropic_api_key: str = Field(default="", env="ANTHROPIC_API_KEY") + openrouter_api_key: str = Field(default="") + openai_api_key: str = Field(default="") + anthropic_api_key: str = Field(default="") # Server Configuration - api_host: str = Field(default="0.0.0.0", env="API_HOST") - api_port: int = Field(default=8000, env="API_PORT") - debug_mode: bool = Field(default=False, env="DEBUG_MODE") + api_host: str = Field(default="0.0.0.0") + api_port: int = Field(default=8000) + debug_mode: bool = Field(default=False) # VPS/Hostinger Configuration - vps_host: Optional[str] = Field(default=None, env="VPS_HOST") - vps_user: Optional[str] = Field(default=None, env="VPS_USER") - vps_key: Optional[str] = Field(default=None, env="VPS_KEY") - vps_port: int = Field(default=22, env="VPS_PORT") + vps_host: Optional[str] = Field(default=None) + vps_user: Optional[str] = Field(default=None) + vps_key: Optional[str] = Field(default=None) + vps_port: int = Field(default=22) # Model Configuration - default_model: str = Field(default="gpt-3.5-turbo", env="DEFAULT_MODEL") - default_arabic_model: str = Field(default="qwen-2.5-arabic", env="DEFAULT_ARABIC_MODEL") - max_tokens: int = Field(default=2000, env="MAX_TOKENS") - temperature: float = Field(default=0.7, env="TEMPERATURE") + default_model: str = Field(default="gpt-3.5-turbo") + default_arabic_model: str = Field(default="qwen-2.5-arabic") + max_tokens: int = Field(default=2000) + temperature: float = Field(default=0.7) # Agent Configuration - max_reasoning_steps: int = Field(default=5, env="MAX_REASONING_STEPS") - enable_web_search: bool = Field(default=True, env="ENABLE_WEB_SEARCH") - enable_code_generation: bool = Field(default=True, env="ENABLE_CODE_GENERATION") - enable_shell_execution: bool = Field(default=False, env="ENABLE_SHELL_EXECUTION") + max_reasoning_steps: int = Field(default=5) + enable_web_search: bool = Field(default=True) + enable_code_generation: bool = Field(default=True) + enable_shell_execution: bool = Field(default=False) # Paths base_dir: Path = Path(__file__).parent.parent.parent @@ -62,11 +68,6 @@ class Settings(BaseSettings): supported_languages: List[str] = ["ar", "en"] default_language: str = "ar" - class Config: - env_file = ".env" - env_file_encoding = "utf-8" - case_sensitive = False - def __init__(self, **kwargs): super().__init__(**kwargs) # Create necessary directories diff --git a/requirements.txt b/requirements.txt index 1553b13..0f3f219 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,41 +1,41 @@ # Core Dependencies -fastapi==0.104.1 -uvicorn[standard]==0.24.0 -pydantic==2.5.0 -pydantic-settings==2.1.0 -python-dotenv==1.0.0 -httpx==0.25.1 -aiohttp==3.9.0 +fastapi~=0.104.1 +uvicorn[standard]~=0.24.0 +pydantic~=2.5 +pydantic-settings~=2.1 +python-dotenv~=1.0 +httpx~=0.25 +aiohttp~=3.9 -# AI and NLP -openai==1.3.5 -anthropic==0.7.1 -transformers==4.35.2 -torch==2.1.1 -sentence-transformers==2.2.2 +# AI and NLP (using compatible versions for Python 3.12) +openai~=1.3 +anthropic~=0.7 +transformers~=4.35 +torch>=2.2.0,<3.0.0 +sentence-transformers~=2.2 # Arabic Language Processing -camel-tools==1.5.2 -pyarabic==0.6.15 -nltk==3.8.1 +camel-tools~=1.5 +pyarabic~=0.6 +nltk~=3.8 # Data Processing -pandas==2.1.3 -numpy==1.26.2 -beautifulsoup4==4.12.2 -lxml==4.9.3 +pandas~=2.1 +numpy~=1.26 +beautifulsoup4~=4.12 +lxml~=4.9 # Utilities -requests==2.31.0 -python-multipart==0.0.6 -jinja2==3.1.2 -markdown==3.5.1 +requests~=2.31 +python-multipart~=0.0.6 +jinja2~=3.1 +markdown~=3.5 # Testing -pytest==7.4.3 -pytest-asyncio==0.21.1 -pytest-cov==4.1.0 +pytest~=7.4 +pytest-asyncio~=0.21 +pytest-cov~=4.1 # Security -cryptography==41.0.7 -pyjwt==2.8.0 +cryptography~=41.0 +pyjwt~=2.8