mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-03 12:56:02 +00:00
Minor fixes
This commit is contained in:
parent
184f8dcf53
commit
5e8d6b1c7d
2 changed files with 4 additions and 1 deletions
|
|
@ -3,6 +3,9 @@ import tiktoken
|
|||
APPROX_BUFFER = 1.1
|
||||
|
||||
def count_tokens(text: str, encoding_name="cl100k_base") -> int:
|
||||
if not text:
|
||||
return 0
|
||||
|
||||
# Get the encoding
|
||||
encoding = tiktoken.get_encoding(encoding_name)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue