From 308f0d133a7d6922fe96d4e5ce3853904c226ee3 Mon Sep 17 00:00:00 2001 From: Young Han Date: Fri, 31 Oct 2025 13:42:31 -0700 Subject: [PATCH] fix: mongodb lazy initialization --- .../providers/remote/vector_io/mongodb/mongodb.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/llama_stack/providers/remote/vector_io/mongodb/mongodb.py b/src/llama_stack/providers/remote/vector_io/mongodb/mongodb.py index 76a77746a..b1732008d 100644 --- a/src/llama_stack/providers/remote/vector_io/mongodb/mongodb.py +++ b/src/llama_stack/providers/remote/vector_io/mongodb/mongodb.py @@ -420,12 +420,14 @@ class MongoDBVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorStoresProto if self.config.persistence: self.kvstore = await kvstore_impl(self.config.persistence) - # Validate connection string + # Skip MongoDB connection if no connection string provided + # This allows other providers to work without MongoDB credentials if not self.config.connection_string: - raise ValueError( - "MongoDB connection_string is required but not provided. " - "Please set MONGODB_CONNECTION_STRING environment variable or provide it in config." + logger.warning( + "MongoDB connection_string not provided. " + "MongoDB vector store will not be available until credentials are configured." ) + return # Connect to MongoDB with optimized settings for RAG self.client = MongoClient(