Skip to content

add missing context/toolcall parameters - #140

Merged
davidkoski merged 2 commits into
mainfrom
tool-calling
Mar 26, 2026
Merged

davidkoski merged 2 commits into
mainfrom
tool-calling

Conversation

@davidkoski

Copy link
Copy Markdown
Member

Proposed changes

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

@davidkoski
davidkoski requested a review from angeloskath March 10, 2026 16:44
let promptTokens = try tokenizer.applyChatTemplate(messages: messages)
let promptTokens = try tokenizer.applyChatTemplate(
messages: messages, tools: input.tools,
additionalContext: input.additionalContext)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the VLMs got copy & pasted without the tool and additional context (e.g. thinking) -- tool calling was probably not in place when the first VLM was built.

Anyway, see also #139 which is the same issue.

///
/// - Parameter messages: Array of message dictionaries with "role" and "content" keys
/// - Returns: Array of token IDs
@available(*, deprecated, message: "Use applyChatTemplate directly on tokenizer")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is unused in the library -- warn people not to call it because it doesn't have the extra parameters.

@angeloskath angeloskath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@davidkoski
davidkoski merged commit 9a8e3a5 into main Mar 26, 2026
2 checks passed
alankessler added a commit to alankessler/mlx-swift-lm that referenced this pull request Mar 31, 2026
GlmOcr never forwarded tools or additionalContext to applyChatTemplate
(added after ml-explore#140, missed the pattern). SmolVLM2's video path was also
missing them while its other two branches had them.
viktike pushed a commit to viktike/mlx-swift-lm that referenced this pull request Mar 31, 2026
GlmOcr never forwarded tools or additionalContext to applyChatTemplate
(added after ml-explore#140, missed the pattern). SmolVLM2's video path was also
missing them while its other two branches had them.
TheTom referenced this pull request in TheTom/mlx-swift-lm Apr 5, 2026
* add missing context/toolcall parameters

- see ekryski#139
alankessler added a commit to alankessler/mlx-swift-lm that referenced this pull request Apr 15, 2026
GlmOcr never forwarded tools or additionalContext to applyChatTemplate
(added after ml-explore#140, missed the pattern). SmolVLM2's video path was also
missing them while its other two branches had them.
davidkoski pushed a commit that referenced this pull request May 11, 2026
…#174)

GlmOcr never forwarded tools or additionalContext to applyChatTemplate
(added after #140, missed the pattern). SmolVLM2's video path was also
missing them while its other two branches had them.
@davidkoski
davidkoski deleted the tool-calling branch July 10, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants