Skip to content

Commit d7770e3

Browse files
committed
chore(types): Type-clean kb/ (1 error) (#1385)
* Check for None before saving basic_index embeddings * Add nemoguardrails/kb to the pyright pre-commit list
1 parent 5ffcd99 commit d7770e3

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-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

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ pyright = "^1.1.405"
157157
include = [
158158
"nemoguardrails/rails/**",
159159
"nemoguardrails/actions/**",
160+
"nemoguardrails/kb/**",
160161
"nemoguardrails/logging/**",
161162
"nemoguardrails/tracing/**",
162163
"tests/test_callbacks.py",

0 commit comments

Comments
 (0)