From 1b75792621d992f2844f719b25781001c7c0b9ed Mon Sep 17 00:00:00 2001 From: Young Han Date: Fri, 31 Oct 2025 11:03:47 -0700 Subject: [PATCH] fix(mongodb): cap numCandidates at 1000, raise on index failure, and add models_api dependency --- llama_stack/providers/remote/vector_io/mongodb/mongodb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_stack/providers/remote/vector_io/mongodb/mongodb.py b/llama_stack/providers/remote/vector_io/mongodb/mongodb.py index 5fed439f0..bec8c40fd 100644 --- a/llama_stack/providers/remote/vector_io/mongodb/mongodb.py +++ b/llama_stack/providers/remote/vector_io/mongodb/mongodb.py @@ -215,7 +215,7 @@ class MongoDBIndex(EmbeddingIndex): "index": self.config.index_name, "queryVector": embedding.tolist(), "path": self.config.path_field, - "numCandidates": k * 10, # Get more candidates for better results + "numCandidates": min(k * 10, 1000), # Cap at 1000 to prevent excessive candidates "limit": k, } },