fix(suggestion_handler): split system+user so non-OpenAI LLMs accept the request#1528
Open
Ptah-CT wants to merge 1 commit intoMemTensor:mainfrom
Open
Conversation
…the request handle_get_suggestion_queries built a message list with a single system role. OpenAI accepts that shape; several other LLM backends do not: - MiniMax (Text API at https://api.minimax.io/v1/chat/completions) rejects with HTTP 400 'invalid params, chat content is empty (2013)'. - MiniMax Anthropic-compatible API (https://api.minimax.io/anthropic/v1/messages) rejects with HTTP 400 'invalid params, messages must not be empty (2013)'. - The official Anthropic Messages API has the same requirement (system is a top-level field; messages[] must contain at least one user turn). Move the suggestion prompt into a user message and keep a short system role for the persona. OpenAI and other strict-schema providers both accept this shape, so it is a strict widening with no behaviour change for OpenAI/Azure deployments. Repro of the original bug: POST /product/suggestions with MOS_CHAT_MODEL=MiniMax-M2.7, OPENAI_API_BASE=https://api.minimax.io/v1 -> backend hits MiniMax which returns 400 (2013).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1527.
Problem
handle_get_suggestion_queriesbuilds a single system message:OpenAI accepts this. MiniMax (both Text API and Anthropic-compatible API) and Anthropic itself reject it with HTTP 400 (
chat content is empty (2013)/messages must not be empty (2013)). Per MiniMax's own minimal example in the docs, every request must contain at least one user turn.Change
Split into a short system persona + user message:
This is a strict widening:
No behaviour change for existing OpenAI deployments.
Type
Tested
POST /product/suggestionswithMOS_CHAT_MODEL=MiniMax-M2.7,OPENAI_API_BASE=https://api.minimax.io/v1:{\"data\":{\"query\":[\"...\",\"...\",\"...\"]}}populated by MiniMax-M2.7.Checklist