Skip to content

Commit

Permalink
Merge pull request #10 from Stevenic/main
Browse files Browse the repository at this point in the history
resolve merge conflict
  • Loading branch information
debuggerone authored Sep 21, 2024
2 parents f61ca57 + 8091c1b commit f340066
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/token_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def __init__(self, model="gpt-3.5-turbo"):
Args:
model (str): The model name to use for token encoding.
Note: tiktoken does not directly support "gpt-4o-mini" at the moment.
Note: tiktoken does not directly support "gpt-4o-mini" at the moment,
so "cl100k_base" is used as a workaround.
"""
self.encoder = tiktoken.get_encoding("cl100k_base")

Expand All @@ -35,3 +36,4 @@ def count_tokens(self, messages):
for message in messages:
total_tokens += len(self.encoder.encode(message["content"]))
return total_tokens

0 comments on commit f340066

Please sign in to comment.