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

偶发性无规律报错messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error) #209

Closed
ViperGash opened this issue Jun 21, 2024 · 8 comments

Comments

@ViperGash
Copy link

image
最近总是遇到这个提示。claude和gpt都会遇到。api渠道都是自己走官方的。没有中转。

messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error)

这个是当时的日志。

{"role":"assistant","content":"这张图片展示了一个知识图谱(Knowledge Graph)。它包含了多个相互连接的节点,每个节点代表一个概念或实体。主要内容如下:\n\n1. 中心节点是"Tesla Model 3",与多个其他节点相连。\n\n2. 地理位置相关的节点:\n - Fremont\n - Palo Alto\n - California\n - Hollywood\n - Paris\n - France\n\n3. 公司和品牌:\n - Tesla\n - Renault\n\n4. 人物:\n - Isabelle Adjani\n - Macron\n - Matthew McConaughey\n\n这些节点通过线条相互连接,表示它们之间存在某种关系。例如,Tesla Model 3与Fremont、Palo Alto和California相连,可能表示这款车的生产或设计地点。\n\n图的右上角标注了"Knowledge Graph"(知识图谱)字样,说明这是一个知识图谱的示例。\n\n这种图谱结构可以直观地展示不同概念之间的关联,有助于理解复杂的信息网络和关系。"},{"role":"user","content":[{"type":"text","text":"你能推荐一个通过代码自动生成知识图谱的方式/平台吗,并在该种方式/平台中复现我给你的知识图谱"}]},{"role":"assistant","content":"messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error)"},{"role":"user","content":[{"type":"text","text":"你能推荐一个通过代码自动生成知识图谱的方式/平台吗,并在该种方式/平台中复现我给你的知识图谱"}]}],"max_tokens":2000,"model":"claude-3-5-sonnet-20240620","stream":true,"temperature":0.6,"top_p":1,"top_k":5}
[DEBUG] - [2024-06-21 10:50:58] - [sse] request failed with status: 400 Bad Request
response: {"type":"error","error":{"type":"invalid_request_error","message":"messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row"}}
[WARNING] - [2024-06-21 10:50:58] - [channel] caught error messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error) for model claude-3-5-sonnet-20240620 at channel claude
[INFO] - [2024-06-21 10:50:58] - [channel] channels are exhausted for model claude-3-5-sonnet-20240620
[WARNING] - [2024-06-21 10:50:58] - messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row (type: invalid_request_error) (model: claude-3-5-sonnet-20240620, client: xxxxx)

@ViperGash
Copy link
Author

4o的错误发生的时候还没开启调试模式。所以等下次出现再补充。目前只有claude的。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The debugging mode was not turned on when the 4o error occurred. So I’ll add it next time. Currently only claude's.

@AnnaStreeter
Copy link
Collaborator

chatnio 什么版本

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


What version of chatnio

@zmh-program
Copy link
Member

latest 无法复现,请更新版本

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


latest cannot be reproduced, please update the version

@zmh-program
Copy link
Member

TIP: 如果你更新至最新版后仍然通过对接官方接口报错,请 Reopen 此 issue

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


TIP: If you still report an error through the official interface after updating to the latest version, please Reopen this issue

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

4 participants