Consider "tool_calls"
instead of "content"
in messages
#63
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".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.