core: auto-cleanup for LeannSearcher/LeannChat (__enter__/__exit__/__del__); ensure server terminate/kill robustness; benchmarks: use searcher.cleanup(); docs: suggest uv run

This commit is contained in:
Andy Lee
2025-08-14 14:29:57 -07:00
parent e3518a31ed
commit ded0701504
4 changed files with 47 additions and 7 deletions

View File

@@ -113,10 +113,10 @@ def benchmark_backend(
]
score_validity_rate = len(valid_scores) / len(all_scores) if all_scores else 0
# Clean up
# Clean up (ensure embedding server shutdown and object GC)
try:
if hasattr(searcher, "__del__"):
searcher.__del__()
if hasattr(searcher, "cleanup"):
searcher.cleanup()
del searcher
del builder
gc.collect()