Skip to content

Commit 9b7ef17

Browse files
Update graphgen/bases/base_llm_client.py
Co-authored-by: Copilot <[email protected]>
1 parent e42bcb6 commit 9b7ef17

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

graphgen/bases/base_llm_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ async def generate_inputs_prob(
5959

6060
def count_tokens(self, text: str) -> int:
6161
"""Count the number of tokens in the text."""
62+
if self.tokenizer is None:
63+
raise ValueError("Tokenizer is not set. Please provide a tokenizer to use count_tokens.")
6264
return len(self.tokenizer.encode(text))
6365

6466
@staticmethod

0 commit comments

Comments
 (0)