File size: 4,725 Bytes
aacc29a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# CarePath unified runtime — one FastAPI service, two products.
# Defaults below are the keyless demo profile: the whole app must boot with no
# API keys (mock interpreter providers, mock ASR + offline LLM for the scriber).
# Ready-made profiles: .env.local.example (keyless demo), .env.ckey.example
# (real Gipformer ASR + CKey LLM).

# --- Scriber (scribe/carepath, routes /api/v1/*) ---
APP_ENV=local
ASR_PROVIDER=gipformer
GIPFORMER_QUANTIZE=int8
GIPFORMER_NUM_THREADS=4
GIPFORMER_DECODING_METHOD=modified_beam_search
GIPFORMER_CHUNK_SECONDS=20
# Long-audio segmentation: overlap (default) | vad | fixed.
#   overlap = overlapping windows merged with seam de-duplication (no word loss
#             at chunk boundaries; no extra model).
#   vad     = split on silence; requires GIPFORMER_VAD_MODEL (repo_id:filename or
#             a local silero_vad.onnx path). Falls back to overlap if unavailable.
#   fixed   = legacy non-overlapping 20s windows.
GIPFORMER_SEGMENTATION=overlap
GIPFORMER_OVERLAP_SECONDS=2
GIPFORMER_MAX_SEGMENT_SECONDS=20
GIPFORMER_VAD_MODEL=

# Set LLM_PROVIDER=offline for a deterministic no-key fallback.
# Set LLM_PROVIDER=ckey for CKey OpenAI-compatible chat completions.
LLM_PROVIDER=offline
LLM_BASE_URL=https://api.openai.com/v1
LLM_MODEL=gpt-4.1-mini
LLM_API_KEY=
LLM_TIMEOUT_SECONDS=60
# If a network LLM provider fails, fall back to the offline generator so a
# request never errors out (recommended for live demos).
LLM_FALLBACK_OFFLINE=true

# Vietnamese speech synthesis (patient -> clinician direction).
# A default Windows or macOS install has no vi-VN browser voice, so without this
# half of a bilingual visit is silent. Uses sherpa-onnx, which is already a
# dependency for Gipformer ASR; no extra package. The 63 MB Piper voice
# (VAIS-1000 corpus, CC BY 4.0) downloads on first use.
# Keep TTS_MODEL_DIR SHORT: espeak-ng reads its data with a native call that
# fails past the Windows MAX_PATH limit.
TTS_PROVIDER=piper
TTS_MODEL_DIR=models/vi-tts
TTS_REPO_ID=csukuangfj/vits-piper-vi_VN-vais1000-medium

# Some gateways hang when asked for response_format=json_object (measured on
# CKey gpt-5.4). Off by default; the prompts demand JSON and parsers validate it.
LLM_JSON_RESPONSE_FORMAT=false

# Retrieval
MEDICAL_LEXICON_PATH=data/medical_lexicon.json
RETRIEVAL_TOP_K=5
# Backend: lexical (default) | semantic | hybrid. semantic/hybrid use the
# Vietnamese bi-encoder and need the optional sentence-transformers + pyvi deps.
RETRIEVAL_BACKEND=lexical
SEMANTIC_MODEL_NAME=bkai-foundation-models/vietnamese-bi-encoder

# Safety/demo
ALLOW_MOCK_ASR=false
TEAM_CODE=
SOAP_RATE_LIMIT_PER_IP_HOUR=3
SOAP_RATE_LIMIT_PER_IP_DAY=10
SOAP_RATE_LIMIT_GLOBAL_DAY=100
# Cross-origin frontends for both APIs. Clear this value for same-origin-only
# production; list every Vite development origin when developing against either API.
CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173

# Public Vercel site used by the Interpreter's “Tất cả chức năng” link when
# its frontend is built into the Space image. Set as a Docker build arg.
VITE_PUBLIC_SITE_URL=https://carepath-omega.vercel.app

# --- Interpreter (interpreter/app, routes /api/* + /ws/*) ---
# PROVIDER_MODE=mock runs deterministic providers with zero keys. Note that
#   mock "translation" is the source text with a "[vi->en] " prefix, so it is a
#   plumbing check, not a demoable translation.
# PROVIDER_MODE=demo replays a scripted consultation
#   (interpreter/app/providers/demo_scenario.json) with realistic translations
#   and no network. The normalizer, glossary, risk engine, confirmation gate and
#   persistence all still run for real; only the model calls are scripted. Use
#   it for rehearsal and as the fallback if the venue network dies.
# PROVIDER_MODE=ckey runs real translation over the OpenAI-compatible CKey
#   gateway and reuses the LLM_BASE_URL / LLM_MODEL / LLM_API_KEY values above,
#   so one key configures both modules. Speech capture happens in the browser
#   on this path; audio turns fail closed rather than inventing a transcript.
# PROVIDER_MODE=cloud is the Anthropic + OpenAI track and needs the two keys
#   below instead.
# Both ckey and cloud require a non-default ADMIN_TOKEN (startup refuses
# "change-me").
PROVIDER_MODE=mock
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
ADMIN_TOKEN=change-me
CONFIDENCE_THRESHOLD=0.7
RETENTION_DAYS=30
MAX_TURN_AUDIO_BYTES=10485760
# sqlite is fine for the demo (ephemeral on HF Spaces); point at Postgres etc.
# for anything that must survive a container restart.
DATABASE_URL=sqlite:///./carepath.db
OPENAI_TRANSCRIBE_MODEL=gpt-4o-transcribe
CLAUDE_MT_MODEL=claude-sonnet-5
CLAUDE_REVIEWER_MODEL=claude-sonnet-5
PROVIDER_TIMEOUT_SECONDS=30