Prompt Template Issue with Mixtral Model: "Conversation roles must alternate user/assistant" #10932
Replies: 3 comments 1 reply
-
|
Hi @mdetommasi! I'm Dosu and I’m helping the ragflow team. Yes, others have run into this error with Mixtral and other OpenAI-compatible models in RAGFlow. The root cause is that some RAGFlow workflows—especially knowledge graph extraction—can send chat message histories that don't strictly alternate between 'user' and 'assistant' roles, or include a 'system' role outside the initial position, which breaks the pattern required by Mixtral and similar models. There isn't a built-in config or code-level check in RAGFlow to enforce this alternation, so the most reliable workaround is to disable knowledge graph creation, which avoids sending problematic message histories. This issue is systemic in RAGFlow's knowledge graph logic and affects any OpenAI-compatible backend, not just Mixtral. If you need knowledge graph features, you'd have to patch the message construction logic to guarantee strict alternation before sending requests. More details and discussion are available in these threads: #9334, #3062. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
@dosu I disabled the knowledge graph both in the Chat settings and Dataset configurations, but the problem persists. |
Beta Was this translation helpful? Give feedback.
-
|
I have raised a bug issue in #11021 for this discussion. And the answer is we currently insert system role during conversation, and mistral model strictly don't accept system role.
|
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm encountering an error while using RAGFlow with a Mixtral model. The error seems to be related to chat conversation roles
ERROR: Error code: 400 - {'object': 'error', 'message': 'Conversation roles must alternate user/assistant/user/assistant/... Conversation roles must alternate user/assistant/user/assistant/...', 'type': 'BadRequestError', 'param': None, 'code': 400}From my investigation, it appears Mixtral expects strict alternation between 'user' and 'assistant' roles, but RAGFlow might be sending a 'system' role instead, which breaks the expected pattern.
Has anybody else encountered this prompt template compatibility issue with Mixtral models in RAGFlow? If so, were you able to find a solution or workaround?
Thanks in advance for any insights!
Beta Was this translation helpful? Give feedback.
All reactions