Spaces:
Sleeping
Sleeping
Rajan Sharma
commited on
Update settings.py
Browse files- settings.py +29 -21
settings.py
CHANGED
|
@@ -1,49 +1,57 @@
|
|
| 1 |
import os
|
| 2 |
-
from typing import Dict, Any
|
| 3 |
|
|
|
|
| 4 |
CANADA_RESIDENCY_REQUIRED = True
|
| 5 |
CLOUD_REGION = os.getenv("CLOUD_REGION", "ca-central-1")
|
| 6 |
|
|
|
|
| 7 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY", "")
|
| 8 |
-
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
|
| 9 |
-
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY", "")
|
| 10 |
|
|
|
|
| 11 |
COHERE_MODEL_PRIMARY = os.getenv("COHERE_MODEL_PRIMARY", "command-r")
|
| 12 |
COHERE_EMBED_MODEL = os.getenv("COHERE_EMBED_MODEL", "embed-english-v3.0")
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
LOCAL_ENABLE = os.getenv("LOCAL_ENABLE", "0") not in ("0", "false", "False")
|
| 19 |
-
|
| 20 |
-
USE_SCENARIO_ENGINE = True
|
| 21 |
|
|
|
|
| 22 |
MODEL_SETTINGS: Dict[str, Any] = {
|
| 23 |
-
"temperature": float(os.getenv("TEMP", "0.
|
| 24 |
"top_p": float(os.getenv("TOP_P", "0.9")),
|
| 25 |
-
"repetition_penalty": float(os.getenv("REP_PEN", "1.
|
| 26 |
"max_new_tokens": int(os.getenv("MAX_NEW_TOKENS", "1500")),
|
| 27 |
}
|
| 28 |
|
| 29 |
HEALTHCARE_SETTINGS = {
|
| 30 |
"supported_file_types": [".csv", ".txt", ".md", ".pdf"],
|
| 31 |
"healthcare_keywords": [
|
| 32 |
-
"hospital", "clinic", "surgery", "wait time", "consult",
|
| 33 |
-
"beds", "icu", "
|
| 34 |
-
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
-
GENERAL_CONVERSATION_PROMPT = "You are a helpful
|
| 38 |
-
|
| 39 |
HEALTHCARE_SYSTEM_PROMPT = (
|
| 40 |
-
"You are a Canadian healthcare operations
|
| 41 |
-
"
|
| 42 |
-
"
|
| 43 |
-
"and formatting exactly as the scenario requires. "
|
| 44 |
-
"Do not invent numbers; computations will be executed deterministically."
|
| 45 |
)
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
DATA_DIR = os.getenv("DATA_DIR", "./data")
|
| 48 |
RAG_INDEX_DIR = os.getenv("RAG_INDEX_DIR", "./rag_index")
|
|
|
|
| 49 |
SNAPSHOT_PATH = os.getenv("SNAPSHOT_PATH", "./snapshots")
|
|
|
|
| 1 |
import os
|
| 2 |
+
from typing import Dict, Any, List
|
| 3 |
|
| 4 |
+
# Residency / deployment guidance (enforce in your infra)
|
| 5 |
CANADA_RESIDENCY_REQUIRED = True
|
| 6 |
CLOUD_REGION = os.getenv("CLOUD_REGION", "ca-central-1")
|
| 7 |
|
| 8 |
+
# Keys
|
| 9 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY", "")
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# Cohere models (ask Cohere for larger/custom healthcare)
|
| 12 |
COHERE_MODEL_PRIMARY = os.getenv("COHERE_MODEL_PRIMARY", "command-r")
|
| 13 |
COHERE_EMBED_MODEL = os.getenv("COHERE_EMBED_MODEL", "embed-english-v3.0")
|
| 14 |
|
| 15 |
+
# Open-model fallbacks (largest first; will try in order)
|
| 16 |
+
OPEN_LLM_CANDIDATES: List[str] = [
|
| 17 |
+
"Qwen/Qwen2.5-72B-Instruct", # large & open weights
|
| 18 |
+
"meta-llama/Meta-Llama-3.1-70B-Instruct", # large (requires strong GPUs)
|
| 19 |
+
"mistralai/Mixtral-8x22B-Instruct-v0.1", # MoE, open
|
| 20 |
+
"NousResearch/Meta-Llama-3.1-8B-Instruct", # smaller safety net
|
| 21 |
+
"mistralai/Mistral-7B-Instruct-v0.3"
|
| 22 |
+
]
|
| 23 |
|
| 24 |
+
LOCAL_MAX_NEW_TOKENS = int(os.getenv("LOCAL_MAX_NEW_TOKENS", "1200"))
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
# App knobs
|
| 27 |
MODEL_SETTINGS: Dict[str, Any] = {
|
| 28 |
+
"temperature": float(os.getenv("TEMP", "0.3")),
|
| 29 |
"top_p": float(os.getenv("TOP_P", "0.9")),
|
| 30 |
+
"repetition_penalty": float(os.getenv("REP_PEN", "1.12")),
|
| 31 |
"max_new_tokens": int(os.getenv("MAX_NEW_TOKENS", "1500")),
|
| 32 |
}
|
| 33 |
|
| 34 |
HEALTHCARE_SETTINGS = {
|
| 35 |
"supported_file_types": [".csv", ".txt", ".md", ".pdf"],
|
| 36 |
"healthcare_keywords": [
|
| 37 |
+
"hospital", "clinic", "surgery", "surgical", "wait time", "consult", "triage",
|
| 38 |
+
"beds", "occupancy", "icu", "ambulatory", "perioperative", "zone", "health authority",
|
| 39 |
+
"province", "nova scotia", "iwk"
|
| 40 |
+
]
|
| 41 |
}
|
| 42 |
|
| 43 |
+
GENERAL_CONVERSATION_PROMPT = "You are a helpful, concise assistant."
|
|
|
|
| 44 |
HEALTHCARE_SYSTEM_PROMPT = (
|
| 45 |
+
"You are a Canadian healthcare operations copilot. "
|
| 46 |
+
"You must follow the scenario tasks exactly; calculations are done deterministically. "
|
| 47 |
+
"Do not invent numbers."
|
|
|
|
|
|
|
| 48 |
)
|
| 49 |
|
| 50 |
+
# Feature flags
|
| 51 |
+
USE_SCENARIO_ENGINE = os.getenv("USE_SCENARIO_ENGINE", "1") not in ("0", "false", "False")
|
| 52 |
+
|
| 53 |
+
# Storage
|
| 54 |
DATA_DIR = os.getenv("DATA_DIR", "./data")
|
| 55 |
RAG_INDEX_DIR = os.getenv("RAG_INDEX_DIR", "./rag_index")
|
| 56 |
+
PERSIST_CONTENT = False
|
| 57 |
SNAPSHOT_PATH = os.getenv("SNAPSHOT_PATH", "./snapshots")
|