Spaces:
Sleeping
Sleeping
Update settings.py
Browse files- settings.py +2 -20
settings.py
CHANGED
|
@@ -1,17 +1,14 @@
|
|
| 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", "
|
| 12 |
COHERE_MODEL_PRIMARY = os.getenv("COHERE_MODEL_PRIMARY", "command-a-03-2025")
|
| 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] = [
|
|
@@ -22,7 +19,6 @@ OPEN_LLM_CANDIDATES: List[str] = [
|
|
| 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")),
|
|
@@ -31,7 +27,6 @@ MODEL_SETTINGS: Dict[str, Any] = {
|
|
| 31 |
"max_new_tokens": int(os.getenv("MAX_NEW_TOKENS", "1500")),
|
| 32 |
"timeout_s": COHERE_TIMEOUT_S,
|
| 33 |
}
|
| 34 |
-
|
| 35 |
HEALTHCARE_SETTINGS = {
|
| 36 |
"supported_file_types": [".csv", ".txt", ".md", ".pdf"],
|
| 37 |
"healthcare_keywords": [
|
|
@@ -40,46 +35,33 @@ HEALTHCARE_SETTINGS = {
|
|
| 40 |
"province", "nova scotia", "iwk"
|
| 41 |
]
|
| 42 |
}
|
| 43 |
-
|
| 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 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
# Existing settings you already have:
|
| 65 |
# GENERAL_CONVERSATION_PROMPT = os.getenv("GENERAL_CONVERSATION_PROMPT", "You are a helpful data analyst.")
|
| 66 |
# COHERE_MODEL_PRIMARY = os.getenv("COHERE_MODEL_PRIMARY", "command-r-plus")
|
| 67 |
# COHERE_TIMEOUT_S = int(os.getenv("COHERE_TIMEOUT_S", "60"))
|
| 68 |
#USE_OPEN_FALLBACKS = os.getenv("USE_OPEN_FALLBACKS", "false").lower() == "true"
|
| 69 |
-
|
| 70 |
# --- HIPAA flags ---
|
| 71 |
# Master switch for PHI-aware behavior
|
| 72 |
PHI_MODE = os.getenv("PHI_MODE", "true").lower() == "true"
|
| 73 |
-
|
| 74 |
# Persist history? Default OFF under PHI mode (in-memory only if True).
|
| 75 |
PERSIST_HISTORY = os.getenv("PERSIST_HISTORY", "false").lower() == "true"
|
| 76 |
-
|
| 77 |
# For persistent stores, set a non-zero TTL policy (days). 0 = no persistence.
|
| 78 |
HISTORY_TTL_DAYS = int(os.getenv("HISTORY_TTL_DAYS", "0"))
|
| 79 |
-
|
| 80 |
# Redact obvious identifiers before external LLM calls
|
| 81 |
REDACT_BEFORE_LLM = os.getenv("REDACT_BEFORE_LLM", "true").lower() == "true"
|
| 82 |
-
|
| 83 |
# Allow sending PHI to external LLM vendors (requires BAA!). Default: False
|
| 84 |
-
ALLOW_EXTERNAL_PHI = os.getenv("ALLOW_EXTERNAL_PHI", "false").lower() == "true"
|
| 85 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
from typing import Dict, Any, List
|
|
|
|
| 3 |
# Residency (informational; enforce via your infra)
|
| 4 |
CANADA_RESIDENCY_REQUIRED = True
|
| 5 |
CLOUD_REGION = os.getenv("CLOUD_REGION", "ca")
|
|
|
|
| 6 |
# ---- Cohere API ----
|
| 7 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY", "")
|
| 8 |
COHERE_API_URL = os.getenv("COHERE_API_URL", "") # optional private base
|
| 9 |
+
COHERE_TIMEOUT_S = float(os.getenv("COHERE_TIMEOUT_S", "180")) # Increased from 60 to 180 seconds
|
| 10 |
COHERE_MODEL_PRIMARY = os.getenv("COHERE_MODEL_PRIMARY", "command-a-03-2025")
|
| 11 |
COHERE_EMBED_MODEL = os.getenv("COHERE_EMBED_MODEL", "embed-english-v3.0")
|
|
|
|
| 12 |
# ---- Open-model fallback (opt-in) ----
|
| 13 |
USE_OPEN_FALLBACKS = os.getenv("USE_OPEN_FALLBACKS", "0") in ("1", "true", "True")
|
| 14 |
OPEN_LLM_CANDIDATES: List[str] = [
|
|
|
|
| 19 |
"mistralai/Mistral-7B-Instruct-v0.3",
|
| 20 |
]
|
| 21 |
LOCAL_MAX_NEW_TOKENS = int(os.getenv("LOCAL_MAX_NEW_TOKENS", "1200"))
|
|
|
|
| 22 |
# ---- App knobs ----
|
| 23 |
MODEL_SETTINGS: Dict[str, Any] = {
|
| 24 |
"temperature": float(os.getenv("TEMP", "0.3")),
|
|
|
|
| 27 |
"max_new_tokens": int(os.getenv("MAX_NEW_TOKENS", "1500")),
|
| 28 |
"timeout_s": COHERE_TIMEOUT_S,
|
| 29 |
}
|
|
|
|
| 30 |
HEALTHCARE_SETTINGS = {
|
| 31 |
"supported_file_types": [".csv", ".txt", ".md", ".pdf"],
|
| 32 |
"healthcare_keywords": [
|
|
|
|
| 35 |
"province", "nova scotia", "iwk"
|
| 36 |
]
|
| 37 |
}
|
|
|
|
| 38 |
GENERAL_CONVERSATION_PROMPT = "You are a helpful, concise assistant."
|
| 39 |
HEALTHCARE_SYSTEM_PROMPT = (
|
| 40 |
"You are a Canadian healthcare operations copilot. "
|
| 41 |
"Follow the scenario tasks exactly. Calculations are done deterministically in code; "
|
| 42 |
"do not invent numbers."
|
| 43 |
)
|
|
|
|
| 44 |
USE_SCENARIO_ENGINE = os.getenv("USE_SCENARIO_ENGINE", "1") not in ("0", "false", "False")
|
|
|
|
| 45 |
# Debug flags
|
| 46 |
DEBUG_PLAN = os.getenv("DEBUG_PLAN", "1") in ("1", "true", "True")
|
|
|
|
| 47 |
# Storage/local
|
| 48 |
DATA_DIR = os.getenv("DATA_DIR", "./data")
|
| 49 |
RAG_INDEX_DIR = os.getenv("RAG_INDEX_DIR", "./rag_index")
|
| 50 |
PERSIST_CONTENT = False
|
| 51 |
SNAPSHOT_PATH = os.getenv("SNAPSHOT_PATH", "./snapshots")
|
|
|
|
|
|
|
|
|
|
| 52 |
# Existing settings you already have:
|
| 53 |
# GENERAL_CONVERSATION_PROMPT = os.getenv("GENERAL_CONVERSATION_PROMPT", "You are a helpful data analyst.")
|
| 54 |
# COHERE_MODEL_PRIMARY = os.getenv("COHERE_MODEL_PRIMARY", "command-r-plus")
|
| 55 |
# COHERE_TIMEOUT_S = int(os.getenv("COHERE_TIMEOUT_S", "60"))
|
| 56 |
#USE_OPEN_FALLBACKS = os.getenv("USE_OPEN_FALLBACKS", "false").lower() == "true"
|
|
|
|
| 57 |
# --- HIPAA flags ---
|
| 58 |
# Master switch for PHI-aware behavior
|
| 59 |
PHI_MODE = os.getenv("PHI_MODE", "true").lower() == "true"
|
|
|
|
| 60 |
# Persist history? Default OFF under PHI mode (in-memory only if True).
|
| 61 |
PERSIST_HISTORY = os.getenv("PERSIST_HISTORY", "false").lower() == "true"
|
|
|
|
| 62 |
# For persistent stores, set a non-zero TTL policy (days). 0 = no persistence.
|
| 63 |
HISTORY_TTL_DAYS = int(os.getenv("HISTORY_TTL_DAYS", "0"))
|
|
|
|
| 64 |
# Redact obvious identifiers before external LLM calls
|
| 65 |
REDACT_BEFORE_LLM = os.getenv("REDACT_BEFORE_LLM", "true").lower() == "true"
|
|
|
|
| 66 |
# Allow sending PHI to external LLM vendors (requires BAA!). Default: False
|
| 67 |
+
ALLOW_EXTERNAL_PHI = os.getenv("ALLOW_EXTERNAL_PHI", "false").lower() == "true"
|
|
|