|
|
@@ -55,7 +55,7 @@ def num_tokens_from_messages(messages, model): |
|
|
|
except KeyError: |
|
|
|
logger.debug("Warning: model not found. Using cl100k_base encoding.") |
|
|
|
encoding = tiktoken.get_encoding("cl100k_base") |
|
|
|
if model == "gpt-3.5-turbo": |
|
|
|
if model == "gpt-3.5-turbo" or model == "gpt-35-turbo": |
|
|
|
return num_tokens_from_messages(messages, model="gpt-3.5-turbo-0301") |
|
|
|
elif model == "gpt-4": |
|
|
|
return num_tokens_from_messages(messages, model="gpt-4-0314") |
|
|
@@ -76,4 +76,4 @@ def num_tokens_from_messages(messages, model): |
|
|
|
if key == "name": |
|
|
|
num_tokens += tokens_per_name |
|
|
|
num_tokens += 3 # every reply is primed with <|start|>assistant<|message|> |
|
|
|
return num_tokens |
|
|
|
return num_tokens |