fix(logger): fix typewriter simulation doesn't work well with Typing spinner

This commit is contained in:
Fabrice Hong
2023-04-12 14:39:54 +02:00
parent 1f5049a9c4
commit 862d44ea39
5 changed files with 117 additions and 97 deletions

View File

@@ -15,7 +15,7 @@ def count_message_tokens(messages : List[Dict[str, str]], model : str = "gpt-3.5
try:
encoding = tiktoken.encoding_for_model(model)
except KeyError:
print("Warning: model not found. Using cl100k_base encoding.")
logger.warn("Warning: model not found. Using cl100k_base encoding.")
encoding = tiktoken.get_encoding("cl100k_base")
if model == "gpt-3.5-turbo":
# !Node: gpt-3.5-turbo may change over time. Returning num tokens assuming gpt-3.5-turbo-0301.")