Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

RAG ANN test: build the recall check index on one thread (#16308)

Daniel Han5cbd693a247a
diff --git a/studio/backend/tests/test_rag_vec_ann.py b/studio/backend/tests/test_rag_vec_ann.py
index f642e68168b..ce596050882 100644
--- a/studio/backend/tests/test_rag_vec_ann.py
+++ b/studio/backend/tests/test_rag_vec_ann.py
@@ -36,9 +36,13 @@ def _exact(rows, keys, q, k):
return [int(keys[i]) for i in order]
-def _built(rows, keys):
+def _built(
+ rows,
+ keys,
+ threads = 2,
+):
index = vec_ann.new_index(rows.shape[1])
- vec_ann.add(np, index, keys, rows, threads = 2)
+ vec_ann.add(np, index, keys, rows, threads = threads)
index.expansion_search = vec_ann.EXPANSION_SEARCH
empty = np.empty(0, np.int64), np.empty((0, rows.shape[1]), np.float32)
return vec_ann.Ann(index, len(index), None, *empty)
@@ -47,7 +51,9 @@ def _built(rows, keys):
def test_search_recalls_the_exact_neighbours():
rows = _clustered(5000, 32)
keys = np.arange(5000) * 3 + 7
- ann = _built(rows, keys)
+ # One thread: a parallel build's graph depends on how the threads interleave, and read 0.983 on a CI
+ # runner. The bar is for the index and its search, not for the scheduler.
+ ann = _built(rows, keys, threads = 1)
rng = np.random.default_rng(1)
hits = 0
for q in rows[rng.integers(0, 5000, 20)] + 0.01: