MGLDZM commited on
Commit
35ffcab
·
verified ·
1 Parent(s): d6987d3
Files changed (1) hide show
  1. modules/llm.py +6 -4
modules/llm.py CHANGED
@@ -13,10 +13,12 @@ if TYPE_CHECKING:
13
  import asyncio
14
 
15
 
16
-
17
-
18
- encoding = tiktoken.encoding_for_model(settings.GPT_MODEL)
19
-
 
 
20
 
21
  def ejecutar(chat: "model.Chat", session: "model.Session"):
22
  temp_messages = [msg.model_dump() for msg in chat.messages]
 
13
  import asyncio
14
 
15
 
16
+ encoding=None
17
+ try:
18
+ encoding = tiktoken.encoding_for_model(settings.GPT_MODEL)
19
+ except:
20
+ print("backing to o200k")
21
+ encoding = tiktoken.get_encoding("o200k_base")
22
 
23
  def ejecutar(chat: "model.Chat", session: "model.Session"):
24
  temp_messages = [msg.model_dump() for msg in chat.messages]