Skip to content

Commit 673aaf2

Browse files
committed
Check for None before saving basic_index embeddings
1 parent d660d66 commit 673aaf2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

nemoguardrails/kb/kb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ async def build(self):
167167
# We also save the file for future use
168168
os.makedirs(CACHE_FOLDER, exist_ok=True)
169169
basic_index = cast(BasicEmbeddingsIndex, self.index)
170+
if not basic_index.embeddings_index:
171+
raise Exception("Couldn't create basic embeddings index")
170172
basic_index.embeddings_index.save(cache_file)
171173

172174
# And, explicitly save the size as we need it when we reload

0 commit comments

Comments
 (0)