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

maxtoken设置的值较小时 回答的内容会被截断 #370

Open
LeopoldFize opened this issue Aug 6, 2024 · 8 comments
Open

maxtoken设置的值较小时 回答的内容会被截断 #370

LeopoldFize opened this issue Aug 6, 2024 · 8 comments

Comments

@LeopoldFize
Copy link

当我将最大响应token设置的较小时(比如200)模型输出的内容会被截断
比如我问 介绍一下XXX 回复应该是500个字 但我将最大token的值设置为最小时 回复还是500个字 不过被截断了 只返回给我了30个(大概)字

@josStorer
Copy link
Owner

max_tokens的作用就是限制生成的回答的长度,到达max_tokens时直接停止响应,表现为截断

@LeopoldFize
Copy link
Author

max_tokens的作用就是限制生成的回答的长度,到达max_tokens时直接停止响应,表现为截断

那么如何限制回答的长度呢

@josStorer
Copy link
Owner

max_tokens的作用就是限制生成的回答的长度

@LeopoldFize
Copy link
Author

max_tokens的作用就是限制生成的回答的长度

你好,我的意思是 如何让他将回复的内容控制在50个字内 而不是达到50字时将回答内容截断.

@josStorer
Copy link
Owner

地球上目前没有任何模型能保证准确做到这件事,严格来说 AI 并不会数数

@LeopoldFize
Copy link
Author

好的 明白了 ,谢谢你的回复

@josStorer
Copy link
Owner

一个可能的方法是,通过prompt要求它生成的回答尽可能简短,限制在XX字数内,然后生成完毕后,通过程序检测字数是否符合要求,如果不符合就重试,AI本身会将文本处理为token,只能二次开发处理字数

@LeopoldFize
Copy link
Author

好的 我尝试一下 谢谢你

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

No branches or pull requests

2 participants