Skip to content

Commit 09e05de

Browse files
Add error check.
1 parent 5221e25 commit 09e05de

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,8 @@ def preprocess_prompt(prompt: str, tag: str, kv: Callable[[str], dict], kv_subke
474474
if _m:
475475
key = _m.group(1)
476476
v = kv(key)
477+
if not v:
478+
raise KeyError(f"No such prompt key available: {key}")
477479
_prompt = _prompt.replace(
478480
full_match,
479481
str(v[kv_subkey]) if kv_subkey else str(v))

0 commit comments

Comments
 (0)