Spaces:
Sleeping
Sleeping
| # ============================================================================ | |
| # CONFIGURATION | |
| # ============================================================================ | |
| import os | |
| from dotenv import load_dotenv | |
| # Load .env file | |
| load_dotenv() | |
| class Config: | |
| """Centralized configuration""" | |
| # PM Tool API | |
| PM_TOOL_BASE_URL = "https://pmtoolapi.synthesys.in/api" | |
| PM_TOOL_LOGIN_ENDPOINT = f"{PM_TOOL_BASE_URL}/Auth/Login" | |
| PM_TOOL_TASKS_ENDPOINT = f"{PM_TOOL_BASE_URL}/Tasks/GetTaskByType" | |
| PM_TOOL_ATTACHMENTS_ENDPOINT = f"{PM_TOOL_BASE_URL}/Attachments" | |
| # Groq AI - Multi-key support | |
| # Single key (backward compatible): GROQ_API_KEY=key1 | |
| # Multiple keys: GROQ_API_KEYS=key1,key2,key3,...,key10 | |
| GROQ_API_KEY = os.getenv("GROQ_API_KEY", "") | |
| GROQ_API_KEYS = [ | |
| key.strip() | |
| for key in os.getenv("GROQ_API_KEYS", os.getenv("GROQ_API_KEY", "")).split(",") | |
| if key.strip() | |
| ] | |
| GROQ_MODEL = "openai/gpt-oss-120b" | |
| GROQ_MAX_TOKENS = 8192 | |
| GROQ_TEMPERATURE = 0.4 | |
| # Groq Rate Limits (per key) | |
| GROQ_RPM_LIMIT = 30 # Requests per minute | |
| GROQ_RPH_LIMIT = 1000 # Requests per hour | |
| GROQ_RPD_LIMIT = 10000 # Requests per day | |
| GROQ_TPM_LIMIT = 30000 # Tokens per minute | |
| GROQ_TPD_LIMIT = 500000 # Tokens per day | |
| # API Settings | |
| API_TITLE = "AI Test Case Generator API" | |
| API_VERSION = "1.0.0" | |
| API_DESCRIPTION = """ | |
| 🧪 **Automated Test Case Generation Engine** | |
| Features: | |
| - Generate test cases from PM Tool tasks | |
| - Support for bulk and single task processing | |
| - Attachment context integration | |
| - Multiple output formats (JSON, Excel, PDF) | |
| - Concurrent processing with retry logic | |
| - Comprehensive error handling | |
| """ | |
| # Rate Limiting & Concurrency | |
| MAX_CONCURRENT_TASKS = 5 | |
| MAX_REQUESTS_PER_MINUTE = 30 | |
| REQUEST_TIMEOUT = 120 # seconds | |
| MAX_RETRY_ATTEMPTS = 3 | |
| RETRY_DELAY = 2 # seconds | |
| # Token Cache | |
| TOKEN_CACHE_TTL = 3600 # 1 hour | |
| # Output - use /tmp for HF Spaces (writable directory) | |
| OUTPUT_DIR = os.getenv("OUTPUT_DIR", "generated_testcases") | |
| LOG_LEVEL = "INFO" | |
| # Ensure output directory exists | |
| os.makedirs(Config.OUTPUT_DIR, exist_ok=True) | |