From ab824b53e39b4fe3e7113d1b271a6ccd1ec0e5f3 Mon Sep 17 00:00:00 2001 From: Young Han Date: Fri, 31 Oct 2025 11:01:28 -0700 Subject: [PATCH] fix(mongodb): raise exception on index initialization failure and add models_api dependency --- .../providers/remote/vector_io/mongodb/mongodb.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llama_stack/providers/remote/vector_io/mongodb/mongodb.py b/llama_stack/providers/remote/vector_io/mongodb/mongodb.py index b17fa910e..5fed439f0 100644 --- a/llama_stack/providers/remote/vector_io/mongodb/mongodb.py +++ b/llama_stack/providers/remote/vector_io/mongodb/mongodb.py @@ -93,11 +93,11 @@ class MongoDBIndex(EmbeddingIndex): f"Failed to initialize MongoDB index for vector_db: {self.vector_db.identifier}. " f"Collection name: {self.collection.name}. Error: {str(e)}" ) - # Don't fail completely - just log the error and continue - logger.warning( - "Continuing without complete index initialization. " - "You may need to create indexes manually in MongoDB Atlas dashboard." - ) + raise RuntimeError( + f"Failed to initialize MongoDB vector search index. " + f"Vector store '{self.vector_db.identifier}' cannot function without indexes. " + f"Error: {str(e)}" + ) from e async def _create_vector_search_index(self) -> None: """Create optimized vector search index based on MongoDB RAG best practices."""