Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -56,7 +56,7 @@ def num_tokens_from_messages(messages, model="gpt-3.5-turbo"):
|
|
56 |
raise NotImplementedError(f"""num_tokens_from_messages() is not presently implemented for model {model}.
|
57 |
See https://github.com/openai/openai-python/blob/main/chatml.md for information on how messages are converted to tokens.""")
|
58 |
|
59 |
-
def forget_long_term(messages, max_num_tokens=
|
60 |
while num_tokens_from_messages(messages)>max_num_tokens:
|
61 |
if messages[0]["role"]=="system" and not len(messages[0]["content"])>=max_num_tokens:
|
62 |
messages = messages[:1] + messages[2:]
|
|
|
56 |
raise NotImplementedError(f"""num_tokens_from_messages() is not presently implemented for model {model}.
|
57 |
See https://github.com/openai/openai-python/blob/main/chatml.md for information on how messages are converted to tokens.""")
|
58 |
|
59 |
+
def forget_long_term(messages, max_num_tokens=3000):
|
60 |
while num_tokens_from_messages(messages)>max_num_tokens:
|
61 |
if messages[0]["role"]=="system" and not len(messages[0]["content"])>=max_num_tokens:
|
62 |
messages = messages[:1] + messages[2:]
|