Initial commit: Doctor-Patient clinical transcription and structured summary pipeline

This commit is contained in:
Ayush
2026-11-16 19:22:04 +05:30
commit f451738732
60 changed files with 11321 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import os, json, urllib.request, urllib.error
_env_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(_env_path):
with open(_env_path) as f:
for line in f:
if '=' in line and not line.startswith('#'):
k, v = line.strip().split('=', 1)
os.environ.setdefault(k, v)
SARVAM_API_KEY = os.getenv("SARVAM_API_KEY", "")
payload = json.dumps({
"model": "sarvam-2b",
"messages": [{"role": "user", "content": "hello"}]
}).encode('utf-8')
req = urllib.request.Request(
'https://api.sarvam.ai/v1/chat/completions',
data=payload,
headers={'Content-Type': 'application/json', 'api-subscription-key': SARVAM_API_KEY}
)
try:
with urllib.request.urlopen(req, timeout=30) as resp:
print(resp.read().decode('utf-8'))
except urllib.error.HTTPError as e:
print("STATUS:", e.code)
print("BODY:", e.read().decode('utf-8'))