Charan S commited on
Commit ·
d3fc1e8
1
Parent(s): 8985781
fix: raise livekit worker memory limit
Browse filesFiles changed (2)
145 unmodified lines146147148149150151152153154155156157158145 unmodified lines"""Calls the HF feature-extraction pipeline API and L2-normalises the resultto match the vectors stored by local sentence-transformers (normalize_embeddings=True)."""headers = {"Authorization": f"Bearer {_hf_token}"}payload = {"inputs": texts, "options": {"wait_for_model": True}}async with httpx.AsyncClient(timeout=30.0) as client:resp = await client.post(_HF_API_URL, headers=headers, json=payload)resp.raise_for_status()raw: list[list[float]] = resp.json()145 unmodified lines146147148149150151152153154155156157158159160161162163164165166167168169145 unmodified lines"""Calls the HF feature-extraction pipeline API and L2-normalises the resultto match the vectors stored by local sentence-transformers (normalize_embeddings=True).Retries up to 3 times with exponential backoff for transient DNS/network failures."""headers = {"Authorization": f"Bearer {_hf_token}"}payload = {"inputs": texts, "options": {"wait_for_model": True}}last_exc: Exception | None = Nonefor attempt in range(3):try:async with httpx.AsyncClient(timeout=30.0) as client:resp = await client.post(_HF_API_URL, headers=headers, json=payload)resp.raise_for_status()breakexcept (httpx.ConnectError, httpx.TimeoutException) as exc:last_exc = excif attempt < 2:await asyncio.sleep(2 ** attempt) # 1s, 2selse:raise last_exc # type: ignore[misc]raw: list[list[float]] = resp.json()
42 unmodified lines4344454647484942 unmodified linesapi_key=settings.livekit_api_key,api_secret=settings.livekit_api_secret,# Production resource limitsjob_memory_limit_mb=512, # OOM-kill runaway subprocessesload_threshold=0.80, # reject new jobs before overloaddrain_timeout=300, # 5 min grace on SIGTERMnum_idle_processes=2, # warm pool: first-call latency ~042 unmodified lines4344454647484942 unmodified linesapi_key=settings.livekit_api_key,api_secret=settings.livekit_api_secret,# Production resource limitsjob_memory_limit_mb=2048, # OOM-kill runaway subprocesses (VAD+plugins baseline ~400 MB)load_threshold=0.80, # reject new jobs before overloaddrain_timeout=300, # 5 min grace on SIGTERMnum_idle_processes=2, # warm pool: first-call latency ~0
knowledge/embeddings.py+14-3
voice/agent_worker.py+1-1