From de2710539f9ed73b7e0101054a3e29d5e378c29b Mon Sep 17 00:00:00 2001 From: monosans Date: Sun, 8 Oct 2023 10:59:52 +0300 Subject: [PATCH] Add missing await --- api/helpers/tokens.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/helpers/tokens.py b/api/helpers/tokens.py index 848cac8..86fe04b 100644 --- a/api/helpers/tokens.py +++ b/api/helpers/tokens.py @@ -38,10 +38,10 @@ async def count_for_messages(messages: list, model: str='gpt-3.5-turbo-0613') -> tokens_per_name = -1 # if there's a name, the role is omitted elif 'gpt-3.5-turbo' in model: - return count_for_messages(messages, model='gpt-3.5-turbo-0613') + return await count_for_messages(messages, model='gpt-3.5-turbo-0613') elif 'gpt-4' in model: - return count_for_messages(messages, model='gpt-4-0613') + return await count_for_messages(messages, model='gpt-4-0613') else: raise NotImplementedError(f"""count_for_messages() is not implemented for model {model}.