Consider "tool_calls" instead of "content" in messages#63
Merged
ochafik merged 3 commits intogoogle:mainfrom May 15, 2025
Merged
Consider "tool_calls" instead of "content" in messages#63ochafik merged 3 commits intogoogle:mainfrom
"tool_calls" instead of "content" in messages#63ochafik merged 3 commits intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
grf53
commented
Apr 24, 2025
Contributor
Author
|
@ochafik Hello, I think you've seen this. How is your opinion on this changes? If there are more points to modify, please let me know. :) |
grf53
added a commit
to grf53/minja
that referenced
this pull request
May 6, 2025
10 tasks
ochafik
added a commit
to ggml-org/llama.cpp
that referenced
this pull request
May 15, 2025
* minja: sync google/minja@f06140f - google/minja#67 (@grf53) - google/minja#66 (@taha-yassine) - google/minja#63 (@grf53) - google/minja#58 --------- Co-authored-by: ochafik <ochafik@google.com>
justinryan-0923
pushed a commit
to justinryan-0923/llama.cpp
that referenced
this pull request
May 30, 2025
* minja: sync google/minja@f06140f - google/minja#67 (@grf53) - google/minja#66 (@taha-yassine) - google/minja#63 (@grf53) - google/minja#58 --------- Co-authored-by: ochafik <ochafik@google.com>
ochafik
added a commit
to ochafik/minja
that referenced
this pull request
Nov 2, 2025
* fix: require one of 'content' or 'tool_calls' in messages * fix: check content is given during polyfill tool_calls --------- Co-authored-by: Olivier Chafik <ochafik@users.noreply.github.com>
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.
In the latest document of transformers(link), a message containing 'tool calls' contains member with key
"tool_calls"instead of "content".{ "role": "assistant", "tool_calls": [ { "type": "function", "function": { "name": "multiply", "arguments": { "a": 5, "b": 6 } } } ] }The 'tool call' messages are not necessarily included as input messages because they are model outputs rather than model inputs. However, they are necessary to provide context during the process of providing tool execution results or after.
Currently, a message without
"content"cannot be put intochat_template::apply()due to the validation logic as follows.minja/include/minja/chat-template.hpp
Lines 398 to 399 in fcb5a0d
When referencing other lines of code, it seems like it's required to include a member with a
"content"key, even if it's null or an empty string. However, I don't think it's very persuasive to require even an empty"content"when"tool_calls"can replace it. So I propose to require only one of"content"and"tool_calls", as in this PR.