NurseLex / test_semantic.py
NurseCitizenDeveloper's picture
feat: complete local embedding search with i-dot-ai HF model
19a3093
raw
history blame contribute delete
624 Bytes
import httpx
base_url = 'https://lex.lab.i.ai.gov.uk'
url = f'{base_url}/legislation/section/search'
payload = {
'query': 'patient wants to leave but is sectioned',
'limit': 5
}
r = httpx.post(url, json=payload, timeout=10)
print('Status:', r.status_code)
d = r.json()
if isinstance(d, list) and d:
for n in d:
print('---')
act_name = n.get('act_name', 'Unknown')
sec_num = n.get('number', '??')
sec_title = n.get('title', 'No Title')
print(f'{act_name} - Section {sec_num}: {sec_title}')
print(f'Text: {n.get("text", "")[:100]}...')
else:
print('Raw:', d)