diff --git a/nemoguardrails/kb/kb.py b/nemoguardrails/kb/kb.py index 685f8a9a0..bd440f842 100644 --- a/nemoguardrails/kb/kb.py +++ b/nemoguardrails/kb/kb.py @@ -167,6 +167,8 @@ async def build(self): # We also save the file for future use os.makedirs(CACHE_FOLDER, exist_ok=True) basic_index = cast(BasicEmbeddingsIndex, self.index) + if not basic_index.embeddings_index: + raise Exception("Couldn't create basic embeddings index") basic_index.embeddings_index.save(cache_file) # And, explicitly save the size as we need it when we reload