chat: fix case where template accepts type content only#19419
Merged
ngxson merged 3 commits intoggml-org:masterfrom Feb 9, 2026
Merged
chat: fix case where template accepts type content only#19419ngxson merged 3 commits intoggml-org:masterfrom
ngxson merged 3 commits intoggml-org:masterfrom
Conversation
Collaborator
Author
pwilkin
approved these changes
Feb 9, 2026
common/chat.cpp
Outdated
| } | ||
| }); | ||
| } | ||
| printf("%s\n", jmsg.dump().c_str()); |
Collaborator
There was a problem hiding this comment.
Remove or convert to LOG_*
| // Parses a JSON array of messages in OpenAI's chat completion API format. | ||
| std::vector<common_chat_msg> common_chat_msgs_parse_oaicompat(const nlohmann::ordered_json & messages); | ||
|
|
||
| // DEPRECATED: only used in tests |
Collaborator
There was a problem hiding this comment.
Wouldn't it be a good idea just to replace common_chat_msgs_to_json_oaicompat with the body of the new render_message_to_json (with the extended signature with full caps) and make the old common_chat_msgs_to_json_oaicompat call it with just the single cap set?
Collaborator
Author
There was a problem hiding this comment.
Good idea, I implemented in 6edb330 , test-chat is OK
CISC
approved these changes
Feb 9, 2026
aldehir
approved these changes
Feb 9, 2026
liparetejas
pushed a commit
to liparetejas/llama.cpp
that referenced
this pull request
Feb 23, 2026
* chat: fix case where template accepts type content only * rm stray log * reuse render_message_to_json
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.
Fix chat template of PaddleOCR-VL, which requires content to be an array (see #18825)
This should be able to handle these case: