Skip to content

Commit 1fea9ef

Browse files
author
Baur
authored
Merge pull request #18 from ZenGuard-AI/nuradil/fix/gracefull-handle-none-api-key
[feedback] Handle API key being None gracefully
2 parents a05bd0f + 57affd8 commit 1fea9ef

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

zenguard/zenguard.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def __init__(
5858
self,
5959
config: ZenGuardConfig,
6060
):
61-
self._api_key = config.credentials.api_key
61+
api_key = config.credentials.api_key
62+
if type(api_key) != str or api_key == '':
63+
raise ValueError("The API key must be a string type and not empty.")
64+
self._api_key = api_key
6265
self._backend = "https://api.zenguard.ai/"
6366

6467
self._llm_client = None

0 commit comments

Comments
 (0)