Spaces:
Sleeping
Sleeping
Rajan Sharma
commited on
Update settings.py
Browse files- settings.py +15 -16
settings.py
CHANGED
|
@@ -1,25 +1,19 @@
|
|
| 1 |
import os
|
| 2 |
from typing import Dict, Any, List
|
| 3 |
|
| 4 |
-
#
|
| 5 |
CANADA_RESIDENCY_REQUIRED = True
|
| 6 |
-
CLOUD_REGION = os.getenv("CLOUD_REGION", "ca")
|
| 7 |
|
| 8 |
-
#
|
| 9 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY", "")
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
COHERE_TIMEOUT_S = float(os.getenv("COHERE_TIMEOUT_S", "45"))
|
| 13 |
-
|
| 14 |
-
# Cohere models (ask Cohere for larger/custom healthcare models as needed)
|
| 15 |
COHERE_MODEL_PRIMARY = os.getenv("COHERE_MODEL_PRIMARY", "command-r")
|
| 16 |
COHERE_EMBED_MODEL = os.getenv("COHERE_EMBED_MODEL", "embed-english-v3.0")
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
# By request, we default to Cohere-only. Set to "1" to allow open-model fallbacks.
|
| 20 |
USE_OPEN_FALLBACKS = os.getenv("USE_OPEN_FALLBACKS", "0") in ("1", "true", "True")
|
| 21 |
-
|
| 22 |
-
# Largest-first open models if fallbacks are enabled
|
| 23 |
OPEN_LLM_CANDIDATES: List[str] = [
|
| 24 |
"Qwen/Qwen2.5-72B-Instruct",
|
| 25 |
"meta-llama/Meta-Llama-3.1-70B-Instruct",
|
|
@@ -27,15 +21,15 @@ OPEN_LLM_CANDIDATES: List[str] = [
|
|
| 27 |
"NousResearch/Meta-Llama-3.1-8B-Instruct",
|
| 28 |
"mistralai/Mistral-7B-Instruct-v0.3",
|
| 29 |
]
|
| 30 |
-
|
| 31 |
LOCAL_MAX_NEW_TOKENS = int(os.getenv("LOCAL_MAX_NEW_TOKENS", "1200"))
|
| 32 |
|
| 33 |
-
#
|
| 34 |
MODEL_SETTINGS: Dict[str, Any] = {
|
| 35 |
"temperature": float(os.getenv("TEMP", "0.3")),
|
| 36 |
"top_p": float(os.getenv("TOP_P", "0.9")),
|
| 37 |
"repetition_penalty": float(os.getenv("REP_PEN", "1.12")),
|
| 38 |
"max_new_tokens": int(os.getenv("MAX_NEW_TOKENS", "1500")),
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
HEALTHCARE_SETTINGS = {
|
|
@@ -50,13 +44,18 @@ HEALTHCARE_SETTINGS = {
|
|
| 50 |
GENERAL_CONVERSATION_PROMPT = "You are a helpful, concise assistant."
|
| 51 |
HEALTHCARE_SYSTEM_PROMPT = (
|
| 52 |
"You are a Canadian healthcare operations copilot. "
|
| 53 |
-
"
|
| 54 |
-
"
|
| 55 |
)
|
| 56 |
|
| 57 |
USE_SCENARIO_ENGINE = os.getenv("USE_SCENARIO_ENGINE", "1") not in ("0", "false", "False")
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
DATA_DIR = os.getenv("DATA_DIR", "./data")
|
| 60 |
RAG_INDEX_DIR = os.getenv("RAG_INDEX_DIR", "./rag_index")
|
| 61 |
PERSIST_CONTENT = False
|
| 62 |
SNAPSHOT_PATH = os.getenv("SNAPSHOT_PATH", "./snapshots")
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
from typing import Dict, Any, List
|
| 3 |
|
| 4 |
+
# Residency (informational; enforce via your infra)
|
| 5 |
CANADA_RESIDENCY_REQUIRED = True
|
| 6 |
+
CLOUD_REGION = os.getenv("CLOUD_REGION", "ca")
|
| 7 |
|
| 8 |
+
# ---- Cohere API ----
|
| 9 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY", "")
|
| 10 |
+
COHERE_API_URL = os.getenv("COHERE_API_URL", "") # optional private base
|
| 11 |
+
COHERE_TIMEOUT_S = float(os.getenv("COHERE_TIMEOUT_S", "60"))
|
|
|
|
|
|
|
|
|
|
| 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 fallback (opt-in) ----
|
|
|
|
| 16 |
USE_OPEN_FALLBACKS = os.getenv("USE_OPEN_FALLBACKS", "0") in ("1", "true", "True")
|
|
|
|
|
|
|
| 17 |
OPEN_LLM_CANDIDATES: List[str] = [
|
| 18 |
"Qwen/Qwen2.5-72B-Instruct",
|
| 19 |
"meta-llama/Meta-Llama-3.1-70B-Instruct",
|
|
|
|
| 21 |
"NousResearch/Meta-Llama-3.1-8B-Instruct",
|
| 22 |
"mistralai/Mistral-7B-Instruct-v0.3",
|
| 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 |
+
"timeout_s": COHERE_TIMEOUT_S,
|
| 33 |
}
|
| 34 |
|
| 35 |
HEALTHCARE_SETTINGS = {
|
|
|
|
| 44 |
GENERAL_CONVERSATION_PROMPT = "You are a helpful, concise assistant."
|
| 45 |
HEALTHCARE_SYSTEM_PROMPT = (
|
| 46 |
"You are a Canadian healthcare operations copilot. "
|
| 47 |
+
"Follow the scenario tasks exactly. Calculations are done deterministically in code; "
|
| 48 |
+
"do not invent numbers."
|
| 49 |
)
|
| 50 |
|
| 51 |
USE_SCENARIO_ENGINE = os.getenv("USE_SCENARIO_ENGINE", "1") not in ("0", "false", "False")
|
| 52 |
|
| 53 |
+
# Debug flags
|
| 54 |
+
DEBUG_PLAN = os.getenv("DEBUG_PLAN", "1") in ("1", "true", "True")
|
| 55 |
+
|
| 56 |
+
# Storage/local
|
| 57 |
DATA_DIR = os.getenv("DATA_DIR", "./data")
|
| 58 |
RAG_INDEX_DIR = os.getenv("RAG_INDEX_DIR", "./rag_index")
|
| 59 |
PERSIST_CONTENT = False
|
| 60 |
SNAPSHOT_PATH = os.getenv("SNAPSHOT_PATH", "./snapshots")
|
| 61 |
+
|