Skip to content

Commit

Permalink
fix exception
Browse files Browse the repository at this point in the history
  • Loading branch information
hudson-ai committed Nov 5, 2024
1 parent 93cff1f commit 90e5b6e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions guidance/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ def _parse(
if not mask[token]:
# Note: we could punt this probem to ll_interpreter.post_process,
# but it's a bit clearer to handle it here
# TODO: send valid tokens rather than mask?
raise InvalidTokenException(token, mask, tokens)
raise InvalidTokenException(
token=token,
valid_tokens=[i for i in range(len(mask)) if mask[i]],
prompt_tokens=tokens
)

backtrack, ff_tokens = self.ll_interpreter.post_process(token)
if backtrack:
Expand Down

0 comments on commit 90e5b6e

Please sign in to comment.