""" CRANE AI Sistem Yapılandırması """ import os from typing import Dict, Any # Hugging Face Token güvenlik için ortam değişkeninden okunur HF_TOKEN = os.getenv("HF_TOKEN", "") # Model Yapılandırması MODELS = { "code_module": { "model_id": "deepseek-ai/deepseek-coder-1.3b-instruct", "task": "code_generation", "max_tokens": 2048, "temperature": 0.1, "priority": 1 }, "chat_module": { "model_id": "Qwen/Qwen2.5-1.5B-Instruct", "task": "chat", "max_tokens": 1024, "temperature": 0.7, "priority": 2 }, "reason_module": { "model_id": "microsoft/Phi-3-mini-4k-instruct", "task": "reasoning", "max_tokens": 1024, "temperature": 0.3, "priority": 3 }, "fast_module": { "model_id": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", "task": "quick_response", "max_tokens": 512, "temperature": 0.8, "priority": 4 } } # Router Yapılandırması ROUTER_CONFIG = { "confidence_threshold": 0.6, "max_concurrent_requests": 4, "timeout": 30, "fallback_model": "fast_module" } # Memory Yapılandırması MEMORY_CONFIG = { "max_slots": 10, "slot_size": 1024, "cleanup_interval": 300 # 5 dakika } # API Yapılandırması API_CONFIG = { "host": "0.0.0.0", "port": 8000, "workers": 1 } # Sistem Limitleri SYSTEM_LIMITS = { "max_input_length": 4096, "max_output_length": 2048, "max_concurrent_users": 10 } # Logging LOGGING_CONFIG = { "level": "INFO", "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s", "file": "logs/crane_ai.log" } def get_model_config(model_name: str) -> Dict[str, Any]: """Belirli bir model için yapılandırma döndürür""" return MODELS.get(model_name, MODELS["fast_module"]) def get_device(): """Kullanılacak cihazı belirler""" try: import torch if torch.cuda.is_available(): return "cuda" elif torch.backends.mps.is_available(): return "mps" else: return "cpu" except ImportError: return "cpu" # Cihaz yapılandırması DEVICE = get_device()