Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tokens exceeded with too many related memories. #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AsakusaRinne
Copy link

有的时候会出现单条记忆比较长的情况,这样几条相关记忆加上去,token上限就超出了,导致不能正常发送prompt。加了一个简单的处理,如果检测到当前的几条相关记忆加上去后会超出最大token数限制,那么就按照相似度从低到高删除记忆。

@L1Xu4n
Copy link

L1Xu4n commented Jun 23, 2023

不建议让用户将最大token设置为模型的上下文窗口,发给模型的提示与模型的回复会一并算在上下文窗口,如果给4096的gpt3.5发送4ktoken会导致模型只能回复96token的内容

@AsakusaRinne
Copy link
Author

感谢提醒,就这个PR想解决的核心问题而言,内置一个合适的最大token数我觉得没有问题。如果考虑到后续的扩展性,我觉得这个还是应当交给用户来设置,以应对不同模型的情况,可以加一下关于这个的注释来告诉用户应该怎么设置,然后在配置模板文件里设置一个合适的默认值

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants