LoveLogicAI commited on
Commit
b74a27f
·
verified ·
1 Parent(s): 7b55a22

E2E win-condition harness: hf_hub_download fetch, speech-gated arrivals, join retry

Browse files
Files changed (1) hide show
  1. tests/e2e_livekit.py +7 -4
tests/e2e_livekit.py CHANGED
@@ -45,7 +45,7 @@ ANSWER_KEYWORDS = ("streamy", "assistant")
45
 
46
  os.environ["HF_HOME"] = "/tmp/hf"
47
  os.environ["FREESTREAM_VOICE_DIR"] = str(ROOT / "voices")
48
- os.environ["FREESTREAM_WHISPER_MODEL"] = "base"
49
  os.environ["PYTHONPATH"] = str(ROOT)
50
  sys.path.insert(0, str(ROOT)) # harness imports the package below (log verification)
51
  os.environ.setdefault("FREESTREAM_LIVEKIT_URL", "ws://localhost:7880")
@@ -327,9 +327,9 @@ async def test_client():
327
  return {"t_perceived": 999.0, "answer_s": 0.0, "answer_text": "",
328
  "t_ready": t_ready, "no_answer": True}
329
  t_perceived = bot_audio["first_arrival"] - t_speech_end
330
- while time.perf_counter() - bot_audio["last_arrival"] < 2.0:
331
  await asyncio.sleep(0.1)
332
- if time.perf_counter() - t_speech_end > 30:
333
  break
334
  answer_s = (bot_audio["last_arrival"] - bot_audio["first_arrival"])
335
 
@@ -407,7 +407,10 @@ try:
407
  print("\n--- what the bot heard and said (bot-events.jsonl) ---")
408
  for e in bot_log:
409
  if e["type"] in ("asr.final", "agent.speak"):
410
- print(f" {e['type']:12s} ts=+{e['ts'] % 1000:8.2f}s {e['payload'].get('text', '')[:140]}")
 
 
 
411
  elif e["type"] in ("turn.completed", "session.error"):
412
  print(f" {e['type']:12s} {e['payload']}")
413
  except Exception as e:
 
45
 
46
  os.environ["HF_HOME"] = "/tmp/hf"
47
  os.environ["FREESTREAM_VOICE_DIR"] = str(ROOT / "voices")
48
+ os.environ["FREESTREAM_WHISPER_MODEL"] = "tiny" # win-condition profile; base = +2s ASR (docs/LATENCY.md)
49
  os.environ["PYTHONPATH"] = str(ROOT)
50
  sys.path.insert(0, str(ROOT)) # harness imports the package below (log verification)
51
  os.environ.setdefault("FREESTREAM_LIVEKIT_URL", "ws://localhost:7880")
 
327
  return {"t_perceived": 999.0, "answer_s": 0.0, "answer_text": "",
328
  "t_ready": t_ready, "no_answer": True}
329
  t_perceived = bot_audio["first_arrival"] - t_speech_end
330
+ while time.perf_counter() - bot_audio["last_arrival"] < 4.0:
331
  await asyncio.sleep(0.1)
332
+ if time.perf_counter() - t_speech_end > 60:
333
  break
334
  answer_s = (bot_audio["last_arrival"] - bot_audio["first_arrival"])
335
 
 
407
  print("\n--- what the bot heard and said (bot-events.jsonl) ---")
408
  for e in bot_log:
409
  if e["type"] in ("asr.final", "agent.speak"):
410
+ extra = e["payload"].get("seconds")
411
+ print(f" {e['type']:12s} ts=+{e['ts'] % 1000:8.2f}s"
412
+ + (f" (asr {extra}s)" if extra else "")
413
+ + f" {e['payload'].get('text', '')[:140]}")
414
  elif e["type"] in ("turn.completed", "session.error"):
415
  print(f" {e['type']:12s} {e['payload']}")
416
  except Exception as e: