Spaces:
Sleeping
Sleeping
| import os | |
| from typing import Dict, Any, List | |
| # ===== Residency / Deployment ===== | |
| CANADA_RESIDENCY_REQUIRED = True | |
| CLOUD_REGION = os.getenv("CLOUD_REGION", "ca") # e.g., "ca" or "us" | |
| # ===== Cohere API ===== | |
| COHERE_API_KEY = os.getenv("COHERE_API_KEY", "") | |
| # Optional: override Cohere API url/region if your enterprise deployment provides one | |
| COHERE_API_URL = os.getenv("COHERE_API_URL", "") # leave blank to use default SDK endpoint | |
| COHERE_TIMEOUT_S = float(os.getenv("COHERE_TIMEOUT_S", "45")) | |
| # Cohere models (ask Cohere for larger/custom healthcare models as needed) | |
| COHERE_MODEL_PRIMARY = os.getenv("COHERE_MODEL_PRIMARY", "command-r") | |
| COHERE_EMBED_MODEL = os.getenv("COHERE_EMBED_MODEL", "embed-english-v3.0") | |
| # ===== Fallbacks (OPEN MODELS ONLY) ===== | |
| # By request, we default to Cohere-only. Set to "1" to allow open-model fallbacks. | |
| USE_OPEN_FALLBACKS = os.getenv("USE_OPEN_FALLBACKS", "0") in ("1", "true", "True") | |
| # Largest-first open models if fallbacks are enabled | |
| OPEN_LLM_CANDIDATES: List[str] = [ | |
| "Qwen/Qwen2.5-72B-Instruct", | |
| "meta-llama/Meta-Llama-3.1-70B-Instruct", | |
| "mistralai/Mixtral-8x22B-Instruct-v0.1", | |
| "NousResearch/Meta-Llama-3.1-8B-Instruct", | |
| "mistralai/Mistral-7B-Instruct-v0.3", | |
| ] | |
| LOCAL_MAX_NEW_TOKENS = int(os.getenv("LOCAL_MAX_NEW_TOKENS", "1200")) | |
| # ===== App Knobs ===== | |
| MODEL_SETTINGS: Dict[str, Any] = { | |
| "temperature": float(os.getenv("TEMP", "0.3")), | |
| "top_p": float(os.getenv("TOP_P", "0.9")), | |
| "repetition_penalty": float(os.getenv("REP_PEN", "1.12")), | |
| "max_new_tokens": int(os.getenv("MAX_NEW_TOKENS", "1500")), | |
| } | |
| HEALTHCARE_SETTINGS = { | |
| "supported_file_types": [".csv", ".txt", ".md", ".pdf"], | |
| "healthcare_keywords": [ | |
| "hospital", "clinic", "surgery", "surgical", "wait time", "consult", "triage", | |
| "beds", "occupancy", "icu", "ambulatory", "perioperative", "zone", "health authority", | |
| "province", "nova scotia", "iwk" | |
| ] | |
| } | |
| GENERAL_CONVERSATION_PROMPT = "You are a helpful, concise assistant." | |
| HEALTHCARE_SYSTEM_PROMPT = ( | |
| "You are a Canadian healthcare operations copilot. " | |
| "You must follow the scenario tasks exactly; calculations are done deterministically. " | |
| "Do not invent numbers." | |
| ) | |
| USE_SCENARIO_ENGINE = os.getenv("USE_SCENARIO_ENGINE", "1") not in ("0", "false", "False") | |
| DATA_DIR = os.getenv("DATA_DIR", "./data") | |
| RAG_INDEX_DIR = os.getenv("RAG_INDEX_DIR", "./rag_index") | |
| PERSIST_CONTENT = False | |
| SNAPSHOT_PATH = os.getenv("SNAPSHOT_PATH", "./snapshots") | |