mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 08:33:49 +00:00
Harrison/llamacpp (#5402)
Co-authored-by: Gavin S <gavinswanson@gmail.com>
This commit is contained in:
parent
642ae83d86
commit
3e16468423
@ -279,3 +279,7 @@ class LlamaCpp(LLM):
|
||||
token=token, verbose=self.verbose, log_probs=log_probs
|
||||
)
|
||||
yield chunk
|
||||
|
||||
def get_num_tokens(self, text: str) -> int:
|
||||
tokenized_text = self.client.tokenize(text.encode("utf-8"))
|
||||
return len(tokenized_text)
|
||||
|
Loading…
Reference in New Issue
Block a user