|
@ -243,8 +243,8 @@ class AI(object): |
|
|
tmp_prompt_text = prompt.format(chat_history=conversation_memory.buffer, input=message.content) |
|
|
tmp_prompt_text = prompt.format(chat_history=conversation_memory.buffer, input=message.content) |
|
|
prompt_len = self.llm_chat.get_num_tokens(tmp_prompt_text) |
|
|
prompt_len = self.llm_chat.get_num_tokens(tmp_prompt_text) |
|
|
|
|
|
|
|
|
if prompt_len+256 > 2000: |
|
|
if prompt_len+200 > 2048: |
|
|
logger.warning(f"Prompt too large. Estimated {prompt_len} tokens") |
|
|
logger.warning(f"Prompt too large. Estimated {prompt_len} tokens. Summarizing...") |
|
|
await reply_fn(f"<WARNING> Prompt too large. Estimated {prompt_len} tokens") |
|
|
await reply_fn(f"<WARNING> Prompt too large. Estimated {prompt_len} tokens") |
|
|
if i == 0: |
|
|
if i == 0: |
|
|
await conversation_memory.prune_memory(conversation_memory.min_len) |
|
|
await conversation_memory.prune_memory(conversation_memory.min_len) |
|
|