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

讯飞星火哪个代码块是支持上下文对话的,还有就是流式返回接口,哪个代码块可以返回最终的对话结果 #26

Open
anna-engineer opened this issue May 11, 2024 · 6 comments

Comments

@anna-engineer
Copy link

No description provided.

@anna-engineer
Copy link
Author

2024-05-12 02:04:04.366 | INFO | apps.views.chat:create_chat_completion:96 - request: model='gpt-3.5-turbo' messages=[ChatMessage(role='user', content='你好', function_call=None), ChatMessage(role='assistant', content='你好!有什么我可以帮助你的吗?', function_call=None), ChatMessage(role='user', content='你好', function_call=None), ChatMessage(role='assistant', content='你好!有什么我可以帮助你的吗?', function_call=None), ChatMessage(role='user', content='使用四到五个字直接返回这句话的简要主题,不要解释、不要标点、不要语气词、不要多余文本,不要加粗,如果没有主题,请直接返回“闲聊”', function_call=None)] functions=None temperature=0.5 top_p=1.0 max_length=None stream=False stop=None, model: <apps.adapters.xunfei_spark.XunfeiSparkAPIModel object at 0x112f67cd0>

@tian-minghui
Copy link
Owner

不太清楚问题是啥?

@anna-engineer
Copy link
Author

WechatIMG209

{'question_tokens': 1, 'prompt_tokens': 115, 'completion_tokens': 8, 'total_tokens': 123}

这个是返回的tokens消耗,我有点不理解这个是不是正常消耗 'prompt_tokens': 115
而且连续对话好像是连接了上下文,同样的对话,还是会消耗更多

@tian-minghui
Copy link
Owner

这个是讯飞返回的结果, 每次请求是无状态的, 连续多轮对话,实际上是吧之前所有对话发送给模型,这个功能是你使用的客户端实现的

@anna-engineer
Copy link
Author

所以open-style-api这个项目没有提供上下文对话/多轮对话的功能的? 但是我看日志好像是拼接了历史对话的啊, create_chat_completion这个方法里掉用的 还有这个protocol.py文件里面的ChatMessage方法 不是拼接了多个对话吗,我有点不太清楚这个逻辑哈,望见谅,帮我解答下,谢谢

@anna-engineer
Copy link
Author

还有就是check_api_key 这个方法,能否返回StreamingResponse类型

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