From 72e38870f8cfd1aadd65ffb1d31b46d673475e16 Mon Sep 17 00:00:00 2001 From: tgasser-nv <200644301+tgasser-nv@users.noreply.github.com> Date: Tue, 9 Sep 2025 21:19:50 -0500 Subject: [PATCH 1/2] Check for None before saving basic_index embeddings --- nemoguardrails/kb/kb.py | 2 ++ 1 file changed, 2 insertions(+) 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 From 03ba055f75e0841b8af293219b0458b98b000eee Mon Sep 17 00:00:00 2001 From: tgasser-nv <200644301+tgasser-nv@users.noreply.github.com> Date: Tue, 14 Oct 2025 15:52:00 -0500 Subject: [PATCH 2/2] Add nemoguardrails/kb to the pyright pre-commit list --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 6f841582d..8fa31661e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -157,6 +157,7 @@ pyright = "^1.1.405" include = [ "nemoguardrails/rails/**", "nemoguardrails/actions/**", + "nemoguardrails/kb/**", "nemoguardrails/logging/**", "nemoguardrails/tracing/**", "tests/test_callbacks.py",