We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
resp = qianfan.ChatCompletion.do(stream=True)操作支持提前终止流式对话吗?
No response
The text was updated successfully, but these errors were encountered:
Issue you'd like to raise. resp = qianfan.ChatCompletion.do(stream=True)操作支持提前终止流式对话吗? Suggestion: No response
您好,谢谢反馈,请问是指支持停止字符串吗:
from qianfan import Completion c = Completion("ERNIE-Bot") for r in c.do(prompt="hi", stream=True, stop=["hi","好"]): print(r["body"])
output:
{'id': 'as-yp1jc8nevt', 'object': 'completion', 'created': 1709020272, 'sentence_id': 0, 'is_end': True, 'is_truncated': False, 'result': '您', 'need_clear_history': False, 'finish_reason': 'stop', 'usage': {'prompt_tokens': 1, 'completion_tokens': 1, 'total_tokens': 2}}
Sorry, something went wrong.
@danielhjz 应该是指像 OpenAI 这种,可以提前 abort。这样会更省钱一点,毕竟如果前台用户不满意当前结果可以立即终止模型继续生成 token。
我在使用 http 请求的形式对接千帆时,用了 AbortController 来终止(当然我不知道百度后台是否真的停止生成token了)。今天切换到 @baidu/qianfan,不知道有没有什么好的办法提前终止呢?
No branches or pull requests
Issue you'd like to raise.
resp = qianfan.ChatCompletion.do(stream=True)操作支持提前终止流式对话吗?
Suggestion:
No response
The text was updated successfully, but these errors were encountered: